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:

  1. TableRecordFormat - Used to pass [partial] table records to/from storage engine

  2. 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). It could be that it is required that null bits of non-present columns are set to 1

VARIOUS EXCEPTIONS AND SPECIAL CASES

If the table has no nullable columns, then null_bytes is still present, its length is one byte which must be set to 0xFF at all times.

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_share: *mut TABLE_SHARE§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.

§ha_share: *mut *mut Handler_share

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

Implementations§

source§

impl handler

source

pub unsafe fn set_handler_stats(&mut self)

source

pub unsafe fn start_psi_batch_mode(&mut self)

source

pub unsafe fn end_psi_batch_mode(&mut self)

source

pub unsafe fn ha_open( &mut self, table: *mut TABLE, name: *const c_char, mode: c_int, test_if_locked: uint, mem_root: *mut MEM_ROOT, partitions_to_open: *mut List ) -> c_int

source

pub unsafe fn ha_rnd_init_with_error(&mut self, scan: bool) -> c_int

source

pub unsafe fn ha_reset(&mut self) -> c_int

source

pub unsafe fn ha_external_lock( &mut self, thd: *mut THD, lock_type: c_int ) -> c_int

source

pub unsafe fn ha_write_row(&mut self, buf: *const uchar) -> c_int

source

pub unsafe fn ha_update_row( &mut self, old_data: *const uchar, new_data: *const uchar ) -> c_int

source

pub unsafe fn ha_delete_row(&mut self, buf: *const uchar) -> c_int

source

pub unsafe fn ha_release_auto_increment(&mut self)

source

pub unsafe fn is_root_handler(&self) -> bool

source

pub unsafe fn check_collation_compatibility(&mut self) -> c_int

source

pub unsafe fn check_long_hash_compatibility(&self) -> c_int

source

pub unsafe fn ha_check_for_upgrade( &mut self, check_opt: *mut HA_CHECK_OPT ) -> c_int

source

pub unsafe fn ha_check( &mut self, thd: *mut THD, check_opt: *mut HA_CHECK_OPT ) -> c_int

source

pub unsafe fn ha_repair( &mut self, thd: *mut THD, check_opt: *mut HA_CHECK_OPT ) -> c_int

source

pub unsafe fn ha_end_bulk_insert(&mut self) -> c_int

source

pub unsafe fn ha_bulk_update_row( &mut self, old_data: *const uchar, new_data: *const uchar, dup_key_found: *mut ha_rows ) -> c_int

source

pub unsafe fn ha_delete_all_rows(&mut self) -> c_int

source

pub unsafe fn ha_truncate(&mut self) -> c_int

source

pub unsafe fn ha_reset_auto_increment(&mut self, value: ulonglong) -> c_int

source

pub unsafe fn ha_optimize( &mut self, thd: *mut THD, check_opt: *mut HA_CHECK_OPT ) -> c_int

source

pub unsafe fn ha_analyze( &mut self, thd: *mut THD, check_opt: *mut HA_CHECK_OPT ) -> c_int

source

pub unsafe fn ha_check_and_repair(&mut self, thd: *mut THD) -> bool

source

pub unsafe fn ha_disable_indexes(&mut self, mode: uint) -> c_int

source

pub unsafe fn ha_enable_indexes(&mut self, mode: uint) -> c_int

source

pub unsafe fn ha_discard_or_import_tablespace( &mut self, discard: my_bool ) -> c_int

source

pub unsafe fn ha_rename_table( &mut self, from: *const c_char, to: *const c_char ) -> c_int

source

pub unsafe fn ha_drop_table(&mut self, name: *const c_char)

source

pub unsafe fn ha_create( &mut self, name: *const c_char, form: *mut TABLE, info: *mut HA_CREATE_INFO ) -> c_int

source

pub unsafe fn ha_create_partitioning_metadata( &mut self, name: *const c_char, old_name: *const c_char, action_flag: Type ) -> c_int

source

pub unsafe fn ha_change_partitions( &mut self, create_info: *mut HA_CREATE_INFO, path: *const c_char, copied: *mut ulonglong, deleted: *mut ulonglong, pack_frm_data: *const uchar, pack_frm_len: usize ) -> c_int

source

pub unsafe fn ha_drop_partitions(&mut self, path: *const c_char) -> c_int

source

pub unsafe fn ha_rename_partitions(&mut self, path: *const c_char) -> c_int

