enum fsp_binlog_chunk_types { /* Zero means no data, effectively EOF. */
FSP_BINLOG_TYPE_EMPTY= 0, /* A binlogged committed event group. */
FSP_BINLOG_TYPE_COMMIT= 1, /* A binlog GTID state record. */
FSP_BINLOG_TYPE_GTID_STATE= 2, /* Out-of-band event group data. */
FSP_BINLOG_TYPE_OOB_DATA= 3, /* Dummy record, use to fill remainder of page (eg. FLUSH BINARY LOGS). */
FSP_BINLOG_TYPE_DUMMY= 4, /* User XA record containing XID and OOB reference for XA PREPARE. */
FSP_BINLOG_TYPE_XA_PREPARE= 5, /* User XA record containing XID for XA COMMIT/ROLLBACK. */
FSP_BINLOG_TYPE_XA_COMPLETE= 6, /* Must be one more than the last type. */
FSP_BINLOG_TYPE_END,
/* Padding data at end of page. */
FSP_BINLOG_TYPE_FILLER= 0xff
};
/** Thesearethechunktypesthatareallowedtooccurinthemiddleof anotherrecord.
*/ static constexpr uint64_t ALLOWED_NESTED_RECORDS= /* GTID STATE at start of page can occur in the middle of other record. */
((uint64_t)1 << FSP_BINLOG_TYPE_GTID_STATE) | /* DUMMY data at tablespace end can occur in the middle of other record. */
((uint64_t)1 << FSP_BINLOG_TYPE_DUMMY)
; /* Ensure that all types fit in the ALLOWED_NESTED_RECORDS bitmask. */
static_assert(FSP_BINLOG_TYPE_END <= 8*sizeof(ALLOWED_NESTED_RECORDS), "Binlog types must be <64 to fit " "in ALLOWED_NESTED_RECORDS bitmask");
/** Structure of an entry in the hash of binlog tablespace files. */ struct ibb_tblspc_entry {
uint64_t file_no; /* Activetransactions/oob-event-groupsthatstartinthisbinlogtablespace file(includinganyuserXA).
*/
std::atomic<uint64_t>oob_refs; /* Active XA transactions whose oob start in this binlog tablespace file. */
std::atomic<uint64_t>xa_refs; /* Theearliestfilenumberthatthisbinlogtablespacefilehasoob referencesinto. (Thisisaconservativeestimate,referencesmaynotactuallyexistin casetheircommitrecordwentintoalaterfile,ortheyendeduprolling back). IncludesanyXAoobrecords.
*/
std::atomic<uint64_t>oob_ref_file_no; /* Earliest file number that we have XA references into. */
std::atomic<uint64_t>xa_ref_file_no;
/* Currentstate,canbeobtainedfromsave_pos()andlaterpassedto restore_pos().
*/ struct saved_position { /* Current position file. */
uint64_t file_no; /* The file_no of the start of a record, if in_record is true. */
uint64_t rec_start_file_no; /* Current position page. */
uint32_t page_no; /* Start of current chunk inside page. */
uint32_t in_page_offset; /* Thelengthofthecurrentchunk,oncethechunktypehasbeenread. If0,itmeansthechunktype(andlength)hasnotyetbeenread.
*/
uint32_t chunk_len; /* The read position inside the current chunk. */
uint32_t chunk_read_offset;
byte chunk_type; /* When set, read will skip the current chunk, if any. */ bool skip_current; /* Set while we are in the middle of reading a record. */ bool in_record;
} s;
/* Amount of data in file, valid after fetch_current_page(). */
uint64_t cur_end_offset; /* Length of the currently open file, valid if cur_file_handle != -1. */
uint64_t cur_file_length; /* Ifdifferentfrom~0,stop(returnEOF)whenreachingtheendofthisfile. ThisisusedforSHOWBINLOGEVENTS,whichhasanoldfile-basedinterface, andwantstoshowtheeventsinasinglefile.
*/
uint64_t stop_file_no; /* Afterfetch_current_page(),thispointsintoeithercur_blockor page_bufferasappropriate.
*/
byte *page_ptr; /* Valid after fetch_current_page(), if page found in buffer pool. */
fsp_binlog_page_entry *cur_block; /* Buffer for reading a page directly from a tablespace file. */
byte *page_buffer; /* Pointstoeitherbinlog_cur_durable_offset,forreadersthatshouldnot seebinlogdatauntilithasbecomedurableondisk;or binlog_cur_end_offsetotherwise.
*/
std::atomic<uint64_t> * const limit_offset; /* Open file handle to tablespace file_no, or -1. */
File cur_file_handle; /* Flagusedtoskiptherestofanypartialchunkwemightbestartingin themiddleof.
*/ bool skipping_partial;
Returnsnumberofbytesread,or-1forerror. Returns0ifthechunk_readerispointingtostartofachunkattheend ofthecurrentbinlog(ie.end-of-file).
*/ int read_data(byte *buffer, int max_len, bool multipage); /* Findachunkboundaryatorafterspecifiedoffsetincurrentpage.Used forinit_legacy_pos()tofindavalidstartingposition.
*/ int find_offset_in_page(uint32_t off); /* Read the file header of current file_no. */ int get_file_header(binlog_header_data *out_header);
/* Save current position, and restore it later. */ void save_pos(saved_position *out_pos) { *out_pos= s; } void restore_pos(saved_position *pos); void seek(uint64_t file_no, uint64_t offset);
/* Makenextread_data()skipanydatafromthecurrentchunk(ifany),and
start reading data only from the beginning of the next chunk. */ void skip_current() { if (s.in_record) s.skip_current= true; } /* Usedinitially,afterseekingpotentiallyintothemiddleofa(commit) record,toskipanycontinuationchunksuntilwereachthestartofthe firstrealrecord.
*/ void skip_partial(bool skip) { skipping_partial= skip; } /* Release any buffer pool page latch. */ void release(bool release_file_page= false); bool data_available(); bool is_before_pos(uint64_t file_no, uint64_t offset);
uint64_t current_file_no() { return s.file_no; }
uint64_t current_pos() { return (s.page_no << ibb_page_size_shift) + s.in_page_offset;
}
};
/** The state interval (in pages) used for active_binlog_file_no. */ extern uint64_t current_binlog_state_interval; extern mysql_mutex_t active_binlog_mutex; extern pthread_cond_t active_binlog_cond; extern mysql_mutex_t binlog_durable_mutex; extern mysql_cond_t binlog_durable_cond; extern std::atomic<uint64_t> active_binlog_file_no; extern uint64_t first_open_binlog_file_no; extern uint64_t last_created_binlog_file_no; extern std::atomic<uint64_t> binlog_cur_durable_offset[4]; extern std::atomic<uint64_t> binlog_cur_end_offset[4]; extern fsp_binlog_page_fifo *binlog_page_fifo;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.