drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
WiredTigerCursor Class Reference
Inheritance diagram for WiredTigerCursor:
[legend]
Collaboration diagram for WiredTigerCursor:
[legend]

Public Member Functions

 WiredTigerCursor (drizzled::plugin::StorageEngine &engine, drizzled::Table &table)
Cursor * clone (drizzled::memory::Root *mem_root)
const char * index_type (uint32_t inx)
double scan_time ()
double read_time (uint32_t, uint32_t, drizzled::ha_rows rows)
int doOpen (const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked)
int close (void)
void set_keys_for_scanning (void)
int doInsertRecord (unsigned char *buf)
int doUpdateRecord (const unsigned char *old_data, unsigned char *new_data)
int doDeleteRecord (const unsigned char *buf)
virtual void get_auto_increment (uint64_t offset, uint64_t increment, uint64_t nb_desired_values, uint64_t *first_value, uint64_t *nb_reserved_values)
int index_read (unsigned char *buf, const unsigned char *key_ptr, uint32_t key_len, drizzled::ha_rkey_function find_flag)
int index_next (unsigned char *buf)
int index_prev (unsigned char *buf)
int index_first (unsigned char *buf)
int index_last (unsigned char *buf)
int doStartTableScan (bool scan)
int rnd_next (unsigned char *buf)
int rnd_pos (unsigned char *buf, unsigned char *pos)
void position (const unsigned char *record)
int info (uint)
int extra (enum drizzled::ha_extra_function operation)
int reset ()
int delete_all_rows (void)
int disable_indexes (uint32_t mode)
int enable_indexes (uint32_t mode)
int indexes_are_disabled (void)
int doStartIndexScan (uint32_t idx, bool)
int doEndIndexScan ()
drizzled::ha_rows records_in_range (uint32_t inx, drizzled::key_range *min_key, drizzled::key_range *max_key)
void drop_table ()
int cmp_ref (const unsigned char *ref1, const unsigned char *ref2)
int reset_auto_increment (uint64_t value)
THR_LOCK_DATA ** store_lock (Session *, THR_LOCK_DATA **, thr_lock_type)
uint64_t getInitialAutoIncrementValue ()
Public Member Functions inherited from drizzled::Cursor
plugin::StorageEngine * getEngine () const
TableShare * getShare ()
Table * getTable () const
uint64_t getNextInsertId () const
uint64_t getAutoIncrement () const
 Cursor (plugin::StorageEngine &engine_arg, Table &share_arg)
