YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/* This file is included by all internal maria files */
#define MARIA_NAME_IEXT ".MAI" #define MARIA_NAME_DEXT ".MAD" /* Max extra space to use when sorting keys */ #define MARIA_MAX_TEMP_LENGTH (2*1024L*1024L*1024L) /* Possible values for maria_block_size (must be power of 2) */ #define MARIA_KEY_BLOCK_LENGTH 8192/* default key block length */ #define MARIA_MIN_KEY_BLOCK_LENGTH 1024/* Min key block length */ #define MARIA_MAX_KEY_BLOCK_LENGTH 32768 /* Minimal page cache when we only want to be able to scan a table */ #define MARIA_MIN_PAGE_CACHE_SIZE (8192L*16L)
typedefstruct st_maria_info
{
ha_rows records; /* Records in database */
ha_rows deleted; /* Deleted records in database */
MARIA_RECORD_POS recpos; /* Pos for last used record */
MARIA_RECORD_POS newrecpos; /* Pos if we write new record */
MARIA_RECORD_POS dup_key_pos; /* Position to record with dup key */
my_off_t data_file_length; /* Length of data file */
my_off_t max_data_file_length, index_file_length;
my_off_t max_index_file_length, delete_length;
ulonglong auto_increment;
ulonglong key_map; /* Which keys are used */
time_t create_time; /* When table was created */
time_t check_time;
time_t update_time;
ulong record_offset; double *rec_per_key; /* for sql optimizing */
ulong reclength; /* Recordlength */
ulong mean_reclength; /* Mean recordlength (if packed) */ char *data_file_name, *index_file_name; enum data_file_type data_file_type;
uint keys; /* Number of keys in use */
uint options; /* HA_OPTION_... used */
uint reflength; int errkey, /* With key was dupplicated on err */
sortkey; /* clustered by this key */
File filenr; /* (uniq) filenr for datafile */
} MARIA_INFO;
struct st_maria_share; struct st_maria_handler; /* For reference */ struct st_maria_keydef;
struct st_maria_key /* Internal info about a key */
{
uchar *data; /* Data for key */ struct st_maria_keydef *keyinfo; /* Definition for key */
uint data_length; /* Length of key data */
uint ref_length; /* record ref + transid */
uint32 flag; /* 0 or SEARCH_PART_KEY */
};
#define HA_RECOVER_NONE 0/* No automatic recover */ #define HA_RECOVER_DEFAULT 1/* Automatic recover active */ #define HA_RECOVER_BACKUP 2/* Make a backupfile on recover */ #define HA_RECOVER_FORCE 4/* Recover even if we loose rows */ #define HA_RECOVER_QUICK 8/* Don't check rows in data file */
int maria_write_data_suffix(MARIA_SORT_INFO *sort_info, my_bool fix_datafile);
struct st_transaction;
/* undef map from my_nosys; We need test-if-disk full */ #undef my_write
#define CRC_SIZE 4
typedefstruct st_maria_state_info
{ struct
{ /* Fileheader (24 bytes) */
uchar file_version[4];
uchar options[2];
uchar header_length[2];
uchar state_info_length[2];
uchar base_info_length[2];
uchar base_pos[2];
uchar key_parts[2]; /* Key parts */
uchar unique_key_parts[2]; /* Key parts + unique parts */
uchar keys; /* number of keys in file */
uchar uniques; /* number of UNIQUE definitions */
uchar not_used; /* Language for indexes */
uchar fulltext_keys;
uchar data_file_type; /* Used by mariapack to store the original data_file_type */
uchar org_data_file_type;
} header;
MARIA_STATUS_INFO state; /* maria_ha->state points here for crash-safe but not versioned tables */
MARIA_STATUS_INFO common; /* State for a versioned table that is temporary non versioned */
MARIA_STATUS_INFO no_logging;
ha_rows split; /* number of split blocks */
my_off_t dellink; /* Link to next removed block */
pgcache_page_no_t first_bitmap_with_space;
ulonglong auto_increment;
TrID create_trid; /* Minimum trid for file */
TrID last_change_trn; /* selfdescriptive */
ulong update_count; /* Updated for each write lock */
ulong status; double *rec_per_key_part;
ulong *nulls_per_key_part;
ha_checksum checksum; /* Table checksum */
my_off_t *key_root; /* Start of key trees */
my_off_t key_del; /* delete links for index pages */
my_off_t records_at_analyze; /* Rows when calculating rec_per_key */
ulong sec_index_changed; /* Updated when new sec_index */
ulong sec_index_used; /* which extra index are in use */
ulonglong key_map; /* Which keys are in use */
ulong version; /* timestamp of create */
time_t create_time; /* Time when created database */
time_t recover_time; /* Time for last recover */
time_t check_time; /* Time for last check */
uint sortkey; /* sorted by this key (not used) */
uint open_count;
uint changed; /* Changed since maria_chk */
uint org_changed; /* Changed since open */ /** Birthdayofthetable:norecordinthelogbeforethisLSNshouldever beappliedtothetable.Updatedwhencreated,renamed,explicitly repaired(REPAIR|OPTIMIZETABLE,ALTERTABLEENABLEKEYS,maria_chk).
*/
LSN create_rename_lsn; /** @brief Log horizon when state was last updated on disk */
TRANSLOG_ADDRESS is_of_horizon; /** REDOphaseshouldignoreanyrecordbeforethisLSN.UNDOphase shouldn't,thisisthedifferencewithcreate_rename_lsn. skip_redo_lsn>=create_rename_lsn. Thedistinctionisforthesecases: -afterarepairatendofbulkinsert(enablingindices),REDOphase shouldskipthetablebutUNDOphaseshouldnot,soonlyskip_redo_lsnis increased,notcreate_rename_lsn -ifonetableiscorruptedandsorecoveryfails,usermayrepairthe tablewithmaria_chkandletrecoveryrestart:thatrecoveryshouldthen skiptherepairedtableevenintheUNDOphase,socreate_rename_lsnis increased.
*/
LSN skip_redo_lsn; /* LSN when we wrote file id to the log */
LSN logrec_file_id;
uint8 dupp_key; /* Lastly processed index with */ /* violated uniqueness constraint */
/* the following isn't saved on disk */
uint state_diff_length; /* Should be 0 */
uint state_length; /* Length of state header in file */
ulong *key_info;
} MARIA_STATE_INFO;
typedefstruct st_ma_base_info
{
my_off_t keystart; /* Start of keys */
my_off_t max_data_file_length;
my_off_t max_key_file_length;
my_off_t margin_key_file_length;
ha_rows records, reloc; /* Create information */
ulong mean_row_length; /* Create information */
ulong reclength; /* length of unpacked record */
ulong pack_reclength; /* Length of full packed rec */
ulong min_pack_length;
ulong max_pack_length; /* Max possibly length of packed rec */
ulong min_block_length;
ulong s3_block_size; /* Block length for S3 files */
uint fields; /* fields in table */
uint fixed_not_null_fields;
uint fixed_not_null_fields_length;
uint max_field_lengths;
uint pack_fields; /* packed fields in table */
uint varlength_fields; /* char/varchar/blobs */ /* Number of bytes in the index used to refer to a row (2-8) */
uint rec_reflength; /* Number of bytes in the index used to refer to another index page (2-8) */
uint key_reflength; /* = 2-8 */
uint keys; /* same as in state.header */
uint auto_key; /* Which key-1 is a auto key */
uint blobs; /* Number of blobs */ /* Length of packed bits (when table was created first time) */
uint pack_bytes; /* Length of null bits (when table was created first time) */
uint original_null_bytes;
uint null_bytes; /* Null bytes in record */
uint field_offsets; /* Number of field offsets */
uint max_key_block_length; /* Max block length */
uint max_key_length; /* Max key length */ /* Extra allocation when using dynamic record format */
uint extra_alloc_bytes;
uint extra_alloc_procent;
uint is_nulls_extended; /* 1 if new null bytes */
uint default_row_flag; /* 0 or ROW_FLAG_NULLS_EXTENDED */
uint block_size; /* Size of initial record buffer */
uint default_rec_buff_size; /* Extra number of bytes the row format require in the record buffer */
uint extra_rec_buff_size; /* Tuning flags that can be ignored by older Maria versions */
uint extra_options; /* default language, not really used but displayed by maria_chk */
uint language; /* Compression library used. 0 for no compression */
uint compression_algorithm;
/* The following are from the header */
uint key_parts, all_key_parts;
uchar uuid[MY_UUID_SIZE]; /** @briefIffalse,wedisablelogging,versioning,transactionetc.Observe differencewithMARIA_SHARE::now_transactional
*/
my_bool born_transactional;
} MARIA_BASE_INFO;
typedefstruct st_maria_blob /* Info of record */
{
ulong offset; /* Offset to blob in record */
uint pack_length; /* Type of packed length */
ulong length; /* Calc:ed for each record */
} MARIA_BLOB;
typedefstruct st_maria_file_bitmap
{ struct st_maria_share *share;
uchar *map;
pgcache_page_no_t page; /* Page number for current bitmap */
pgcache_page_no_t last_bitmap_page; /* Last possible bitmap page */
my_bool changed; /* 1 if page needs to be written */
my_bool changed_not_flushed; /* 1 if some bitmap is not flushed */
my_bool return_first_match; /* Shortcut find_head() */
uint used_size; /* Size of bitmap head that is not 0 */
uint full_head_size; /* Where to start search for head */
uint full_tail_size; /* Where to start search for tail */
uint flush_all_requested; /**< If _ma_bitmap_flush_all waiting */
uint waiting_for_flush_all_requested; /* If someone is waiting for above */
uint non_flushable; /**< 0 if bitmap and log are in sync */
uint waiting_for_non_flushable; /* If someone is waiting for above */
PAGECACHE_FILE file; /* datafile where bitmap is stored */
mysql_mutex_t bitmap_lock;
mysql_cond_t bitmap_cond; /**< When bitmap becomes flushable */ /* Constants, allocated when initiating bitmaps */
uint sizes[8]; /* Size per bit combination */
uint total_size; /* Total usable size of bitmap page */
uint max_total_size; /* Max value for total_size */
uint last_total_size; /* Size of bitmap on last_bitmap_page */
uint block_size; /* Block size of file */
ulong pages_covered; /* Pages covered by bitmap + 1 */
DYNAMIC_ARRAY pinned_pages; /**< not-yet-flushable bitmap pages */
} MARIA_FILE_BITMAP;
typedefstruct st_maria_share
{ /* Shared between opens */
MARIA_STATE_INFO state;
MARIA_STATE_INFO checkpoint_state; /* Copy of saved state by checkpoint */
MARIA_BASE_INFO base;
MARIA_STATE_HISTORY *state_history;
MARIA_KEYDEF ft2_keyinfo; /* Second-level ft-key definition */
MARIA_KEYDEF *keyinfo; /* Key definitions */
MARIA_UNIQUEDEF *uniqueinfo; /* unique definitions */
HA_KEYSEG *keyparts; /* key part info */
MARIA_COLUMNDEF *columndef; /* Pointer to column information */
MARIA_PACK pack; /* Data about packed records */
MARIA_BLOB *blobs; /* Pointer to blobs */
uint16 *column_nr; /* Original column order */
LEX_STRING unique_file_name; /* realpath() of index file */
LEX_STRING data_file_name; /* Resolved path names from symlinks */
LEX_STRING index_file_name;
LEX_STRING open_file_name; /* parameter to open filename */
uchar *file_map; /* mem-map of file if possible */
LIST *open_list; /* Tables open with this share */
PAGECACHE *pagecache; /* ref to the current key cache */
MARIA_DECODE_TREE *decode_trees; int crash_error; /* Reason for marked crashed */ /* Previousauto-incrementvalue.Usedtoverifyifwecanrestorethe auto-incrementcounterifwehavetoabortaninsert(duplicatekey).
*/
ulonglong last_auto_increment;
uint16 *decode_tables;
uint16 id; /**< 2-byte id by which log records refer to the table */ /* Called the first time the table instance is opened */
my_bool (*once_init)(struct st_maria_share *, File); /* Called when the last instance of the table is closed */
my_bool (*once_end)(struct st_maria_share *); /* Is called for every open of the table */
my_bool (*init)(MARIA_HA *); /* Is called for every close of the table */ void (*end)(MARIA_HA *); /* Called when we want to read a record from a specific position */ int (*read_record)(MARIA_HA *, uchar *, MARIA_RECORD_POS); /* Initialize a scan */
my_bool (*scan_init)(MARIA_HA *); /* Read next record while scanning */ int (*scan)(MARIA_HA *, uchar *, MARIA_RECORD_POS, my_bool); /* End scan */ void (*scan_end)(MARIA_HA *); int (*scan_remember_pos)(MARIA_HA *, MARIA_RECORD_POS*); int (*scan_restore_pos)(MARIA_HA *, MARIA_RECORD_POS); /* Pre-write of row (some handlers may do the actual write here) */
MARIA_RECORD_POS (*write_record_init)(MARIA_HA *, const uchar *); /* Write record (or accept write_record_init) */
my_bool (*write_record)(MARIA_HA *, const uchar *); /* Called when write failed */
my_bool (*write_record_abort)(MARIA_HA *);
my_bool (*update_record)(MARIA_HA *, MARIA_RECORD_POS, const uchar *, const uchar *);
my_bool (*delete_record)(MARIA_HA *, const uchar *record);
my_bool (*compare_record)(MARIA_HA *, const uchar *); /* calculate checksum for a row */
ha_checksum(*calc_checksum)(MARIA_HA *, const uchar *); /* Calculatechecksumforarowduringwrite.Maybe0ifwecalculate thechecksuminwrite_record_init()
*/
ha_checksum(*calc_write_checksum)(MARIA_HA *, const uchar *); /* calculate checksum for a row during check table */
ha_checksum(*calc_check_checksum)(MARIA_HA *, const uchar *); /* Compare a row in memory with a row on disk */
my_bool (*compare_unique)(MARIA_HA *, MARIA_UNIQUEDEF *, const uchar *record, MARIA_RECORD_POS pos);
my_off_t (*keypos_to_recpos)(struct st_maria_share *share, my_off_t pos);
my_off_t (*recpos_to_keypos)(struct st_maria_share *share, my_off_t pos);
my_bool (*row_is_visible)(MARIA_HA *);
/* Mappings to read/write the data file */
size_t (*file_read)(MARIA_HA *, uchar *, size_t, my_off_t, myf);
size_t (*file_write)(MARIA_HA *, const uchar *, size_t, my_off_t, myf); /* query cache invalidator for merged tables */
invalidator_by_filename invalidator; /* query cache invalidator for changing state */
invalidator_by_filename chst_invalidator;
my_off_t key_del_current; /* delete links for index pages */
ulong this_process; /* processid */
ulong last_process; /* For table-change-check */
ulong last_version; /* Version on start */
ulong options; /* Options used */
ulong min_pack_length; /* These are used by packed data */
ulong max_pack_length;
ulong state_diff_length;
uint rec_reflength; /* rec_reflength in use now */ /* Extraflagtouseformy_malloc();settoMY_THREAD_SPECIFICfortemporary tableswhosememoryallocationshouldbeaccountedtothecurrentTHD.
*/
uint malloc_flag;
uint keypage_header;
uint32 ftkeys; /* Number of distinct full-text keys
+ 1 */
PAGECACHE_FILE kfile; /* Shared keyfile */
S3_INFO *s3_path; /* Connection and path in s3 */
File data_file; /* Shared data file */ int index_mode; /* mode on index file on open */ int data_mode; /* mode of data file on open */
uint reopen; /* How many times opened */
uint in_trans; /* Number of references by trn */
uint w_locks, r_locks, tot_locks; /* Number of read/write locks */
uint block_size; /* block_size of keyfile & data file*/
uint max_index_block_size; /* block_size - end_of_page_info */ /* Fixed length part of a packed row in BLOCK_RECORD format */
uint base_length;
myf write_flag; enum data_file_type data_file_type; enum pagecache_page_type page_type; /* value depending transactional */
/** ifCheckpointlookingattable;protectedbyclose_lockorTHR_LOCK_maria
*/
uint8 in_checkpoint;
my_bool temporary; /* Below flag is needed to make log tables work with concurrent insert */
my_bool is_log_table;
my_bool has_null_fields;
my_bool has_varchar_fields; /* If table has varchar fields */ /* Setto1ifopen_countwaswrongatopen.Settoavoidassertsfor wrongopencountonclose.
*/
my_bool open_count_not_zero_on_open;
my_bool changed, /* If changed since lock */
global_changed, /* If changed since open */
not_flushed;
my_bool no_status_updates; /* Set to 1 if S3 readonly table */
my_bool internal_table; /* Internal tmp table */
my_bool lock_key_trees; /* If we have to lock trees on read */
my_bool non_transactional_concurrent_insert;
my_bool delay_key_write;
my_bool have_rtree; /** @briefifthetableistransactionalrightnow.Itmayhavebeencreated transactional(base.born_transactional==TRUE)butwithtransactionality (logging)temporarilydisabled(now_transactional==FALSE).Theopposite (FALSE,TRUE)isimpossible.
*/
my_bool now_transactional;
my_bool have_versioning;
my_bool key_del_used; /* != 0 if key_del is locked */
my_bool deleting; /* we are going to delete this table */
my_bool redo_error_given; /* Used during recovery */
my_bool silence_encryption_errors; /* Used during recovery */
THR_LOCK lock; void (*lock_restore_status)(void *); /** Protectskfile,dfile,mostmembersofthestate,statediskwrites, versioninginformation(likein_trans,state_history). @todofindtheexhaustivelist.
*/
mysql_mutex_t intern_lock;
mysql_mutex_t key_del_lock;
mysql_cond_t key_del_cond; /** _Always_heldwhileclosingtable;preventscheckpointfromlookingat structuresfreedduringclosure(likebitmap).Ifyouneedclose_lockand intern_lock,locktheminthisorder.
*/
mysql_mutex_t close_lock;
my_off_t mmaped_length;
uint nonmmaped_inserts; /* counter of writing in
non-mmaped area */
MARIA_FILE_BITMAP bitmap;
mysql_rwlock_t mmap_lock;
LSN lsn_of_file_id; /**< LSN of its last LOGREC_FILE_ID */
typedefstruct st_maria_bitmap_block
{
pgcache_page_no_t page; /* Page number */ /* Number of continuous pages. TAIL_BIT is set if this is a tail page */
uint page_count;
uint empty_space; /* Set for head and tail pages */ /* NumberofBLOCKSforblock-region(holdsallnon-blob-fieldsoroneblob)
*/
uint sub_blocks; /* set to <> 0 in write_record() if this block was actually used */
uint8 used;
uint8 org_bitmap_value;
} MARIA_BITMAP_BLOCK;
typedefstruct st_maria_bitmap_blocks
{
MARIA_BITMAP_BLOCK *block;
uint count;
my_bool tail_page_skipped; /* If some tail pages was not used */
my_bool page_skipped; /* If some full pages was not used */
} MARIA_BITMAP_BLOCKS;
/* Data about the currently read row */ typedefstruct st_maria_row
{
MARIA_BITMAP_BLOCKS insert_blocks;
MARIA_BITMAP_BUFFER *extents;
MARIA_RECORD_POS lastpos, nextpos;
MARIA_RECORD_POS *tail_positions;
ha_checksum checksum;
LSN orig_undo_lsn; /* Lsn at start of row insert */
TrID trid; /* Transaction id for current row */
uchar *empty_bits, *field_lengths;
uint *null_field_lengths; /* All null field lengths */
ulong *blob_lengths; /* Length for each blob */
ulong min_length, normal_length, char_length, varchar_length;
ulong blob_length, total_length;
size_t extents_buffer_length; /* Size of 'extents' buffer */
uint head_length, header_length;
uint field_lengths_length; /* Length of data in field_lengths */
uint extents_count; /* number of extents in 'extents' */
uint full_page_count, tail_count; /* For maria_chk */
uint space_on_head_page;
} MARIA_ROW;
/* Data to scan row in blocked format */ typedefstruct st_maria_block_scan
{
uchar *bitmap_buff, *bitmap_pos, *bitmap_end, *page_buff;
uchar *dir, *dir_end;
pgcache_page_no_t bitmap_page, max_page;
ulonglong bits;
uint number_of_rows, bit_pos;
MARIA_RECORD_POS row_base_page;
ulonglong row_changes;
} MARIA_BLOCK_SCAN;
struct st_maria_handler
{
MARIA_SHARE *s; /* Shared between open:s */ struct st_ma_transaction *trn; /* Pointer to active transaction */ struct st_maria_handler *trn_next,**trn_prev;
MARIA_STATUS_INFO *state, state_save;
MARIA_STATUS_INFO *state_start; /* State at start of transaction */
MARIA_USED_TABLES *used_tables; struct ms3_st *s3; void **stack_end_ptr;
MARIA_ROW cur_row; /* The active row that we just read */
MARIA_ROW new_row; /* Storage for a row during update */
MARIA_KEY last_key; /* Last found key */
MARIA_BLOCK_SCAN scan, *scan_save;
MARIA_BLOB *blobs; /* Pointer to blobs */
MARIA_BIT_BUFF bit_buff;
DYNAMIC_ARRAY bitmap_blocks;
DYNAMIC_ARRAY pinned_pages; /* accumulate indexfile changes between write's */
TREE *bulk_insert;
LEX_CUSTRING *log_row_parts; /* For logging */
DYNAMIC_ARRAY *ft1_to_ft2; /* used only in ft1->ft2 conversion */
MEM_ROOT ft_memroot; /* used by the parser */
MYSQL_FTPARSER_PARAM *ftparser_param; /* share info between init/deinit */ void *external_ref; /* For MariaDB TABLE */
uchar *buff; /* page buffer */
uchar *keyread_buff; /* Buffer for last key read */
uchar *lastkey_buff; /* Last used search key */
uchar *lastkey_buff2;
uchar *first_mbr_key; /* Searhed spatial key */
uchar *rec_buff; /* Temp buffer for recordpack */
uchar *blob_buff; /* Temp buffer for blobs */
uchar *int_keypos; /* Save position for next/previous */
uchar *int_maxpos; /* -""- */
uint keypos_offset; /* Tmp storage for offset int_keypos */
uint maxpos_offset; /* Tmp storage for offset int_maxpos */
uchar *update_field_data; /* Used by update in rows-in-block */
uint int_nod_flag; /* -""- */
uint32 int_keytree_version; /* -""- */ int (*read_record)(MARIA_HA *, uchar*, MARIA_RECORD_POS);
invalidator_by_filename invalidator; /* query cache invalidator */
ulonglong last_auto_increment; /* auto value at start of statement */
ulonglong row_changes; /* Incremented for each change */
ulonglong start_row_changes; /* Row changes since start trans */
ulong this_unique; /* uniq filenumber or thread */
ulong last_unique; /* last unique number */
ulong this_loop; /* counter for this open */
ulong last_loop; /* last used counter */
MARIA_RECORD_POS save_lastpos;
MARIA_RECORD_POS dup_key_pos;
TrID dup_key_trid;
my_off_t pos; /* Intern variable */
my_off_t last_keypage; /* Last key page read */
my_off_t last_search_keypage; /* Last keypage when searching */
/* QQ:thefollowingtwoxxx_lengthfieldsshouldberemoved, astheyarenotcompatiblewithparallelrepair
*/
ulong packed_length, blob_length; /* Length of found, packed record */
size_t rec_buff_size, blob_buff_size;
PAGECACHE_FILE dfile; /* The datafile */
IO_CACHE rec_cache; /* When cacheing records */
LIST open_list;
LIST share_list;
MY_BITMAP changed_fields;
ulong row_base_length; /* Length of row header */
uint row_flag; /* Flag to store in row header */
uint opt_flag; /* Optim. for space/speed */
uint open_flags; /* Flags used in open() */
uint update; /* If file changed since open */
uint error_count; /* Incremented for each error given */ int lastinx; /* Last used index */
uint last_rkey_length; /* Last length in maria_rkey() */
uint *last_rtree_keypos; /* Last key positions for rtrees */
uint bulk_insert_ref_length; /* Length of row ref during bi */
uint non_flushable_state; enum ha_rkey_function last_key_func; /* CONTAIN, OVERLAP, etc */
uint save_lastkey_data_length;
uint save_lastkey_ref_length;
uint pack_key_length; /* For MARIA_MRG */
myf lock_wait; /* is 0 or MY_SHORT_WAIT */ int errkey; /* Got last error on this key */ int lock_type; /* How database was locked */ int tmp_lock_type; /* When locked by readinfo */
uint data_changed; /* Somebody has changed data */
uint save_update; /* When using KEY_READ */ int save_lastinx;
uint preload_buff_size; /* When preloading indexes */
uint16 last_used_keyseg; /* For MARIAMRG */
uint8 key_del_used; /* != 0 if key_del is used */
my_bool was_locked; /* Was locked in panic */
my_bool intern_lock_locked; /* locked in ma_extra() */
my_bool append_insert_at_end; /* Set if concurrent insert */
my_bool quick_mode;
my_bool in_check_table; /* We are running check tables */ /* Marker if key_del_changed */ /* If info->keyread_buff can't be used for rnext */
my_bool page_changed; /* If info->keyread_buff has to be re-read for rnext */
my_bool keyread_buff_used;
my_bool once_flags; /* For MARIA_MRG */ /* For bulk insert enable/disable transactions control */
my_bool switched_transactional; /* If transaction will autocommit */
my_bool autocommit;
my_bool has_cond_pushdown; #ifdef _WIN32
my_bool owned_by_merge; /* This Maria table is part of a merge union */ #endif
THR_LOCK_DATA lock;
uchar *maria_rtree_recursion_state; /* For RTREE */
uchar length_buff[5]; /* temp buff to store blob lengths */ int maria_rtree_recursion_depth;
my_bool create_unique_index_by_sort;
index_cond_func_t index_cond_func; /* Index condition function */ void *index_cond_func_arg; /* parameter for the func */
rowid_filter_func_t rowid_filter_func; /* rowid filter check function */ void *rowid_filter_func_arg; /* parameter for the func */
};
/* Table options for the Aria and S3 storage engine */
/* Some tuning parameters */ #define MARIA_MIN_KEYBLOCK_LENGTH 50/* When to split delete blocks */ #define MARIA_MIN_SIZE_BULK_INSERT_TREE 16384U /* this is per key */ #define MARIA_MIN_ROWS_TO_USE_BULK_INSERT 100 #define MARIA_MIN_ROWS_TO_DISABLE_INDEXES 100 #define MARIA_MIN_ROWS_TO_USE_WRITE_CACHE 10 /* Keep a small buffer for tables only using small blobs */ #define MARIA_SMALL_BLOB_BUFFER 1024U #define MARIA_MAX_CONTROL_FILE_LOCK_RETRY 30/* Retry this many times */
/* Note that PSI_stage_info globals must always be declared. */ extern PSI_stage_info stage_waiting_for_a_resource;
/* This is used by _ma_calc_xxx_key_length och _ma_store_key */ typedefstruct st_maria_s_param
{ const uchar *key;
uchar *prev_key, *next_key_pos;
uchar *key_pos; /* For balance page */
uint ref_length, key_length, n_ref_length;
uint n_length, totlength, part_of_prev_key, prev_length, pack_marker;
uint changed_length; int move_length; /* For balance_page */
my_bool store_not_null;
} MARIA_KEY_PARAM;
/* Used to store reference to pinned page */ typedefstruct st_pinned_page
{
PAGECACHE_BLOCK_LINK *link; enum pagecache_page_lock unlock, write_lock;
my_bool changed;
} MARIA_PINNED_PAGE;
/* Keeps all information about a page and related to a page */ typedefstruct st_maria_page
{
MARIA_HA *info; const MARIA_KEYDEF *keyinfo;
uchar *buff; /* Data for page */
my_off_t pos; /* Disk address to page */
uint size; /* Size of data on page */
uint org_size; /* Size of page at read or after log */
uint node; /* 0 or share->base.key_reflength */
uint flag; /* Page flag */
uint link_offset;
} MARIA_PAGE;
/* We use MY_ALIGN_DOWN here mainly to ensure that we get stable values for mysqld --help ) */ #define PAGE_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*256L-MALLOC_OVERHEAD, 8192) #define READ_BUFFER_INIT MY_ALIGN_DOWN(1024L*256L-MALLOC_OVERHEAD, 1024) #define SORT_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*256L-MALLOC_OVERHEAD, 1024)
int _ma_flush_pending_blocks(MARIA_SORT_PARAM *param); int _ma_sort_ft_buf_flush(MARIA_SORT_PARAM *sort_param); int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param);
pthread_handler_t _ma_thr_find_all_keys(void *arg);
int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param); int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
size_t); int _ma_sync_table_files(const MARIA_HA *info); int _ma_initialize_data_file(MARIA_SHARE *share, File dfile); int _ma_update_state_lsns(MARIA_SHARE *share,
LSN lsn, TrID create_trid, my_bool do_sync,
my_bool update_create_rename_lsn); int _ma_update_state_lsns_sub(MARIA_SHARE *share, LSN lsn,
TrID create_trid, my_bool do_sync,
my_bool update_create_rename_lsn); void _ma_set_data_pagecache_callbacks(PAGECACHE_FILE *file,
MARIA_SHARE *share); void _ma_set_index_pagecache_callbacks(PAGECACHE_FILE *file,
MARIA_SHARE *share); void _ma_tmp_disable_logging_for_table(MARIA_HA *info,
my_bool log_incomplete);
my_bool _ma_reenable_logging_for_table(MARIA_HA *info, my_bool flush_pages);
my_bool write_log_record_for_bulk_insert(MARIA_HA *info); void _ma_unpin_all_pages(MARIA_HA *info, LSN undo_lsn);
¤ 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.0.96Bemerkung:
(vorverarbeitet am 2026-10-08)
¤
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.