source

pub unsafe fn adjust_next_insert_id_after_explicit_value( &mut self, nr: ulonglong )

source

pub unsafe fn update_auto_increment(&mut self) -> c_int

source

pub unsafe fn get_dup_key(&mut self, error: c_int) -> uint

source

pub unsafe fn ha_keyread_time( &mut self, index: uint, ranges: ulong, rows: ha_rows, blocks: ulonglong ) -> IO_AND_CPU_COST

source

pub unsafe fn ha_keyread_clustered_time( &mut self, index: uint, ranges: ulong, rows: ha_rows, blocks: ulonglong ) -> IO_AND_CPU_COST

source

pub unsafe fn ha_close(&mut self) -> c_int

source

pub unsafe fn ha_index_read_map( &mut self, buf: *mut uchar, key: *const uchar, keypart_map: key_part_map, find_flag: Type ) -> c_int

source

pub unsafe fn ha_index_read_idx_map( &mut self, buf: *mut uchar, index: uint, key: *const uchar, keypart_map: key_part_map, find_flag: Type ) -> c_int

source

pub unsafe fn ha_index_next(&mut self, buf: *mut uchar) -> c_int

source

pub unsafe fn ha_index_prev(&mut self, buf: *mut uchar) -> c_int

source

pub unsafe fn ha_index_first(&mut self, buf: *mut uchar) -> c_int

source

pub unsafe fn ha_index_last(&mut self, buf: *mut uchar) -> c_int

source

pub unsafe fn ha_index_next_same( &mut self, buf: *mut uchar, key: *const uchar, keylen: uint ) -> c_int

source

pub unsafe fn set_end_range(&mut self, end_key: *const key_range)

source

pub unsafe fn compare_key(&mut self, range: *mut key_range) -> c_int

source

pub unsafe fn compare_key2(&self, range: *mut key_range) -> c_int

source

pub unsafe fn ha_rnd_next(&mut self, buf: *mut uchar) -> c_int

source

pub unsafe fn ha_rnd_pos(&mut self, buf: *mut uchar, pos: *mut uchar) -> c_int

source

pub unsafe fn ha_was_semi_consistent_read(&mut self) -> bool

source

pub unsafe fn check_old_types(&mut self) -> c_int

source

pub unsafe fn update_global_table_stats(&mut self)

source

pub unsafe fn update_global_index_stats(&mut self)

source

pub unsafe fn ha_prepare_inplace_alter_table( &mut self, altered_table: *mut TABLE, ha_alter_info: *mut Alter_inplace_info ) -> bool

source

pub unsafe fn ha_commit_inplace_alter_table( &mut self, altered_table: *mut TABLE, ha_alter_info: *mut Alter_inplace_info, commit: bool ) -> bool

source

pub unsafe fn ha_thd(&self) -> *mut THD

source

pub unsafe fn ha_table_share_psi(&self) -> *mut PSI_table_share

source

pub unsafe fn check_table_binlog_row_based(&mut self) -> bool

source

pub unsafe fn prepare_for_row_logging(&mut self) -> bool

source

pub unsafe fn prepare_for_insert(&mut self, do_create: bool) -> c_int

source

pub unsafe fn binlog_log_row( &mut self, before_record: *const uchar, after_record: *const uchar, log_func: Log_func ) -> c_int

source

pub unsafe fn ha_direct_update_rows( &mut self, update_rows: *mut ha_rows, found_rows: *mut ha_rows ) -> c_int

source

pub unsafe fn ha_direct_delete_rows( &mut self, delete_rows: *mut ha_rows ) -> c_int

source

pub unsafe fn get_canonical_filename( &self, path: *const Lex_cstring, tmp_path: *mut Table_path_buffer ) -> Lex_cstring

source

pub unsafe fn log_not_redoable_operation( &mut self, operation: *const c_char ) -> bool

source

pub unsafe fn get_ha_share_ptr(&mut self) -> *mut Handler_share

source

pub unsafe fn set_ha_share_ptr(&mut self, arg_ha_share: *mut Handler_share)

source

pub unsafe fn lock_shared_ha_data(&mut self)

source

pub unsafe fn unlock_shared_ha_data(&mut self)

Trait Implementations§

source§

impl Debug for handler

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for handler

§

impl !Send for handler

§

impl !Sync for handler

§

impl Unpin for handler

§

impl !UnwindSafe for handler

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.