46#define HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM 10000
48#define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5
49#define FEDERATED_RECORDS_IN_RANGE 2
50#define FEDERATED_MAX_KEY_LENGTH 3500
138 const char *
table_type()
const override {
return "FEDERATED"; }
181 [[maybe_unused]])
const override {
197 return (
double)(
stats.records * 1000);
207 return (
double)rows / 20.0 + 1;
218 int close(
void)
override;
237 bool eq_range,
bool sorted)
override;
280 int reset(
void)
override;
app_data_ptr new_data(u_int n, char *val, cons_type consensus)
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Definition: ha_federated.h:93
int truncate(dd::Table *table_def) override
Quickly remove all rows from a table.
Definition: ha_federated.cc:2810
uint max_supported_key_length() const override
Definition: ha_federated.h:177
int index_read_idx_with_result_set(uchar *buf, uint index, const uchar *key, uint key_len, ha_rkey_function find_flag, MYSQL_RES **result)
Definition: ha_federated.cc:2258
ha_federated * trx_next
Definition: ha_federated.h:142
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, dd::Table *table_def) override
Create table (implementation).
Definition: ha_federated.cc:2902
int read_next(uchar *buf, MYSQL_RES *result)
Definition: ha_federated.cc:2505
int real_connect()
Definition: ha_federated.cc:2914
int index_next(uchar *buf) override
Definition: ha_federated.cc:2375
ha_federated(handlerton *hton, TABLE_SHARE *table_arg)
Definition: ha_federated.cc:883
int rnd_next(uchar *buf) override
Definition: ha_federated.cc:2464
MEM_ROOT m_blob_root
Memory area for BLOB data.
Definition: ha_federated.h:110
int index_read_idx(uchar *buf, uint idx, const uchar *key, uint key_len, enum ha_rkey_function find_flag)
Definition: ha_federated.cc:2235
int delete_row(const uchar *buf) override
Definition: ha_federated.cc:2124
int open(const char *name, int mode, uint test_if_locked, const dd::Table *table_def) override
Definition: ha_federated.cc:1563
FEDERATED_SHARE * share
Definition: ha_federated.h:95
MYSQL_RES * stored_result
Definition: ha_federated.h:97
int index_init(uint keynr, bool sorted) override
Definition: ha_federated.cc:2324
int connection_commit()
Definition: ha_federated.cc:3159
int index_read(uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag) override
Definition: ha_federated.cc:2211
double scan_time() override
Definition: ha_federated.h:195
uint convert_row_to_internal_format(uchar *buf, MYSQL_ROW row, MYSQL_RES *result)
Definition: ha_federated.cc:912
int reset(void) override
Reset state of file to after 'open'.
Definition: ha_federated.cc:2756
char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE]
Definition: ha_federated.h:105
bool position_called
Definition: ha_federated.h:102
int stash_remote_error()
Definition: ha_federated.cc:3050
int close(void) override
Definition: ha_federated.cc:1590
int connection_autocommit(bool state)
Definition: ha_federated.cc:3169
bool get_error_message(int error, String *buf) override
Return an error message specific to this handler.
Definition: ha_federated.cc:3063
ulonglong table_flags() const override
Definition: ha_federated.h:148
THR_LOCK_DATA lock
Definition: ha_federated.h:94
int index_end() override
Definition: ha_federated.cc:2446
uint max_supported_key_part_length(HA_CREATE_INFO *create_info) const override
Definition: ha_federated.h:180
int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted) override
Read first row between two ranges.
Definition: ha_federated.cc:2335
double read_time(uint, uint, ha_rows rows) override
The cost of reading a set of ranges from the table using an index to access it.
Definition: ha_federated.h:202
int connection_rollback()
Definition: ha_federated.cc:3164
void start_bulk_insert(ha_rows rows) override
Prepares the storage engine for bulk inserts.
Definition: ha_federated.cc:1846
int extra(ha_extra_function operation) override
Handles extra signals from MySQL server.
Definition: ha_federated.cc:2716
int delete_all_rows(void) override
Delete all rows in a table.
Definition: ha_federated.cc:2783
MYSQL_ROW_OFFSET current_position
Definition: ha_federated.h:103
int end_bulk_insert() override
End bulk insert.
Definition: ha_federated.cc:1884
DYNAMIC_STRING bulk_insert
Definition: ha_federated.h:108
int index_read_idx_map(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
Positions an index cursor to the index specified in argument.
Definition: ha_federated.cc:2190
MYSQL_RES * store_result(MYSQL *mysql)
Store a result set.
Definition: ha_federated.cc:3090
int rnd_pos_by_record(uchar *record) override
This function only works for handlers having HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set.
Definition: ha_federated.cc:3185
MYSQL * mysql
Definition: ha_federated.h:96
int repair(THD *thd, HA_CHECK_OPT *check_opt) override
In this method check_opt can be modified to specify CHECK option to use to call check() upon the tabl...
Definition: ha_federated.cc:1937
bool create_where_from_key(String *to, KEY *key_info, const key_range *start_key, const key_range *end_key, bool records_in_range, bool eq_range)
Definition: ha_federated.cc:1261
int update_row(const uchar *old_data, uchar *new_data) override
Update a single row.
Definition: ha_federated.cc:1977
int real_query(const char *query, size_t length)
Definition: ha_federated.cc:2992
void update_auto_increment(void)
Definition: ha_federated.cc:1909
uint max_supported_record_length() const override
Definition: ha_federated.h:172
~ha_federated() override=default
bool insert_dup_update
Definition: ha_federated.h:107
const char * table_type() const override
The following can be called without an open handler.
Definition: ha_federated.h:138
ulong index_flags(uint, uint, bool) const override
Definition: ha_federated.h:169
int execute_simple_query(const char *query, int len)
Definition: ha_federated.cc:3176
void position(const uchar *record) override
Store a reference to current row.
Definition: ha_federated.cc:2541
ha_rows records_in_range(uint inx, key_range *start_key, key_range *end_key) override
Find number of records in a range.
Definition: ha_federated.cc:1540
int rnd_pos(uchar *buf, uchar *pos) override
Definition: ha_federated.cc:2563
int rnd_end() override
Definition: ha_federated.cc:2441
int rnd_next_int(uchar *buf)
Definition: ha_federated.cc:2471
int rnd_init(bool scan) override
rnd_init() can be called two times without rnd_end() in between (it only makes sense if scan=1).
Definition: ha_federated.cc:2396
int info(uint) override
General method to gather info from handler.
Definition: ha_federated.cc:2625
int external_lock(THD *thd, int lock_type) override
Is not invoked for non-transactional temporary tables.
Definition: ha_federated.cc:3109
void free_result()
Definition: ha_federated.cc:3100
int write_row(uchar *buf) override
Write a row.
Definition: ha_federated.cc:1710
uint max_supported_key_parts() const override
Definition: ha_federated.h:176
int read_range_next() override
Read next row between two endpoints.
Definition: ha_federated.cc:2367
bool append_stmt_insert(String *query)
Construct the INSERT statement.
Definition: ha_federated.cc:1638
bool ignore_duplicates
Definition: ha_federated.h:106
THR_LOCK_DATA ** store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) override
Is not invoked for non-transactional temporary tables.
Definition: ha_federated.cc:2863
Prealloced_array< MYSQL_RES *, 4 > results
Array of all stored results we get during a query execution.
Definition: ha_federated.h:101
bool replace_duplicates
Definition: ha_federated.h:106
int remote_error_number
Definition: ha_federated.h:104
uint max_supported_keys() const override
Definition: ha_federated.h:175
int optimize(THD *thd, HA_CHECK_OPT *check_opt) override
Definition: ha_federated.cc:1918
ha_rows estimate_rows_upper_bound() override
Return upper bound of current number of records in the table (max.
Definition: ha_federated.cc:2320
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4414
bool eq_range
Definition: handler.h:4474
A table definition from the master.
Definition: rpl_utility.h:248
#define FEDERATED_QUERY_BUFFER_SIZE
Definition: ha_federated.h:48
#define FEDERATED_MAX_KEY_LENGTH
Definition: ha_federated.h:50
ha_rkey_function
Definition: my_base.h:78
@ HA_READ_AFTER_KEY
Definition: my_base.h:82
ulong key_part_map
Definition: my_base.h:1007
my_off_t ha_rows
Definition: my_base.h:1140
ha_extra_function
Definition: my_base.h:184
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:181
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
static char * query
Definition: myisam_ftdump.cc:45
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
char ** MYSQL_ROW
Definition: mysql.h:145
static int record
Definition: mysqltest.cc:188
Definition: buf0block_hint.cc:30
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Definition: instrumented_condition_variable.h:32
mode
Definition: file_handle.h:60
required string key
Definition: replication_asynchronous_connection_failover.proto:60
#define HA_BINLOG_ROW_CAPABLE
Definition: handler.h:339
#define HA_FILE_BASED
Definition: handler.h:324
#define HA_CAN_INDEX_BLOBS
Definition: handler.h:257
#define HA_MAX_REC_LENGTH
Definition: handler.h:617
#define HA_READ_NEXT
Definition: handler.h:526
#define HA_CAN_REPAIR
Definition: handler.h:369
#define HA_PARTIAL_COLUMN_READ
Definition: handler.h:211
#define HA_PRIMARY_KEY_IN_READ_INDEX
Definition: handler.h:281
#define HA_NO_PREFIX_CHAR_KEYS
Definition: handler.h:301
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Definition: handler.h:289
#define HA_BINLOG_STMT_CAPABLE
Definition: handler.h:340
#define HA_READ_RANGE
Definition: handler.h:549
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Definition: handler.h:297
#define HA_NO_TRANSACTIONS
Definition: handler.h:210
#define HA_AUTO_PART_KEY
Definition: handler.h:262
#define HA_NULL_IN_KEY
Definition: handler.h:245
constexpr const unsigned int MAX_KEY
Definition: sql_const.h:46
constexpr const unsigned int MAX_REF_PARTS
Definition: sql_const.h:47
case opt name
Definition: sslopt-case.h:33
Definition: ha_federated.h:56
char * table
Definition: ha_federated.h:78
char * connect_string
Definition: ha_federated.h:72
int share_key_length
Definition: ha_federated.h:81
char * hostname
Definition: ha_federated.h:73
char * select_query
Definition: ha_federated.h:65
char * database
Definition: ha_federated.h:76
bool parsed
Definition: ha_federated.h:59
char * server_name
Definition: ha_federated.h:69
char * username
Definition: ha_federated.h:74
size_t use_count
Definition: ha_federated.h:85
size_t table_name_length
Definition: ha_federated.h:84
char * password
Definition: ha_federated.h:75
const char * share_key
Definition: ha_federated.h:61
ushort port
Definition: ha_federated.h:82
THR_LOCK lock
Definition: ha_federated.h:87
size_t connect_string_length
Definition: ha_federated.h:84
char * connection_string
Definition: ha_federated.h:70
char * table_name
Definition: ha_federated.h:77
char * sport
Definition: ha_federated.h:80
const char * socket
Definition: ha_federated.h:79
MEM_ROOT mem_root
Definition: ha_federated.h:57
size_t server_name_length
Definition: ha_federated.h:84
mysql_mutex_t mutex
Definition: ha_federated.h:86
char * scheme
Definition: ha_federated.h:71
Definition: handler.h:3632
Struct to hold information about the table that should be created.
Definition: handler.h:3045
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
This structure is shared between different table objects.
Definition: table.h:690
Definition: thr_lock.h:124
Definition: thr_lock.h:139
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2622
Definition: my_base.h:1124
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: mysqlslap.cc:238
thr_lock_type
Definition: thr_lock.h:51
unsigned int uint
Definition: uca9-dump.cc:75