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;
216 int open(
const char *
name,
int mode, uint test_if_locked,
218 int close(
void)
override;
225 int index_init(uint keynr,
bool sorted)
override;
237 bool eq_range,
bool sorted)
override;
253 int info(uint)
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:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: ha_federated.h:93
int truncate(dd::Table *table_def) override
Quickly remove all rows from a table.
Definition: ha_federated.cc:2813
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:2261
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:2905
int read_next(uchar *buf, MYSQL_RES *result)
Definition: ha_federated.cc:2508
int real_connect()
Definition: ha_federated.cc:2917
int index_next(uchar *buf) override
Definition: ha_federated.cc:2378
ha_federated(handlerton *hton, TABLE_SHARE *table_arg)
Definition: ha_federated.cc:886
int rnd_next(uchar *buf) override
Definition: ha_federated.cc:2467
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:2238
int delete_row(const uchar *buf) override
Definition: ha_federated.cc:2127
int open(const char *name, int mode, uint test_if_locked, const dd::Table *table_def) override
Definition: ha_federated.cc:1566
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:2327
int connection_commit()
Definition: ha_federated.cc:3155
int index_read(uchar *buf, const uchar *key, uint key_len, enum ha_rkey_function find_flag) override
Definition: ha_federated.cc:2214
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:915
int reset(void) override
Reset state of file to after 'open'.
Definition: ha_federated.cc:2759
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:3046
int close(void) override
Definition: ha_federated.cc:1593
int connection_autocommit(bool state)
Definition: ha_federated.cc:3165
bool get_error_message(int error, String *buf) override
Return an error message specific to this handler.
Definition: ha_federated.cc:3059
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:2449
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:2338
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:3160
void start_bulk_insert(ha_rows rows) override
Prepares the storage engine for bulk inserts.
Definition: ha_federated.cc:1849
int extra(ha_extra_function operation) override
Handles extra signals from MySQL server.
Definition: ha_federated.cc:2719
int delete_all_rows(void) override
Delete all rows in a table.
Definition: ha_federated.cc:2786
MYSQL_ROW_OFFSET current_position
Definition: ha_federated.h:103
int end_bulk_insert() override
End bulk insert.
Definition: ha_federated.cc:1887
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:2193
MYSQL_RES * store_result(MYSQL *mysql)
Store a result set.
Definition: ha_federated.cc:3086
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:3181
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:1940
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:1264
int update_row(const uchar *old_data, uchar *new_data) override
Update a single row.
Definition: ha_federated.cc:1980
int real_query(const char *query, size_t length)
Definition: ha_federated.cc:2988
void update_auto_increment(void)
Definition: ha_federated.cc:1912
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:3172
void position(const uchar *record) override
Store a reference to current row.
Definition: ha_federated.cc:2544
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:1543
int rnd_pos(uchar *buf, uchar *pos) override
Definition: ha_federated.cc:2566
int rnd_end() override
Definition: ha_federated.cc:2444
int rnd_next_int(uchar *buf)
Definition: ha_federated.cc:2474
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:2399
int info(uint) override
General method to gather info from handler.
Definition: ha_federated.cc:2628
int external_lock(THD *thd, int lock_type) override
Is not invoked for non-transactional temporary tables.
Definition: ha_federated.cc:3105
void free_result()
Definition: ha_federated.cc:3096
int write_row(uchar *buf) override
Write a row.
Definition: ha_federated.cc:1713
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:2370
bool append_stmt_insert(String *query)
Construct the INSERT statement.
Definition: ha_federated.cc:1641
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:2866
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:1921
ha_rows estimate_rows_upper_bound() override
Return upper bound of current number of records in the table (max.
Definition: ha_federated.cc:2323
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4573
bool eq_range
Definition: handler.h:4633
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:1008
my_off_t ha_rows
Definition: my_base.h:1141
ha_extra_function
Definition: my_base.h:185
#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:47
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:195
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:61
required string key
Definition: replication_asynchronous_connection_failover.proto:60
#define HA_BINLOG_ROW_CAPABLE
Definition: handler.h:347
#define HA_FILE_BASED
Definition: handler.h:332
#define HA_CAN_INDEX_BLOBS
Definition: handler.h:265
#define HA_MAX_REC_LENGTH
Definition: handler.h:625
#define HA_READ_NEXT
Definition: handler.h:534
#define HA_CAN_REPAIR
Definition: handler.h:377
#define HA_PARTIAL_COLUMN_READ
Definition: handler.h:219
#define HA_PRIMARY_KEY_IN_READ_INDEX
Definition: handler.h:289
#define HA_NO_PREFIX_CHAR_KEYS
Definition: handler.h:309
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
Definition: handler.h:297
#define HA_BINLOG_STMT_CAPABLE
Definition: handler.h:348
#define HA_READ_RANGE
Definition: handler.h:557
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Definition: handler.h:305
#define HA_NO_TRANSACTIONS
Definition: handler.h:218
#define HA_AUTO_PART_KEY
Definition: handler.h:270
#define HA_NULL_IN_KEY
Definition: handler.h:253
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:29
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:3791
Struct to hold information about the table that should be created.
Definition: handler.h:3202
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:701
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:2734
Definition: my_base.h:1125
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: mysqlslap.cc:240
thr_lock_type
Definition: thr_lock.h:51