int ha_open (const identifier::Table &identifier, int mode, int test_if_locked)
int startIndexScan (uint32_t idx, bool sorted) __attribute__((warn_unused_result))
int endIndexScan ()
int startTableScan (bool scan) __attribute__((warn_unused_result))
int endTableScan ()
int ha_reset ()
int ha_index_or_rnd_end ()
int ha_external_lock (Session *session, int lock_type)
int insertRecord (unsigned char *buf) __attribute__((warn_unused_result))
int updateRecord (const unsigned char *old_data, unsigned char *new_data) __attribute__((warn_unused_result))
int deleteRecord (const unsigned char *buf) __attribute__((warn_unused_result))
void ha_release_auto_increment ()
int ha_check (Session *)
void ha_start_bulk_insert (ha_rows rows)
int ha_end_bulk_insert ()
int ha_delete_all_rows ()
int ha_reset_auto_increment (uint64_t value)
int ha_analyze (Session *)
int ha_disable_indexes (uint32_t mode)
int ha_enable_indexes (uint32_t mode)
int ha_discard_or_import_tablespace (bool discard)
void closeMarkForDelete ()
void adjust_next_insert_id_after_explicit_value (uint64_t nr)
int update_auto_increment ()
virtual double index_only_read_time (uint32_t keynr, double records)
virtual ha_rows multi_range_read_info_const (uint32_t keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint32_t n_ranges, uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost)
virtual int multi_range_read_info (uint32_t keyno, uint32_t n_ranges, uint32_t keys, uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost)
virtual int multi_range_read_init (RANGE_SEQ_IF *seq, void *seq_init_param, uint32_t n_ranges, uint32_t mode)
virtual int multi_range_read_next (char **range_info)
virtual const key_map * keys_to_use_for_scanning ()
bool has_transactions ()
virtual bool is_fatal_error (int error, uint32_t flags)
virtual ha_rows records ()
virtual uint64_t tableSize ()
virtual uint64_t rowSize ()
virtual ha_rows estimate_rows_upper_bound ()
uint32_t get_index (void) const
virtual int index_read_map (unsigned char *buf, const unsigned char *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
 Positions an index cursor to the index specified in the handle. Fetches the row if available. If the key value is null, begin at the first key of the index.
virtual int index_read_idx_map (unsigned char *buf, uint32_t index, const unsigned char *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
 Positions an index cursor to the index specified in the handle. Fetches the row if available. If the key value is null, begin at the first key of the index.
virtual int index_next_same (unsigned char *, const unsigned char *, uint32_t)
virtual int index_read_last_map (unsigned char *buf, const unsigned char *key, key_part_map keypart_map)
 The following functions works like index_read, but it find the last row with the current key value or prefix.
virtual int read_range_first (const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted)
virtual int read_range_next ()
int compare_key (key_range *range)
virtual int read_first_row (unsigned char *buf, uint32_t primary_key)
virtual int rnd_same (unsigned char *, uint32_t)
virtual int info (uint32_t)=0
virtual uint32_t calculate_key_hash_value (Field **)
virtual int extra_opt (enum ha_extra_function operation, uint32_t)
virtual bool was_semi_consistent_read ()
virtual void try_semi_consistent_read (bool)
virtual void unlock_row (void)
void set_next_insert_id (uint64_t id)
void restore_auto_increment (uint64_t prev_insert_id)
virtual void append_create_info (String *)
virtual char * get_foreign_key_create_info (void)
virtual bool can_switch_engines (void)
virtual int get_foreign_key_list (Session *, List< ForeignKeyInfo > *)
virtual uint32_t referenced_by_foreign_key ()
virtual void free_foreign_key_create_info (char *)
virtual bool primary_key_is_clustered ()
virtual bool isOrdered (void)

Public Attributes

drizzled::THR_LOCK_DATA lock
Public Attributes inherited from drizzled::Cursor
unsigned char * ref
unsigned char * dup_ref
ha_statistics stats
range_seq_t mrr_iter
RANGE_SEQ_IF mrr_funcs
uint32_t ranges_in_seq
bool mrr_is_output_sorted
bool mrr_have_range
bool eq_range
KEY_MULTI_RANGE mrr_cur_range
key_range save_end_range
key_range * end_range
KeyPartInfo * range_key_part
int key_compare_result_on_equal
uint32_t errkey
uint32_t key_used_on_scan
uint32_t active_index
uint32_t ref_length
enum drizzled::Cursor:: { ... }  inited
bool locked
uint64_t next_insert_id
uint64_t insert_id_for_cur_row
Discrete_interval auto_inc_interval_for_cur_row

Private Member Functions

int wt_pack_from_index_buf (WT_ITEM *kBuf, const drizzled::KeyInfo *key_info, const unsigned char *key_ptr, uint32_t key_len)
void reopen_cursor_if_needed ()
int open_table_cursor ()
int packField (Field *, WT_PACK_STREAM *, ptrdiff_t)
int packIndex (const char *, WT_ITEM *, key_range *, KeyInfo *)
int packRecord (WT_ITEM *, WT_ITEM *, const unsigned char *)
int recordPacker (WT_PACK_STREAM *, WT_PACK_STREAM *, unsigned char *, size_t *, size_t *, bool)
int unpackRecord (WT_ITEM *, WT_ITEM *, unsigned char *)
int unpackField (Field *, WT_PACK_STREAM *, ptrdiff_t)
int setupKeyFields (uint32_t, bool)
int setupTableURI (const drizzled::identifier::Table &)
void update_key_stats ()
WiredTigerTableShare * get_share (const identifier::Table &)
int free_share ()

Static Private Member Functions

static int getFieldEncoding (Field *field, char *const type)

Private Attributes

uint32_t records_changed
uint32_t key_stat_version
bool internal_table
WT_SESSION * wt_session
WT_CURSOR * wt_cursor
WT_ITEM key_buf
WT_ITEM value_buf
WT_ITEM null_buf
std::vector< int32_t > * key_fields
std::vector< int32_t > * index_key_fields
std::vector< int32_t > * index_value_fields
string table_uri
WiredTigerTableShare * share
uint32_t opt_flag

Additional Inherited Members

Public Types inherited from drizzled::Cursor
enum  { NONE =0 , INDEX , RND }
Protected Member Functions inherited from drizzled::Cursor
void ha_statistic_increment (uint64_t system_status_var::*offset) const
void ** ha_data (Session *) const
Protected Attributes inherited from drizzled::Cursor
ha_rows estimation_rows_to_insert

Detailed Description

Definition at line 174 of file wiredtiger_drizzle.h.

Constructor & Destructor Documentation

◆ WiredTigerCursor()

WiredTigerCursor::WiredTigerCursor ( drizzled::plugin::StorageEngine & engine,
drizzled::Table & table )

Definition at line 28 of file wiredtiger_cursor.cc.

◆ ~WiredTigerCursor()

WiredTigerCursor::~WiredTigerCursor ( )
inline

Definition at line 182 of file wiredtiger_drizzle.h.

Member Function Documentation

◆ clone()

Cursor * WiredTigerCursor::clone ( drizzled::memory::Root * mem_root)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 236 of file wiredtiger_cursor.cc.

◆ close()

int WiredTigerCursor::close ( void )
virtual

Implements drizzled::Cursor.

Definition at line 196 of file wiredtiger_cursor.cc.

◆ cmp_ref()

int WiredTigerCursor::cmp_ref ( const unsigned char * ref1,
const unsigned char * ref2 )
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1762 of file wiredtiger_cursor.cc.

◆ delete_all_rows()

int WiredTigerCursor::delete_all_rows ( void )
virtual

This is called to delete all rows in a table If the Cursor don't support this, then this function will return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one by one.

Reimplemented from drizzled::Cursor.

Definition at line 1494 of file wiredtiger_cursor.cc.

◆ disable_indexes()

int WiredTigerCursor::disable_indexes ( uint32_t mode)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1576 of file wiredtiger_cursor.cc.

◆ doDeleteRecord()

int WiredTigerCursor::doDeleteRecord ( const unsigned char * buf)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 967 of file wiredtiger_cursor.cc.

◆ doEndIndexScan()

int WiredTigerCursor::doEndIndexScan ( void )
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1068 of file wiredtiger_cursor.cc.

◆ doInsertRecord()

int WiredTigerCursor::doInsertRecord ( unsigned char * buf)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 902 of file wiredtiger_cursor.cc.

◆ doOpen()

int WiredTigerCursor::doOpen ( const drizzled::identifier::Table & identifier,
int mode,
uint32_t test_if_locked )
virtual

Reimplemented from drizzled::Cursor.

Definition at line 165 of file wiredtiger_cursor.cc.

◆ doStartIndexScan()

int WiredTigerCursor::doStartIndexScan ( uint32_t idx,
bool  )
virtual

field);

Reimplemented from drizzled::Cursor.

Definition at line 976 of file wiredtiger_cursor.cc.

◆ doStartTableScan()

int WiredTigerCursor::doStartTableScan ( bool scan)
virtual

doStartTableScan() can be called two times without doEndTableScan() in between (it only makes sense if scan=1). then the second call should prepare for the new table scan (e.g if rnd_init allocates the cursor, second call should position it to the start of the table, no need to deallocate and allocate it again

Implements drizzled::Cursor.

Definition at line 1296 of file wiredtiger_cursor.cc.

◆ doUpdateRecord()

int WiredTigerCursor::doUpdateRecord ( const unsigned char * old_data,
unsigned char * new_data )
virtual

Reimplemented from drizzled::Cursor.

Definition at line 949 of file wiredtiger_cursor.cc.

◆ drop_table()

void WiredTigerCursor::drop_table ( )
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1672 of file wiredtiger_cursor.cc.

◆ enable_indexes()

int WiredTigerCursor::enable_indexes ( uint32_t mode)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1629 of file wiredtiger_cursor.cc.

◆ extra()

int WiredTigerCursor::extra ( enum drizzled::ha_extra_function operation)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1455 of file wiredtiger_cursor.cc.

◆ free_share()

int WiredTigerCursor::free_share ( )
private

Definition at line 281 of file wiredtiger_cursor.cc.

◆ get_auto_increment()

void WiredTigerCursor::get_auto_increment ( uint64_t offset,
uint64_t increment,
uint64_t nb_desired_values,
uint64_t * first_value,
uint64_t * nb_reserved_values )
virtual

Implements drizzled::Cursor.

Definition at line 1743 of file wiredtiger_cursor.cc.

◆ get_share()

WiredTigerTableShare * WiredTigerCursor::get_share ( const identifier::Table & identifier)
private

Definition at line 255 of file wiredtiger_cursor.cc.

◆ getFieldEncoding()

int WiredTigerCursor::getFieldEncoding ( Field * field,
char *const type )
staticprivate

Definition at line 612 of file wiredtiger_cursor.cc.

◆ getInitialAutoIncrementValue()

uint64_t WiredTigerCursor::getInitialAutoIncrementValue ( )

Definition at line 1777 of file wiredtiger_cursor.cc.

◆ index_first()

int WiredTigerCursor::index_first ( unsigned char * buf)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1282 of file wiredtiger_cursor.cc.

◆ index_last()

int WiredTigerCursor::index_last ( unsigned char * buf)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1289 of file wiredtiger_cursor.cc.

◆ index_next()

int WiredTigerCursor::index_next ( unsigned char * buf)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1258 of file wiredtiger_cursor.cc.

◆ index_prev()

int WiredTigerCursor::index_prev ( unsigned char * buf)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1264 of file wiredtiger_cursor.cc.

◆ index_read()

int WiredTigerCursor::index_read ( unsigned char * buf,
const unsigned char * key_ptr,
uint32_t key_len,
drizzled::ha_rkey_function find_flag )

Definition at line 1211 of file wiredtiger_cursor.cc.

◆ index_type()

const char * WiredTigerCursor::index_type ( uint32_t inx)
virtual

Reimplemented from drizzled::Cursor.

Definition at line 250 of file wiredtiger_cursor.cc.

◆ indexes_are_disabled()

int WiredTigerCursor::indexes_are_disabled ( void )
virtual

Reimplemented from drizzled::Cursor.

Definition at line 1666 of file wiredtiger_cursor.cc.

◆ info()

int WiredTigerCursor::info ( uint )

Definition at line 1361 of file wiredtiger_cursor.cc.

◆ open_table_cursor()

int WiredTigerCursor::open_table_cursor ( )
private

Definition at line 49 of file wiredtiger_cursor.cc.

◆ packField()

int WiredTigerCursor::packField ( Field * field,
WT_PACK_STREAM * packer,
ptrdiff_t row_offset )
private

Definition at line 650 of file wiredtiger_cursor.cc.

◆ packIndex()

int WiredTigerCursor::packIndex ( const char * format,
WT_ITEM * buf,
key_range * data,
KeyInfo * keyInfo )
private

Definition at line 438 of file wiredtiger_cursor.cc.

◆ packRecord()

int WiredTigerCursor::packRecord ( WT_ITEM * kBuf,
WT_ITEM * vBuf,
const unsigned char * data )
private

Definition at line 471 of file wiredtiger_cursor.cc.

◆ position()

void WiredTigerCursor::position ( const unsigned char * record)
virtual

Implements drizzled::Cursor.

Definition at line 1348 of file wiredtiger_cursor.cc.

◆ read_time()

double WiredTigerCursor::read_time ( uint32_t ,
uint32_t ,
drizzled::ha_rows rows )
inlinevirtual

Calculate the time it takes to read a set of ranges through an index This enables us to optimise reads for clustered indexes.

Returns
estimated time measured in disk seeks

Reimplemented from drizzled::Cursor.

Definition at line 206 of file wiredtiger_drizzle.h.

◆ recordPacker()

int WiredTigerCursor::recordPacker ( WT_PACK_STREAM * packedKey,
WT_PACK_STREAM * packedValue,
unsigned char * data,
size_t * keySize,
size_t * valueSize,
bool packing )
private

Definition at line 519 of file wiredtiger_cursor.cc.

◆ records_in_range()

ha_rows WiredTigerCursor::records_in_range ( uint32_t inx,
drizzled::key_range * min_key,
drizzled::key_range * max_key )
virtual

Estimates the number of index records in a range.

Returns
estimated number of rows

Reimplemented from drizzled::Cursor.

Definition at line 1681 of file wiredtiger_cursor.cc.

◆ reopen_cursor_if_needed()

void WiredTigerCursor::reopen_cursor_if_needed ( )
private

Definition at line 64 of file wiredtiger_cursor.cc.

◆ reset()

int WiredTigerCursor::reset ( void )
virtual

Reset state of file to after 'open'. This function is called after every statement for all tables used by that statement.

Reimplemented from drizzled::Cursor.

Definition at line 1487 of file wiredtiger_cursor.cc.

◆ reset_auto_increment()

int WiredTigerCursor::reset_auto_increment ( uint64_t )
inlinevirtual

Reset the auto-increment counter to the given value, i.e. the next row inserted will get the given value. This is called e.g. after TRUNCATE is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is returned by storage engines that don't support this operation.

Reimplemented from drizzled::Cursor.

Definition at line 253 of file wiredtiger_drizzle.h.

◆ rnd_next()

int WiredTigerCursor::rnd_next ( unsigned char * buf)
virtual

Implements drizzled::Cursor.

Definition at line 1311 of file wiredtiger_cursor.cc.

◆ rnd_pos()

int WiredTigerCursor::rnd_pos ( unsigned char * buf,
unsigned char * pos )
virtual

Implements drizzled::Cursor.

Definition at line 1328 of file wiredtiger_cursor.cc.

◆ scan_time()

double WiredTigerCursor::scan_time ( void )
inlinevirtual

How many seeks it will take to read through the table. This is to be comparable to the number returned by records_in_range so that we can decide if we should scan the table or use keys.

Returns
estimated time measured in disk seeks

Reimplemented from drizzled::Cursor.

Definition at line 192 of file wiredtiger_drizzle.h.

◆ set_keys_for_scanning()

void WiredTigerCursor::set_keys_for_scanning ( void )

Definition at line 428 of file wiredtiger_cursor.cc.

◆ setupKeyFields()

int WiredTigerCursor::setupKeyFields ( uint32_t keynr,
bool recreate )
private

Definition at line 100 of file wiredtiger_cursor.cc.

◆ setupTableURI()

int WiredTigerCursor::setupTableURI ( const drizzled::identifier::Table & identifier)
private

Definition at line 79 of file wiredtiger_cursor.cc.

◆ store_lock()

THR_LOCK_DATA ** WiredTigerCursor::store_lock ( Session * ,
THR_LOCK_DATA ** to,
thr_lock_type  )
virtual

Is not invoked for non-transactional temporary tables.

Note
store_lock() can return more than one lock if the table is MERGE or partitioned.
that one can NOT rely on table->in_use in store_lock(). It may refer to a different thread if called from abortLockForThread().
If the table is MERGE, store_lock() can return less locks than lock_count() claimed. This can happen when the MERGE children are not attached when this is called from another thread.

Reimplemented from drizzled::Cursor.

Definition at line 296 of file wiredtiger_cursor.cc.

◆ unpackField()

int WiredTigerCursor::unpackField ( Field * field,
WT_PACK_STREAM * unpacker,
ptrdiff_t row_offset )
private

Definition at line 779 of file wiredtiger_cursor.cc.

◆ unpackRecord()

int WiredTigerCursor::unpackRecord ( WT_ITEM * kBuf,
WT_ITEM * vBuf,
unsigned char * data )
private

Definition at line 496 of file wiredtiger_cursor.cc.

◆ update_key_stats()

void WiredTigerCursor::update_key_stats ( )
private

Definition at line 433 of file wiredtiger_cursor.cc.

◆ wt_pack_from_index_buf()

int WiredTigerCursor::wt_pack_from_index_buf ( WT_ITEM * kBuf,
const drizzled::KeyInfo * key_info,
const unsigned char * key_ptr,
uint32_t key_len )
private

Definition at line 1084 of file wiredtiger_cursor.cc.

Member Data Documentation

◆ index_key_fields

std::vector<int32_t>* WiredTigerCursor::index_key_fields
private

Definition at line 296 of file wiredtiger_drizzle.h.

◆ index_value_fields

std::vector<int32_t>* WiredTigerCursor::index_value_fields
private

Definition at line 297 of file wiredtiger_drizzle.h.

◆ internal_table

bool WiredTigerCursor::internal_table
private

Definition at line 179 of file wiredtiger_drizzle.h.

◆ key_buf

WT_ITEM WiredTigerCursor::key_buf
private

Definition at line 291 of file wiredtiger_drizzle.h.

◆ key_fields

std::vector<int32_t>* WiredTigerCursor::key_fields
private

Definition at line 295 of file wiredtiger_drizzle.h.

◆ key_stat_version

uint32_t WiredTigerCursor::key_stat_version
private

Definition at line 178 of file wiredtiger_drizzle.h.

◆ lock

drizzled::THR_LOCK_DATA WiredTigerCursor::lock

Definition at line 260 of file wiredtiger_drizzle.h.

◆ null_buf

WT_ITEM WiredTigerCursor::null_buf
private

Definition at line 293 of file wiredtiger_drizzle.h.

◆ opt_flag

uint32_t WiredTigerCursor::opt_flag
private

Definition at line 306 of file wiredtiger_drizzle.h.

◆ records_changed

uint32_t WiredTigerCursor::records_changed
private

Definition at line 177 of file wiredtiger_drizzle.h.

◆ share

WiredTigerTableShare* WiredTigerCursor::share
private

Definition at line 299 of file wiredtiger_drizzle.h.

◆ table_uri

string WiredTigerCursor::table_uri
private

Definition at line 298 of file wiredtiger_drizzle.h.

◆ value_buf

WT_ITEM WiredTigerCursor::value_buf
private

Definition at line 292 of file wiredtiger_drizzle.h.

◆ wt_cursor

WT_CURSOR* WiredTigerCursor::wt_cursor
private

Definition at line 289 of file wiredtiger_drizzle.h.

◆ wt_session

WT_SESSION* WiredTigerCursor::wt_session
private

Definition at line 288 of file wiredtiger_drizzle.h.


The documentation for this class was generated from the following files: