Struct mariadb_sys::handler
source · #[repr(C)]pub struct handler {Show 70 fields
pub vtable_: *const handler__bindgen_vtable,
pub table_share: *mut TABLE_SHARE,
pub table: *mut TABLE,
pub cached_table_flags: handler_Table_flags,
pub estimation_rows_to_insert: ha_rows,
pub lookup_handler: *mut handler,
pub active_handler_stats: ha_handler_stats,
pub ht: *mut handlerton,
pub costs: *mut OPTIMIZER_COSTS,
pub ref_: *mut uchar,
pub dup_ref: *mut uchar,
pub lookup_buffer: *mut uchar,
pub stats: ha_statistics,
pub handler_stats: *mut ha_handler_stats,
pub mrr_iter: range_seq_t,
pub mrr_funcs: RANGE_SEQ_IF,
pub multi_range_buffer: *mut HANDLER_BUFFER,
pub ranges_in_seq: uint,
pub mrr_cur_range: KEY_MULTI_RANGE,
pub save_end_range: key_range,
pub end_range: *mut key_range,
pub range_key_part: *mut KEY_PART_INFO,
pub key_compare_result_on_equal: c_int,
pub mrr_is_output_sorted: bool,
pub mrr_have_range: bool,
pub eq_range: bool,
pub internal_tmp_table: bool,
pub implicit_emptied: bool,
pub mark_trx_read_write_done: bool,
pub check_table_binlog_row_based_done: bool,
pub check_table_binlog_row_based_result: bool,
pub in_range_check_pushed_down: bool,
pub lookup_errkey: uint,
pub errkey: uint,
pub key_used_on_scan: uint,
pub active_index: uint,
pub keyread: uint,
pub ref_length: uint,
pub ft_handler: *mut FT_INFO,
pub inited: Type,
pub pre_inited: Type,
pub pushed_cond: *const COND,
pub next_insert_id: ulonglong,
pub insert_id_for_cur_row: ulonglong,
pub rows_read: ulonglong,
pub rows_tmp_read: ulonglong,
pub rows_changed: ulonglong,
pub index_rows_read: [ulonglong; 65],
pub copy_info: ha_copy_info,
pub tracker: *mut Exec_time_tracker,
pub pushed_idx_cond: *mut Item,
pub pushed_idx_cond_keyno: uint,
pub pushed_rowid_filter: *mut Rowid_filter,
pub rowid_filter_is_active: bool,
pub save_pushed_rowid_filter: *mut Rowid_filter,
pub save_rowid_filter_is_active: bool,
pub auto_inc_interval_for_cur_row: Discrete_interval,
pub auto_inc_intervals_count: uint,
pub m_psi: *mut PSI_table,
pub m_psi_batch_mode: Type,
pub m_psi_numrows: ulonglong,
pub m_psi_locker: *mut PSI_table_locker,
pub m_psi_locker_state: PSI_table_locker_state,
pub row_logging: bool,
pub row_logging_init: bool,
pub row_logging_has_trans: bool,
pub m_lock_type: c_int,
pub ha_share: *mut *mut Handler_share,
pub optimizer_where_cost: f64,
pub optimizer_scan_setup_cost: f64,
}
Expand description
The handler class is the interface for dynamically loadable storage engines. Do not add ifdefs and take care when adding or changing virtual functions to avoid vtable confusion
Functions in this class accept and return table columns data. Two data representation formats are used:
-
TableRecordFormat - Used to pass [partial] table records to/from storage engine
-
KeyTupleFormat - used to pass index search tuples (aka “keys”) to storage engine. See opt_range.cc for description of this format.
§TableRecordFormat
[Warning: this description is work in progress and may be incomplete] The table record is stored in a fixed-size buffer:
record: null_bytes, column1_data, column2_data, …
The offsets of the parts of the buffer are also fixed: every column has an offset to its column{i}_data, and if it is nullable it also has its own bit in null_bytes.
The record buffer only includes data about columns that are marked in the
relevant column set (table->read_set and/or table->write_set, depending on
the situation).
VARIOUS EXCEPTIONS AND SPECIAL CASES
If the table has no nullable columns, then null_bytes is still
present, its length is one byte
If the table has columns of type BIT, then certain bits from those columns may be stored in null_bytes as well. Grep around for Field_bit for details.
For blob columns (see Field_blob), the record buffer stores length of the data, following by memory pointer to the blob data. The pointer is owned by the storage engine and is valid until the next operation.
If a blob column has NULL value, then its length and blob data pointer must be set to 0.
Fields§
§vtable_: *const handler__bindgen_vtable
§table: *mut TABLE
§cached_table_flags: handler_Table_flags
§estimation_rows_to_insert: ha_rows
§lookup_handler: *mut handler
§active_handler_stats: ha_handler_stats
§ht: *mut handlerton
§costs: *mut OPTIMIZER_COSTS
§ref_: *mut uchar
§dup_ref: *mut uchar
§lookup_buffer: *mut uchar
§stats: ha_statistics
§handler_stats: *mut ha_handler_stats
§mrr_iter: range_seq_t
MultiRangeRead-related members:
mrr_funcs: RANGE_SEQ_IF
§multi_range_buffer: *mut HANDLER_BUFFER
§ranges_in_seq: uint
§mrr_cur_range: KEY_MULTI_RANGE
Current range (the one we’re now returning rows from)
save_end_range: key_range
The following are for read_range()
end_range: *mut key_range
The following are for read_range()
range_key_part: *mut KEY_PART_INFO
§key_compare_result_on_equal: c_int
§mrr_is_output_sorted: bool
§mrr_have_range: bool
TRUE <=> we’re currently traversing a range in mrr_cur_range.
eq_range: bool
§internal_tmp_table: bool
§implicit_emptied: bool
§mark_trx_read_write_done: bool
§check_table_binlog_row_based_done: bool
§check_table_binlog_row_based_result: bool
§in_range_check_pushed_down: bool
§lookup_errkey: uint
§errkey: uint
§key_used_on_scan: uint
§active_index: uint
§keyread: uint
§ref_length: uint
Length of ref (1-8 or the clustered key length)
ft_handler: *mut FT_INFO
§inited: Type
§pre_inited: Type
§pushed_cond: *const COND
§next_insert_id: ulonglong
next_insert_id is the next value which should be inserted into the auto_increment column: in a inserting-multi-row statement (like INSERT SELECT), for the first row where the autoinc value is not specified by the statement, get_auto_increment() called and asked to generate a value, next_insert_id is set to the next value, then for all other rows next_insert_id is used (and increased each time) without calling get_auto_increment().
insert_id_for_cur_row: ulonglong
insert id for the current row (autogenerated; if not autogenerated, it’s 0). At first successful insertion, this variable is stored into THD::first_successful_insert_id_in_cur_stmt.
rows_read: ulonglong
Interval returned by get_auto_increment() and being consumed by the inserter.
rows_tmp_read: ulonglong
§rows_changed: ulonglong
§index_rows_read: [ulonglong; 65]
§copy_info: ha_copy_info
§tracker: *mut Exec_time_tracker
§pushed_idx_cond: *mut Item
§pushed_idx_cond_keyno: uint
§pushed_rowid_filter: *mut Rowid_filter
§rowid_filter_is_active: bool
§save_pushed_rowid_filter: *mut Rowid_filter
§save_rowid_filter_is_active: bool
§auto_inc_interval_for_cur_row: Discrete_interval
§auto_inc_intervals_count: uint
Number of reserved auto-increment intervals. Serves as a heuristic when we have no estimation of how many records the statement will insert: the more intervals we have reserved, the bigger the next one. Reset in handler::ha_release_auto_increment().
m_psi: *mut PSI_table
Instrumented table associated with this handler. This member should be set to NULL when no instrumentation is in place, so that linking an instrumented/non instrumented server/plugin works. For example:
- the server is compiled with the instrumentation. The server expects either NULL or valid pointers in m_psi.
- an engine plugin is compiled without instrumentation. The plugin can not leave this pointer uninitialized, or can not leave a trash value on purpose in this pointer, as this would crash the server.
m_psi_batch_mode: Type
Batch mode state. @sa start_psi_batch_mode. @sa end_psi_batch_mode.
m_psi_numrows: ulonglong
The number of rows in the batch. @sa start_psi_batch_mode. @sa end_psi_batch_mode.
m_psi_locker: *mut PSI_table_locker
The current event in a batch. @sa start_psi_batch_mode. @sa end_psi_batch_mode.
m_psi_locker_state: PSI_table_locker_state
Storage for the event in a batch. @sa start_psi_batch_mode. @sa end_psi_batch_mode.
row_logging: bool
§row_logging_init: bool
§row_logging_has_trans: bool
§m_lock_type: c_int
The lock type set by when calling::ha_external_lock(). This is propagated down to the storage engine. The reason for also storing it here, is that when doing MRR we need to create/clone a second handler object. This cloned handler object needs to know about the lock_type used.
Pointer where to store/retrieve the Handler_share pointer. For non partitioned handlers this is &TABLE_SHARE::ha_share.
optimizer_where_cost: f64
§optimizer_scan_setup_cost: f64