Commit 793b84b8 authored by Kentoku SHIBA's avatar Kentoku SHIBA

add a table parameter "dsn" to Spider

parent 932baa94
......@@ -566,6 +566,7 @@ SPIDER_CONN *spider_create_conn(
char *tmp_name, *tmp_host, *tmp_username, *tmp_password, *tmp_socket;
char *tmp_wrapper, *tmp_db, *tmp_ssl_ca, *tmp_ssl_capath, *tmp_ssl_cert;
char *tmp_ssl_cipher, *tmp_ssl_key, *tmp_default_file, *tmp_default_group;
char *tmp_dsn;
DBUG_ENTER("spider_create_conn");
if (unlikely(!UTC))
......@@ -615,6 +616,8 @@ SPIDER_CONN *spider_create_conn(
(uint) (share->tgt_default_files_lengths[link_idx] + 1),
&tmp_default_group,
(uint) (share->tgt_default_groups_lengths[link_idx] + 1),
&tmp_dsn,
(uint) (share->tgt_dsns_lengths[link_idx] + 1),
&need_mon, (uint) (sizeof(int)),
NullS))
) {
......@@ -714,6 +717,15 @@ SPIDER_CONN *spider_create_conn(
share->tgt_default_groups_lengths[link_idx]);
} else
conn->tgt_default_group = NULL;
conn->tgt_dsn_length =
share->tgt_dsns_lengths[link_idx];
if (conn->tgt_dsn_length)
{
conn->tgt_dsn = tmp_dsn;
memcpy(conn->tgt_dsn, share->tgt_dsns[link_idx],
share->tgt_dsns_lengths[link_idx]);
} else
conn->tgt_dsn = NULL;
conn->tgt_port = share->tgt_ports[link_idx];
conn->tgt_ssl_vsc = share->tgt_ssl_vscs[link_idx];
conn->dbton_id = share->sql_dbton_ids[link_idx];
......
......@@ -288,7 +288,8 @@ int spider_udf_direct_sql_create_conn_key(
+ direct_sql->tgt_ssl_key_length + 1
+ 1 + 1
+ direct_sql->tgt_default_file_length + 1
+ direct_sql->tgt_default_group_length;
+ direct_sql->tgt_default_group_length + 1
+ direct_sql->tgt_dsn_length;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
} else {
direct_sql->conn_key_length
......@@ -395,6 +396,13 @@ int spider_udf_direct_sql_create_conn_key(
tmp_name = strmov(tmp_name + 1, direct_sql->tgt_default_group);
} else
tmp_name++;
if (direct_sql->tgt_dsn)
{
DBUG_PRINT("info",("spider tgt_dsn=%s",
direct_sql->tgt_dsn));
tmp_name = strmov(tmp_name + 1, direct_sql->tgt_dsn);
} else
tmp_name++;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
}
#endif
......@@ -414,6 +422,7 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
char *tmp_name, *tmp_host, *tmp_username, *tmp_password, *tmp_socket;
char *tmp_wrapper, *tmp_db, *tmp_ssl_ca, *tmp_ssl_capath, *tmp_ssl_cert;
char *tmp_ssl_cipher, *tmp_ssl_key, *tmp_default_file, *tmp_default_group;
char *tmp_dsn;
int *need_mon;
bool tables_on_different_db_are_joinable = TRUE;
DBUG_ENTER("spider_udf_direct_sql_create_conn");
......@@ -452,6 +461,8 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
(uint) (direct_sql->tgt_default_file_length + 1),
&tmp_default_group,
(uint) (direct_sql->tgt_default_group_length + 1),
&tmp_dsn,
(uint) (direct_sql->tgt_dsn_length + 1),
&need_mon, (uint) (sizeof(int)),
NullS))
) {
......@@ -568,6 +579,14 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
direct_sql->tgt_default_group_length);
} else
conn->tgt_default_group = NULL;
conn->tgt_dsn_length = direct_sql->tgt_dsn_length;
if (conn->tgt_dsn_length)
{
conn->tgt_dsn = tmp_dsn;
memcpy(conn->tgt_dsn, direct_sql->tgt_dsn,
direct_sql->tgt_dsn_length);
} else
conn->tgt_dsn = NULL;
conn->tgt_ssl_vsc = direct_sql->tgt_ssl_vsc;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
} else {
......@@ -1238,6 +1257,7 @@ int spider_udf_parse_direct_sql_param(
SPIDER_PARAM_INT("cto", connect_timeout, 0);
SPIDER_PARAM_STR("dff", tgt_default_file);
SPIDER_PARAM_STR("dfg", tgt_default_group);
SPIDER_PARAM_STR("dsn", tgt_dsn);
SPIDER_PARAM_LONGLONG("prt", priority, 0);
SPIDER_PARAM_INT("rto", net_read_timeout, 0);
SPIDER_PARAM_STR("sca", tgt_ssl_ca);
......@@ -1661,6 +1681,10 @@ void spider_udf_free_direct_sql_alloc(
{
spider_free(spider_current_trx, direct_sql->tgt_default_group, MYF(0));
}
if (direct_sql->tgt_dsn)
{
spider_free(spider_current_trx, direct_sql->tgt_dsn, MYF(0));
}
if (direct_sql->conn_key)
{
spider_free(spider_current_trx, direct_sql->conn_key, MYF(0));
......
......@@ -256,8 +256,8 @@ const char SPIDER_empty_string = "";
#define SPIDER_LINK_MON_DRAW_FEW_MON 1
#define SPIDER_LINK_MON_DRAW 2
#define SPIDER_TMP_SHARE_CHAR_PTR_COUNT 20
#define SPIDER_TMP_SHARE_UINT_COUNT 17
#define SPIDER_TMP_SHARE_CHAR_PTR_COUNT 21
#define SPIDER_TMP_SHARE_UINT_COUNT SPIDER_TMP_SHARE_CHAR_PTR_COUNT
#define SPIDER_TMP_SHARE_LONG_COUNT 19
#define SPIDER_TMP_SHARE_LONGLONG_COUNT 3
......@@ -351,6 +351,7 @@ typedef struct st_spider_alter_table
char **tmp_tgt_ssl_keys;
char **tmp_tgt_default_files;
char **tmp_tgt_default_groups;
char **tmp_tgt_dsns;
char **tmp_static_link_ids;
long *tmp_tgt_ports;
long *tmp_tgt_ssl_vscs;
......@@ -372,6 +373,7 @@ typedef struct st_spider_alter_table
uint *tmp_tgt_ssl_keys_lengths;
uint *tmp_tgt_default_files_lengths;
uint *tmp_tgt_default_groups_lengths;
uint *tmp_tgt_dsns_lengths;
uint *tmp_static_link_ids_lengths;
uint tmp_server_names_charlen;
......@@ -389,6 +391,7 @@ typedef struct st_spider_alter_table
uint tmp_tgt_ssl_keys_charlen;
uint tmp_tgt_default_files_charlen;
uint tmp_tgt_default_groups_charlen;
uint tmp_tgt_dsns_charlen;
uint tmp_static_link_ids_charlen;
uint tmp_server_names_length;
......@@ -406,6 +409,7 @@ typedef struct st_spider_alter_table
uint tmp_tgt_ssl_keys_length;
uint tmp_tgt_default_files_length;
uint tmp_tgt_default_groups_length;
uint tmp_tgt_dsns_length;
uint tmp_static_link_ids_length;
uint tmp_tgt_ports_length;
uint tmp_tgt_ssl_vscs_length;
......@@ -490,6 +494,7 @@ typedef struct st_spider_conn
char *tgt_ssl_key;
char *tgt_default_file;
char *tgt_default_group;
char *tgt_dsn;
long tgt_port;
long tgt_ssl_vsc;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
......@@ -510,6 +515,7 @@ typedef struct st_spider_conn
uint tgt_ssl_key_length;
uint tgt_default_file_length;
uint tgt_default_group_length;
uint tgt_dsn_length;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
uint hs_sock_length;
#endif
......@@ -1119,6 +1125,7 @@ typedef struct st_spider_share
char **tgt_ssl_keys;
char **tgt_default_files;
char **tgt_default_groups;
char **tgt_dsns;
char **static_link_ids;
char **tgt_pk_names;
char **tgt_sequence_names;
......@@ -1173,6 +1180,7 @@ typedef struct st_spider_share
uint *tgt_ssl_keys_lengths;
uint *tgt_default_files_lengths;
uint *tgt_default_groups_lengths;
uint *tgt_dsns_lengths;
uint *static_link_ids_lengths;
uint *tgt_pk_names_lengths;
uint *tgt_sequence_names_lengths;
......@@ -1203,6 +1211,7 @@ typedef struct st_spider_share
uint tgt_ssl_keys_charlen;
uint tgt_default_files_charlen;
uint tgt_default_groups_charlen;
uint tgt_dsns_charlen;
uint static_link_ids_charlen;
uint tgt_pk_names_charlen;
uint tgt_sequence_names_charlen;
......@@ -1229,6 +1238,7 @@ typedef struct st_spider_share
uint tgt_ssl_keys_length;
uint tgt_default_files_length;
uint tgt_default_groups_length;
uint tgt_dsns_length;
uint static_link_ids_length;
uint tgt_pk_names_length;
uint tgt_sequence_names_length;
......@@ -1363,6 +1373,7 @@ typedef struct st_spider_direct_sql
char *tgt_ssl_key;
char *tgt_default_file;
char *tgt_default_group;
char *tgt_dsn;
char *conn_key;
long tgt_port;
long tgt_ssl_vsc;
......@@ -1381,6 +1392,7 @@ typedef struct st_spider_direct_sql
uint tgt_ssl_key_length;
uint tgt_default_file_length;
uint tgt_default_group_length;
uint tgt_dsn_length;
uint conn_key_length;
uint dbton_id;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
......
......@@ -51,6 +51,7 @@ static LEX_STRING spider_init_queries[] = {
" ssl_verify_server_cert tinyint not null default 0,"
" default_file text,"
" default_group char(64) default null,"
" dsn char(64) default null,"
" key idx1 (data, format_id, gtrid_length, host)"
") engine=MyISAM default charset=utf8 collate=utf8_bin"
)},
......@@ -74,6 +75,7 @@ static LEX_STRING spider_init_queries[] = {
" ssl_verify_server_cert tinyint not null default 0,"
" default_file text,"
" default_group char(64) default null,"
" dsn char(64) default null,"
" thread_id int default null,"
" status char(8) not null default '',"
" failed_time timestamp not null default current_timestamp,"
......@@ -102,6 +104,7 @@ static LEX_STRING spider_init_queries[] = {
" monitoring_binlog_pos_at_failing tinyint not null default 0,"
" default_file text,"
" default_group char(64) default null,"
" dsn char(64) default null,"
" tgt_db_name char(64) default null,"
" tgt_table_name char(64) default null,"
" link_status tinyint not null default 1,"
......@@ -133,6 +136,7 @@ static LEX_STRING spider_init_queries[] = {
" ssl_verify_server_cert tinyint not null default 0,"
" default_file text,"
" default_group char(64) default null,"
" dsn char(64) default null,"
" primary key (db_name, table_name, link_id, sid)"
") engine=MyISAM default charset=utf8 collate=utf8_bin"
)},
......@@ -595,6 +599,21 @@ static LEX_STRING spider_init_queries[] = {
" primary key (db_name, table_name, table_id, partition_id)"
" ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;"
" end if;"
/*
Fix for version 3.4
*/
" call mysql.spider_fix_one_table('spider_link_mon_servers', 'dsn',"
" 'alter table mysql.spider_link_mon_servers"
" add column dsn char(64) default null after default_group');"
" call mysql.spider_fix_one_table('spider_tables', 'dsn',"
" 'alter table mysql.spider_tables"
" add column dsn char(64) default null after default_group');"
" call mysql.spider_fix_one_table('spider_xa_failed_log', 'dsn',"
" 'alter table mysql.spider_xa_failed_log"
" add column dsn char(64) default null after default_group');"
" call mysql.spider_fix_one_table('spider_xa_member', 'dsn',"
" 'alter table mysql.spider_xa_member"
" add column dsn char(64) default null after default_group');"
"end;"
)},
{C_STRING_WITH_LEN(
......
......@@ -39,6 +39,113 @@
extern handlerton *spider_hton_ptr;
extern Time_zone *spd_tz_system;
#define SPIDER_XA_FORMAT_ID_POS 0
#define SPIDER_XA_GTRID_LENGTH_POS 1
#define SPIDER_XA_BQUAL_LENGTH_POS 2
#define SPIDER_XA_DATA_POS 3
#define SPIDER_XA_STATUS_POS 4
#define SPIDER_XA_MEMBER_FORMAT_ID_POS 0
#define SPIDER_XA_MEMBER_GTRID_LENGTH_POS 1
#define SPIDER_XA_MEMBER_BQUAL_LENGTH_POS 2
#define SPIDER_XA_MEMBER_DATA_POS 3
#define SPIDER_XA_MEMBER_SCHEME_POS 4
#define SPIDER_XA_MEMBER_HOST_POS 5
#define SPIDER_XA_MEMBER_PORT_POS 6
#define SPIDER_XA_MEMBER_SOCKET_POS 7
#define SPIDER_XA_MEMBER_USERNAME_POS 8
#define SPIDER_XA_MEMBER_PASSWORD_POS 9
#define SPIDER_XA_MEMBER_SSL_CA_POS 10
#define SPIDER_XA_MEMBER_SSL_CAPATH_POS 11
#define SPIDER_XA_MEMBER_SSL_CERT_POS 12
#define SPIDER_XA_MEMBER_SSL_CIPHER_POS 13
#define SPIDER_XA_MEMBER_SSL_KEY_POS 14
#define SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS 15
#define SPIDER_XA_MEMBER_DEFAULT_FILE_POS 16
#define SPIDER_XA_MEMBER_DEFAULT_GROUP_POS 17
#define SPIDER_XA_MEMBER_DSN_POS 18
#define SPIDER_XA_FAILED_LOG_THREAD_ID_POS 19
#define SPIDER_XA_FAILED_LOG_STATUS_POS 20
#define SPIDER_XA_FAILED_LOG_FAILED_TIME_POS 21
#define SPIDER_TABLES_DB_NAME_POS 0
#define SPIDER_TABLES_TABLE_NAME_POS 1
#define SPIDER_TABLES_LINK_ID_POS 2
#define SPIDER_TABLES_PRIORITY_POS 3
#define SPIDER_TABLES_SERVER_POS 4
#define SPIDER_TABLES_SCHEME_POS 5
#define SPIDER_TABLES_HOST_POS 6
#define SPIDER_TABLES_PORT_POS 7
#define SPIDER_TABLES_SOCKET_POS 8
#define SPIDER_TABLES_USERNAME_POS 9
#define SPIDER_TABLES_PASSWORD_POS 10
#define SPIDER_TABLES_SSL_CA_POS 11
#define SPIDER_TABLES_SSL_CAPATH_POS 12
#define SPIDER_TABLES_SSL_CERT_POS 13
#define SPIDER_TABLES_SSL_CIPHER_POS 14
#define SPIDER_TABLES_SSL_KEY_POS 15
#define SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS 16
#define SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS 17
#define SPIDER_TABLES_DEFAULT_FILE_POS 18
#define SPIDER_TABLES_DEFAULT_GROUP_POS 19
#define SPIDER_TABLES_DSN_POS 20
#define SPIDER_TABLES_TGT_DB_NAME_POS 21
#define SPIDER_TABLES_TGT_TABLE_NAME_POS 22
#define SPIDER_TABLES_LINK_STATUS_POS 23
#define SPIDER_TABLES_BLOCK_STATUS_POS 24
#define SPIDER_TABLES_STATIC_LINK_ID_POS 25
#define SPIDER_LINK_MON_SERVERS_DB_NAME_POS 0
#define SPIDER_LINK_MON_SERVERS_TABLE_NAME_POS 1
#define SPIDER_LINK_MON_SERVERS_LINK_ID_POS 2
#define SPIDER_LINK_MON_SERVERS_SID_POS 3
#define SPIDER_LINK_MON_SERVERS_SERVER_POS 4
#define SPIDER_LINK_MON_SERVERS_SCHEME_POS 5
#define SPIDER_LINK_MON_SERVERS_HOST_POS 6
#define SPIDER_LINK_MON_SERVERS_PORT_POS 7
#define SPIDER_LINK_MON_SERVERS_SOCKET_POS 8
#define SPIDER_LINK_MON_SERVERS_USERNAME_POS 9
#define SPIDER_LINK_MON_SERVERS_PASSWORD_POS 10
#define SPIDER_LINK_MON_SERVERS_SSL_CA_POS 11
#define SPIDER_LINK_MON_SERVERS_SSL_CAPATH_POS 12
#define SPIDER_LINK_MON_SERVERS_SSL_CERT_POS 13
#define SPIDER_LINK_MON_SERVERS_SSL_CIPHER_POS 14
#define SPIDER_LINK_MON_SERVERS_SSL_KEY_POS 15
#define SPIDER_LINK_MON_SERVERS_SSL_VERIFY_SERVER_CERT_POS 16
#define SPIDER_LINK_MON_SERVERS_DEFAULT_FILE_POS 17
#define SPIDER_LINK_MON_SERVERS_DEFAULT_GROUP_POS 18
#define SPIDER_LINK_MON_SERVERS_DSN_POS 19
#define SPIDER_LINK_FAILED_LOG_DB_NAME_POS 0
#define SPIDER_LINK_FAILED_LOG_TABLE_NAME_POS 1
#define SPIDER_LINK_FAILED_LOG_LINK_ID_POS 2
#define SPIDER_LINK_FAILED_LOG_FAILED_TIME_POS 3
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_DB_NAME_POS 0
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_TABLE_NAME_POS 1
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_FAILED_LINK_ID_POS 2
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_SOURCE_LINK_ID_POS 3
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_FILE_POS 4
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_POSITION_POS 5
#define SPIDER_TABLE_POSITION_FOR_RECOVERY_GTID_POS 6
#define SPIDER_TABLE_STS_DB_NAME_POS 0
#define SPIDER_TABLE_STS_TABLE_NAME_POS 1
#define SPIDER_TABLE_STS_DATA_FILE_LENGTH_POS 2
#define SPIDER_TABLE_STS_MAX_DATA_FILE_LENGTH_POS 3
#define SPIDER_TABLE_STS_INDEX_FILE_LENGTH_POS 4
#define SPIDER_TABLE_STS_RECORDS_POS 5
#define SPIDER_TABLE_STS_MEAN_REC_LENGTH_POS 6
#define SPIDER_TABLE_STS_CHECK_TIME_POS 7
#define SPIDER_TABLE_STS_CREATE_TIME_POS 8
#define SPIDER_TABLE_STS_UPDATE_TIME_POS 9
#define SPIDER_TABLE_STS_CHECKSUM_POS 10
#define SPIDER_TABLE_CRD_DB_NAME_POS 0
#define SPIDER_TABLE_CRD_TABLE_NAME_POS 1
#define SPIDER_TABLE_CRD_KEY_SEQ_POS 2
#define SPIDER_TABLE_CRD_CARDINALITY_POS 3
/**
Insert a Spider system table row.
......@@ -828,9 +935,9 @@ void spider_store_xa_pk(
XID *xid
) {
DBUG_ENTER("spider_store_xa_pk");
table->field[0]->store(xid->formatID);
table->field[1]->store(xid->gtrid_length);
table->field[3]->store(
table->field[SPIDER_XA_FORMAT_ID_POS]->store(xid->formatID);
table->field[SPIDER_XA_GTRID_LENGTH_POS]->store(xid->gtrid_length);
table->field[SPIDER_XA_DATA_POS]->store(
xid->data,
(uint) xid->gtrid_length + xid->bqual_length,
system_charset_info);
......@@ -842,7 +949,7 @@ void spider_store_xa_bqual_length(
XID *xid
) {
DBUG_ENTER("spider_store_xa_bqual_length");
table->field[2]->store(xid->bqual_length);
table->field[SPIDER_XA_BQUAL_LENGTH_POS]->store(xid->bqual_length);
DBUG_VOID_RETURN;
}
......@@ -851,7 +958,7 @@ void spider_store_xa_status(
const char *status
) {
DBUG_ENTER("spider_store_xa_status");
table->field[4]->store(
table->field[SPIDER_XA_STATUS_POS]->store(
status,
(uint) strlen(status),
system_charset_info);
......@@ -864,19 +971,19 @@ void spider_store_xa_member_pk(
SPIDER_CONN *conn
) {
DBUG_ENTER("spider_store_xa_member_pk");
table->field[0]->store(xid->formatID);
table->field[1]->store(xid->gtrid_length);
table->field[3]->store(
table->field[SPIDER_XA_MEMBER_FORMAT_ID_POS]->store(xid->formatID);
table->field[SPIDER_XA_MEMBER_GTRID_LENGTH_POS]->store(xid->gtrid_length);
table->field[SPIDER_XA_MEMBER_DATA_POS]->store(
xid->data,
(uint) xid->gtrid_length + xid->bqual_length,
system_charset_info);
table->field[5]->store(
table->field[SPIDER_XA_MEMBER_HOST_POS]->store(
conn->tgt_host,
(uint) conn->tgt_host_length,
system_charset_info);
table->field[6]->store(
table->field[SPIDER_XA_MEMBER_PORT_POS]->store(
conn->tgt_port);
table->field[7]->store(
table->field[SPIDER_XA_MEMBER_SOCKET_POS]->store(
conn->tgt_socket,
(uint) conn->tgt_socket_length,
system_charset_info);
......@@ -889,104 +996,115 @@ void spider_store_xa_member_info(
SPIDER_CONN *conn
) {
DBUG_ENTER("spider_store_xa_member_info");
table->field[2]->store(xid->bqual_length);
table->field[4]->store(
table->field[SPIDER_XA_MEMBER_BQUAL_LENGTH_POS]->store(xid->bqual_length);
table->field[SPIDER_XA_MEMBER_SCHEME_POS]->store(
conn->tgt_wrapper,
(uint) conn->tgt_wrapper_length,
system_charset_info);
table->field[8]->store(
table->field[SPIDER_XA_MEMBER_USERNAME_POS]->store(
conn->tgt_username,
(uint) conn->tgt_username_length,
system_charset_info);
table->field[9]->store(
table->field[SPIDER_XA_MEMBER_PASSWORD_POS]->store(
conn->tgt_password,
(uint) conn->tgt_password_length,
system_charset_info);
if (conn->tgt_ssl_ca)
{
table->field[10]->set_notnull();
table->field[10]->store(
table->field[SPIDER_XA_MEMBER_SSL_CA_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_SSL_CA_POS]->store(
conn->tgt_ssl_ca,
(uint) conn->tgt_ssl_ca_length,
system_charset_info);
} else {
table->field[10]->set_null();
table->field[10]->reset();
table->field[SPIDER_XA_MEMBER_SSL_CA_POS]->set_null();
table->field[SPIDER_XA_MEMBER_SSL_CA_POS]->reset();
}
if (conn->tgt_ssl_capath)
{
table->field[11]->set_notnull();
table->field[11]->store(
table->field[SPIDER_XA_MEMBER_SSL_CAPATH_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_SSL_CAPATH_POS]->store(
conn->tgt_ssl_capath,
(uint) conn->tgt_ssl_capath_length,
system_charset_info);
} else {
table->field[11]->set_null();
table->field[11]->reset();
table->field[SPIDER_XA_MEMBER_SSL_CAPATH_POS]->set_null();
table->field[SPIDER_XA_MEMBER_SSL_CAPATH_POS]->reset();
}
if (conn->tgt_ssl_cert)
{
table->field[12]->set_notnull();
table->field[12]->store(
table->field[SPIDER_XA_MEMBER_SSL_CERT_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_SSL_CERT_POS]->store(
conn->tgt_ssl_cert,
(uint) conn->tgt_ssl_cert_length,
system_charset_info);
} else {
table->field[12]->set_null();
table->field[12]->reset();
table->field[SPIDER_XA_MEMBER_SSL_CERT_POS]->set_null();
table->field[SPIDER_XA_MEMBER_SSL_CERT_POS]->reset();
}
if (conn->tgt_ssl_cipher)
{
table->field[13]->set_notnull();
table->field[13]->store(
table->field[SPIDER_XA_MEMBER_SSL_CIPHER_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_SSL_CIPHER_POS]->store(
conn->tgt_ssl_cipher,
(uint) conn->tgt_ssl_cipher_length,
system_charset_info);
} else {
table->field[13]->set_null();
table->field[13]->reset();
table->field[SPIDER_XA_MEMBER_SSL_CIPHER_POS]->set_null();
table->field[SPIDER_XA_MEMBER_SSL_CIPHER_POS]->reset();
}
if (conn->tgt_ssl_key)
{
table->field[14]->set_notnull();
table->field[14]->store(
table->field[SPIDER_XA_MEMBER_SSL_KEY_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_SSL_KEY_POS]->store(
conn->tgt_ssl_key,
(uint) conn->tgt_ssl_key_length,
system_charset_info);
} else {
table->field[14]->set_null();
table->field[14]->reset();
table->field[SPIDER_XA_MEMBER_SSL_KEY_POS]->set_null();
table->field[SPIDER_XA_MEMBER_SSL_KEY_POS]->reset();
}
if (conn->tgt_ssl_vsc >= 0)
{
table->field[15]->set_notnull();
table->field[15]->store(
table->field[SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS]->store(
conn->tgt_ssl_vsc);
} else {
table->field[15]->set_null();
table->field[15]->reset();
table->field[SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS]->set_null();
table->field[SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS]->reset();
}
if (conn->tgt_default_file)
{
table->field[16]->set_notnull();
table->field[16]->store(
table->field[SPIDER_XA_MEMBER_DEFAULT_FILE_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_DEFAULT_FILE_POS]->store(
conn->tgt_default_file,
(uint) conn->tgt_default_file_length,
system_charset_info);
} else {
table->field[16]->set_null();
table->field[16]->reset();
table->field[SPIDER_XA_MEMBER_DEFAULT_FILE_POS]->set_null();
table->field[SPIDER_XA_MEMBER_DEFAULT_FILE_POS]->reset();
}
if (conn->tgt_default_group)
{
table->field[17]->set_notnull();
table->field[17]->store(
table->field[SPIDER_XA_MEMBER_DEFAULT_GROUP_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_DEFAULT_GROUP_POS]->store(
conn->tgt_default_group,
(uint) conn->tgt_default_group_length,
system_charset_info);
} else {
table->field[17]->set_null();
table->field[17]->reset();
table->field[SPIDER_XA_MEMBER_DEFAULT_GROUP_POS]->set_null();
table->field[SPIDER_XA_MEMBER_DEFAULT_GROUP_POS]->reset();
}
if (conn->tgt_dsn)
{
table->field[SPIDER_XA_MEMBER_DSN_POS]->set_notnull();
table->field[SPIDER_XA_MEMBER_DSN_POS]->store(
conn->tgt_dsn,
(uint) conn->tgt_dsn_length,
system_charset_info);
} else {
table->field[SPIDER_XA_MEMBER_DSN_POS]->set_null();
table->field[SPIDER_XA_MEMBER_DSN_POS]->reset();
}
DBUG_VOID_RETURN;
}
......@@ -1017,18 +1135,20 @@ void spider_store_tables_name(
ptr_table = "";
ptr_diff_table = 1;
}
table->field[0]->store(
table->field[SPIDER_TABLES_DB_NAME_POS]->store(
ptr_db,
(uint)(ptr_diff_table - 1),
system_charset_info);
DBUG_PRINT("info",("spider field[0]->null_bit = %d",
table->field[0]->null_bit));
table->field[1]->store(
DBUG_PRINT("info",("spider field[%u]->null_bit = %d",
SPIDER_TABLES_DB_NAME_POS,
table->field[SPIDER_TABLES_DB_NAME_POS]->null_bit));
table->field[SPIDER_TABLES_TABLE_NAME_POS]->store(
ptr_table,
(uint) ((my_ptrdiff_t) name_length - ptr_diff_db - ptr_diff_table),
system_charset_info);
DBUG_PRINT("info",("spider field[1]->null_bit = %d",
table->field[1]->null_bit));
DBUG_PRINT("info",("spider field[%u]->null_bit = %d",
SPIDER_TABLES_TABLE_NAME_POS,
table->field[SPIDER_TABLES_TABLE_NAME_POS]->null_bit));
DBUG_VOID_RETURN;
}
......@@ -1040,18 +1160,20 @@ void spider_store_db_and_table_name(
const uint table_name_length
) {
DBUG_ENTER("spider_store_db_and_table_name");
table->field[0]->store(
table->field[SPIDER_TABLES_DB_NAME_POS]->store(
db_name,
db_name_length,
system_charset_info);
DBUG_PRINT("info",("spider field[0]->null_bit = %d",
table->field[0]->null_bit));
table->field[1]->store(
DBUG_PRINT("info",("spider field[%u]->null_bit = %d",
SPIDER_TABLES_DB_NAME_POS,
table->field[SPIDER_TABLES_DB_NAME_POS]->null_bit));
table->field[SPIDER_TABLES_TABLE_NAME_POS]->store(
table_name,
table_name_length,
system_charset_info);
DBUG_PRINT("info",("spider field[1]->null_bit = %d",
table->field[1]->null_bit));
DBUG_PRINT("info",("spider field[%u]->null_bit = %d",
SPIDER_TABLES_TABLE_NAME_POS,
table->field[SPIDER_TABLES_TABLE_NAME_POS]->null_bit));
DBUG_VOID_RETURN;
}
......@@ -1060,8 +1182,8 @@ void spider_store_tables_link_idx(
int link_idx
) {
DBUG_ENTER("spider_store_tables_link_idx");
table->field[2]->set_notnull();
table->field[2]->store(link_idx);
table->field[SPIDER_TABLES_LINK_ID_POS]->set_notnull();
table->field[SPIDER_TABLES_LINK_ID_POS]->store(link_idx);
DBUG_VOID_RETURN;
}
......@@ -1071,12 +1193,13 @@ void spider_store_tables_link_idx_str(
const uint link_idx_length
) {
DBUG_ENTER("spider_store_tables_link_idx_str");
table->field[2]->store(
table->field[SPIDER_TABLES_LINK_ID_POS]->store(
link_idx,
link_idx_length,
system_charset_info);
DBUG_PRINT("info",("spider field[2]->null_bit = %d",
table->field[2]->null_bit));
DBUG_PRINT("info",("spider field[%u]->null_bit = %d",
SPIDER_TABLES_LINK_ID_POS,
table->field[SPIDER_TABLES_LINK_ID_POS]->null_bit));
DBUG_VOID_RETURN;
}
......@@ -1088,14 +1211,14 @@ void spider_store_tables_static_link_id(
DBUG_ENTER("spider_store_tables_static_link_id");
if (static_link_id)
{
table->field[24]->set_notnull();
table->field[24]->store(
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->set_notnull();
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->store(
static_link_id,
static_link_id_length,
system_charset_info);
} else {
table->field[24]->set_null();
table->field[24]->reset();
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->set_null();
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->reset();
}
DBUG_VOID_RETURN;
}
......@@ -1106,7 +1229,7 @@ void spider_store_tables_priority(
) {
DBUG_ENTER("spider_store_tables_priority");
DBUG_PRINT("info",("spider priority = %lld", priority));
table->field[3]->store(priority, FALSE);
table->field[SPIDER_TABLES_PRIORITY_POS]->store(priority, FALSE);
DBUG_VOID_RETURN;
}
......@@ -1118,209 +1241,221 @@ void spider_store_tables_connect_info(
DBUG_ENTER("spider_store_tables_connect_info");
if (alter_table->tmp_server_names[link_idx])
{
table->field[4]->set_notnull();
table->field[4]->store(
table->field[SPIDER_TABLES_SERVER_POS]->set_notnull();
table->field[SPIDER_TABLES_SERVER_POS]->store(
alter_table->tmp_server_names[link_idx],
(uint) alter_table->tmp_server_names_lengths[link_idx],
system_charset_info);
} else {
table->field[4]->set_null();
table->field[4]->reset();
table->field[SPIDER_TABLES_SERVER_POS]->set_null();
table->field[SPIDER_TABLES_SERVER_POS]->reset();
}
if (alter_table->tmp_tgt_wrappers[link_idx])
{
table->field[5]->set_notnull();
table->field[5]->store(
table->field[SPIDER_TABLES_SCHEME_POS]->set_notnull();
table->field[SPIDER_TABLES_SCHEME_POS]->store(
alter_table->tmp_tgt_wrappers[link_idx],
(uint) alter_table->tmp_tgt_wrappers_lengths[link_idx],
system_charset_info);
} else {
table->field[5]->set_null();
table->field[5]->reset();
table->field[SPIDER_TABLES_SCHEME_POS]->set_null();
table->field[SPIDER_TABLES_SCHEME_POS]->reset();
}
if (alter_table->tmp_tgt_hosts[link_idx])
{
table->field[6]->set_notnull();
table->field[6]->store(
table->field[SPIDER_TABLES_HOST_POS]->set_notnull();
table->field[SPIDER_TABLES_HOST_POS]->store(
alter_table->tmp_tgt_hosts[link_idx],
(uint) alter_table->tmp_tgt_hosts_lengths[link_idx],
system_charset_info);
} else {
table->field[6]->set_null();
table->field[6]->reset();
table->field[SPIDER_TABLES_HOST_POS]->set_null();
table->field[SPIDER_TABLES_HOST_POS]->reset();
}
if (alter_table->tmp_tgt_ports[link_idx] >= 0)
{
table->field[7]->set_notnull();
table->field[7]->store(
table->field[SPIDER_TABLES_PORT_POS]->set_notnull();
table->field[SPIDER_TABLES_PORT_POS]->store(
alter_table->tmp_tgt_ports[link_idx]);
} else {
table->field[7]->set_null();
table->field[7]->reset();
table->field[SPIDER_TABLES_PORT_POS]->set_null();
table->field[SPIDER_TABLES_PORT_POS]->reset();
}
if (alter_table->tmp_tgt_sockets[link_idx])
{
table->field[8]->set_notnull();
table->field[8]->store(
table->field[SPIDER_TABLES_SOCKET_POS]->set_notnull();
table->field[SPIDER_TABLES_SOCKET_POS]->store(
alter_table->tmp_tgt_sockets[link_idx],
(uint) alter_table->tmp_tgt_sockets_lengths[link_idx],
system_charset_info);
} else {
table->field[8]->set_null();
table->field[8]->reset();
table->field[SPIDER_TABLES_SOCKET_POS]->set_null();
table->field[SPIDER_TABLES_SOCKET_POS]->reset();
}
if (alter_table->tmp_tgt_usernames[link_idx])
{
table->field[9]->set_notnull();
table->field[9]->store(
table->field[SPIDER_TABLES_USERNAME_POS]->set_notnull();
table->field[SPIDER_TABLES_USERNAME_POS]->store(
alter_table->tmp_tgt_usernames[link_idx],
(uint) alter_table->tmp_tgt_usernames_lengths[link_idx],
system_charset_info);
} else {
table->field[9]->set_null();
table->field[9]->reset();
table->field[SPIDER_TABLES_USERNAME_POS]->set_null();
table->field[SPIDER_TABLES_USERNAME_POS]->reset();
}
if (alter_table->tmp_tgt_passwords[link_idx])
{
table->field[10]->set_notnull();
table->field[10]->store(
table->field[SPIDER_TABLES_PASSWORD_POS]->set_notnull();
table->field[SPIDER_TABLES_PASSWORD_POS]->store(
alter_table->tmp_tgt_passwords[link_idx],
(uint) alter_table->tmp_tgt_passwords_lengths[link_idx],
system_charset_info);
} else {
table->field[10]->set_null();
table->field[10]->reset();
table->field[SPIDER_TABLES_PASSWORD_POS]->set_null();
table->field[SPIDER_TABLES_PASSWORD_POS]->reset();
}
if (alter_table->tmp_tgt_ssl_cas[link_idx])
{
table->field[11]->set_notnull();
table->field[11]->store(
table->field[SPIDER_TABLES_SSL_CA_POS]->set_notnull();
table->field[SPIDER_TABLES_SSL_CA_POS]->store(
alter_table->tmp_tgt_ssl_cas[link_idx],
(uint) alter_table->tmp_tgt_ssl_cas_lengths[link_idx],
system_charset_info);
} else {
table->field[11]->set_null();
table->field[11]->reset();
table->field[SPIDER_TABLES_SSL_CA_POS]->set_null();
table->field[SPIDER_TABLES_SSL_CA_POS]->reset();
}
if (alter_table->tmp_tgt_ssl_capaths[link_idx])
{
table->field[12]->set_notnull();
table->field[12]->store(
table->field[SPIDER_TABLES_SSL_CAPATH_POS]->set_notnull();
table->field[SPIDER_TABLES_SSL_CAPATH_POS]->store(
alter_table->tmp_tgt_ssl_capaths[link_idx],
(uint) alter_table->tmp_tgt_ssl_capaths_lengths[link_idx],
system_charset_info);
} else {
table->field[12]->set_null();
table->field[12]->reset();
table->field[SPIDER_TABLES_SSL_CAPATH_POS]->set_null();
table->field[SPIDER_TABLES_SSL_CAPATH_POS]->reset();
}
if (alter_table->tmp_tgt_ssl_certs[link_idx])
{
table->field[13]->set_notnull();
table->field[13]->store(
table->field[SPIDER_TABLES_SSL_CERT_POS]->set_notnull();
table->field[SPIDER_TABLES_SSL_CERT_POS]->store(
alter_table->tmp_tgt_ssl_certs[link_idx],
(uint) alter_table->tmp_tgt_ssl_certs_lengths[link_idx],
system_charset_info);
} else {
table->field[13]->set_null();
table->field[13]->reset();
table->field[SPIDER_TABLES_SSL_CERT_POS]->set_null();
table->field[SPIDER_TABLES_SSL_CERT_POS]->reset();
}
if (alter_table->tmp_tgt_ssl_ciphers[link_idx])
{
table->field[14]->set_notnull();
table->field[14]->store(
table->field[SPIDER_TABLES_SSL_CIPHER_POS]->set_notnull();
table->field[SPIDER_TABLES_SSL_CIPHER_POS]->store(
alter_table->tmp_tgt_ssl_ciphers[link_idx],
(uint) alter_table->tmp_tgt_ssl_ciphers_lengths[link_idx],
system_charset_info);
} else {
table->field[14]->set_null();
table->field[14]->reset();
table->field[SPIDER_TABLES_SSL_CIPHER_POS]->set_null();
table->field[SPIDER_TABLES_SSL_CIPHER_POS]->reset();
}
if (alter_table->tmp_tgt_ssl_keys[link_idx])
{
table->field[15]->set_notnull();
table->field[15]->store(
table->field[SPIDER_TABLES_SSL_KEY_POS]->set_notnull();
table->field[SPIDER_TABLES_SSL_KEY_POS]->store(
alter_table->tmp_tgt_ssl_keys[link_idx],
(uint) alter_table->tmp_tgt_ssl_keys_lengths[link_idx],
system_charset_info);
} else {
table->field[15]->set_null();
table->field[15]->reset();
table->field[SPIDER_TABLES_SSL_KEY_POS]->set_null();
table->field[SPIDER_TABLES_SSL_KEY_POS]->reset();
}
if (alter_table->tmp_tgt_ssl_vscs[link_idx] >= 0)
{
table->field[16]->set_notnull();
table->field[16]->store(
table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]->set_notnull();
table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]->store(
alter_table->tmp_tgt_ssl_vscs[link_idx]);
} else {
table->field[16]->set_null();
table->field[16]->reset();
table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]->set_null();
table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]->reset();
}
table->field[17]->set_notnull();
table->field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS]->
set_notnull();
if (alter_table->tmp_monitoring_binlog_pos_at_failing[link_idx] >= 0)
{
table->field[17]->store(
table->field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS]->store(
alter_table->tmp_monitoring_binlog_pos_at_failing[link_idx]);
} else {
table->field[17]->store(0);
table->field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS]->store(0);
}
if (alter_table->tmp_tgt_default_files[link_idx])
{
table->field[18]->set_notnull();
table->field[18]->store(
table->field[SPIDER_TABLES_DEFAULT_FILE_POS]->set_notnull();
table->field[SPIDER_TABLES_DEFAULT_FILE_POS]->store(
alter_table->tmp_tgt_default_files[link_idx],
(uint) alter_table->tmp_tgt_default_files_lengths[link_idx],
system_charset_info);
} else {
table->field[18]->set_null();
table->field[18]->reset();
table->field[SPIDER_TABLES_DEFAULT_FILE_POS]->set_null();
table->field[SPIDER_TABLES_DEFAULT_FILE_POS]->reset();
}
if (alter_table->tmp_tgt_default_groups[link_idx])
{
table->field[19]->set_notnull();
table->field[19]->store(
table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]->set_notnull();
table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]->store(
alter_table->tmp_tgt_default_groups[link_idx],
(uint) alter_table->tmp_tgt_default_groups_lengths[link_idx],
system_charset_info);
} else {
table->field[19]->set_null();
table->field[19]->reset();
table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]->set_null();
table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]->reset();
}
if (alter_table->tmp_tgt_dsns[link_idx])
{
table->field[SPIDER_TABLES_DSN_POS]->set_notnull();
table->field[SPIDER_TABLES_DSN_POS]->store(
alter_table->tmp_tgt_dsns[link_idx],
(uint) alter_table->tmp_tgt_dsns_lengths[link_idx],
system_charset_info);
} else {
table->field[SPIDER_TABLES_DSN_POS]->set_null();
table->field[SPIDER_TABLES_DSN_POS]->reset();
}
if (alter_table->tmp_tgt_dbs[link_idx])
{
table->field[20]->set_notnull();
table->field[20]->store(
table->field[SPIDER_TABLES_TGT_DB_NAME_POS]->set_notnull();
table->field[SPIDER_TABLES_TGT_DB_NAME_POS]->store(
alter_table->tmp_tgt_dbs[link_idx],
(uint) alter_table->tmp_tgt_dbs_lengths[link_idx],
system_charset_info);
} else {
table->field[20]->set_null();
table->field[20]->reset();
table->field[SPIDER_TABLES_TGT_DB_NAME_POS]->set_null();
table->field[SPIDER_TABLES_TGT_DB_NAME_POS]->reset();
}
if (alter_table->tmp_tgt_table_names[link_idx])
{
table->field[21]->set_notnull();
table->field[21]->store(
table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]->set_notnull();
table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]->store(
alter_table->tmp_tgt_table_names[link_idx],
(uint) alter_table->tmp_tgt_table_names_lengths[link_idx],
system_charset_info);
} else {
table->field[21]->set_null();
table->field[21]->reset();
table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]->set_null();
table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]->reset();
}
table->field[23]->store((longlong) 0, FALSE);
table->field[SPIDER_TABLES_BLOCK_STATUS_POS]->store((longlong) 0, FALSE);
if (alter_table->tmp_static_link_ids[link_idx])
{
DBUG_PRINT("info",("spider static_link_id[%d] = %s",
link_idx, alter_table->tmp_static_link_ids[link_idx]));
table->field[24]->set_notnull();
table->field[24]->store(
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->set_notnull();
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->store(
alter_table->tmp_static_link_ids[link_idx],
(uint) alter_table->tmp_static_link_ids_lengths[link_idx],
system_charset_info);
} else {
DBUG_PRINT("info",("spider static_link_id[%d] = NULL", link_idx));
table->field[24]->set_null();
table->field[24]->reset();
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->set_null();
table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->reset();
}
DBUG_VOID_RETURN;
}
......@@ -1332,17 +1467,7 @@ void spider_store_tables_link_status(
DBUG_ENTER("spider_store_tables_link_status");
DBUG_PRINT("info",("spider link_status = %ld", link_status));
if (link_status > SPIDER_LINK_STATUS_NO_CHANGE)
table->field[22]->store(link_status, FALSE);
DBUG_VOID_RETURN;
}
void spider_store_link_chk_server_id(
TABLE *table,
uint32 server_id
) {
DBUG_ENTER("spider_store_link_chk_server_id");
table->field[3]->set_notnull();
table->field[3]->store(server_id);
table->field[SPIDER_TABLES_LINK_STATUS_POS]->store(link_status, FALSE);
DBUG_VOID_RETURN;
}
......@@ -1351,8 +1476,10 @@ void spider_store_binlog_pos_failed_link_idx(
int failed_link_idx
) {
DBUG_ENTER("spider_store_binlog_pos_failed_link_idx");
table->field[2]->set_notnull();
table->field[2]->store(failed_link_idx);
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_FAILED_LINK_ID_POS]->
set_notnull();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_FAILED_LINK_ID_POS]->
store(failed_link_idx);
DBUG_VOID_RETURN;
}
......@@ -1361,8 +1488,10 @@ void spider_store_binlog_pos_source_link_idx(
int source_link_idx
) {
DBUG_ENTER("spider_store_binlog_pos_source_link_idx");
table->field[3]->set_notnull();
table->field[3]->store(source_link_idx);
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_SOURCE_LINK_ID_POS]->
set_notnull();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_SOURCE_LINK_ID_POS]->
store(source_link_idx);
DBUG_VOID_RETURN;
}
......@@ -1378,22 +1507,25 @@ void spider_store_binlog_pos_binlog_file(
if (!file_name)
{
DBUG_PRINT("info",("spider file_name is NULL"));
table->field[4]->set_null();
table->field[4]->reset();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_FILE_POS]->set_null();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_FILE_POS]->reset();
} else {
DBUG_PRINT("info",("spider file_name = %s", file_name));
table->field[4]->set_notnull();
table->field[4]->store(file_name, file_name_length, binlog_pos_cs);
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_FILE_POS]->set_notnull();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_FILE_POS]->store(
file_name, file_name_length, binlog_pos_cs);
}
if (!position)
{
DBUG_PRINT("info",("spider position is NULL"));
table->field[5]->set_null();
table->field[5]->reset();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_POSITION_POS]->set_null();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_POSITION_POS]->reset();
} else {
DBUG_PRINT("info",("spider position = %s", position));
table->field[5]->set_notnull();
table->field[5]->store(position, position_length, binlog_pos_cs);
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_POSITION_POS]->
set_notnull();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_POSITION_POS]->store(
position, position_length, binlog_pos_cs);
}
DBUG_VOID_RETURN;
}
......@@ -1408,12 +1540,13 @@ void spider_store_binlog_pos_gtid(
if (!gtid)
{
DBUG_PRINT("info",("spider gtid is NULL"));
table->field[6]->set_null();
table->field[6]->reset();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_GTID_POS]->set_null();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_GTID_POS]->reset();
} else {
DBUG_PRINT("info",("spider gtid = %s", gtid));
table->field[6]->set_notnull();
table->field[6]->store(gtid, gtid_length, binlog_pos_cs);
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_GTID_POS]->set_notnull();
table->field[SPIDER_TABLE_POSITION_FOR_RECOVERY_GTID_POS]->store(
gtid, gtid_length, binlog_pos_cs);
}
DBUG_VOID_RETURN;
}
......@@ -1424,24 +1557,30 @@ void spider_store_table_sts_info(
) {
MYSQL_TIME mysql_time;
DBUG_ENTER("spider_store_table_sts_info");
table->field[2]->store((longlong) stat->data_file_length, TRUE);
table->field[3]->store((longlong) stat->max_data_file_length, TRUE);
table->field[4]->store((longlong) stat->index_file_length, TRUE);
table->field[5]->store((longlong) stat->records, TRUE);
table->field[6]->store((longlong) stat->mean_rec_length, TRUE);
table->field[SPIDER_TABLE_STS_DATA_FILE_LENGTH_POS]->store(
(longlong) stat->data_file_length, TRUE);
table->field[SPIDER_TABLE_STS_MAX_DATA_FILE_LENGTH_POS]->store(
(longlong) stat->max_data_file_length, TRUE);
table->field[SPIDER_TABLE_STS_INDEX_FILE_LENGTH_POS]->store(
(longlong) stat->index_file_length, TRUE);
table->field[SPIDER_TABLE_STS_RECORDS_POS]->store(
(longlong) stat->records, TRUE);
table->field[SPIDER_TABLE_STS_MEAN_REC_LENGTH_POS]->store(
(longlong) stat->mean_rec_length, TRUE);
spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) stat->check_time);
table->field[7]->store_time(&mysql_time);
table->field[SPIDER_TABLE_STS_CHECK_TIME_POS]->store_time(&mysql_time);
spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) stat->create_time);
table->field[8]->store_time(&mysql_time);
table->field[SPIDER_TABLE_STS_CREATE_TIME_POS]->store_time(&mysql_time);
spd_tz_system->gmt_sec_to_TIME(&mysql_time, (my_time_t) stat->update_time);
table->field[9]->store_time(&mysql_time);
table->field[SPIDER_TABLE_STS_UPDATE_TIME_POS]->store_time(&mysql_time);
if (stat->checksum_null)
{
table->field[10]->set_null();
table->field[10]->reset();
table->field[SPIDER_TABLE_STS_CHECKSUM_POS]->set_null();
table->field[SPIDER_TABLE_STS_CHECKSUM_POS]->reset();
} else {
table->field[10]->set_notnull();
table->field[10]->store((longlong) stat->checksum, TRUE);
table->field[SPIDER_TABLE_STS_CHECKSUM_POS]->set_notnull();
table->field[SPIDER_TABLE_STS_CHECKSUM_POS]->store(
(longlong) stat->checksum, TRUE);
}
DBUG_VOID_RETURN;
}
......@@ -1452,8 +1591,9 @@ void spider_store_table_crd_info(
longlong *cardinality
) {
DBUG_ENTER("spider_store_table_crd_info");
table->field[2]->store((longlong) *seq, TRUE);
table->field[3]->store((longlong) *cardinality, FALSE);
table->field[SPIDER_TABLE_CRD_KEY_SEQ_POS]->store((longlong) *seq, TRUE);
table->field[SPIDER_TABLE_CRD_CARDINALITY_POS]->store(
(longlong) *cardinality, FALSE);
DBUG_VOID_RETURN;
}
......@@ -1653,7 +1793,8 @@ int spider_log_tables_link_failed(
spider_store_tables_link_idx(table, link_idx);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
if (table->field[3] == table->timestamp_field)
if (table->field[SPIDER_LINK_FAILED_LOG_FAILED_TIME_POS] ==
table->timestamp_field)
table->timestamp_field->set_time();
#endif
if ((error_num = spider_write_sys_table_row(table)))
......@@ -1677,20 +1818,22 @@ int spider_log_xa_failed(
spider_store_xa_member_info(table, xid, conn);
if (thd)
{
table->field[18]->set_notnull();
table->field[18]->store(thd->thread_id, TRUE);
table->field[SPIDER_XA_FAILED_LOG_THREAD_ID_POS]->set_notnull();
table->field[SPIDER_XA_FAILED_LOG_THREAD_ID_POS]->store(
thd->thread_id, TRUE);
} else {
table->field[18]->set_null();
table->field[18]->reset();
table->field[SPIDER_XA_FAILED_LOG_THREAD_ID_POS]->set_null();
table->field[SPIDER_XA_FAILED_LOG_THREAD_ID_POS]->reset();
}
table->field[19]->store(
table->field[SPIDER_XA_FAILED_LOG_STATUS_POS]->store(
status,
(uint) strlen(status),
system_charset_info);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
if (table->field[20] == table->timestamp_field)
if (table->field[SPIDER_XA_FAILED_LOG_FAILED_TIME_POS] ==
table->timestamp_field)
table->timestamp_field->set_time();
#endif
if ((error_num = spider_write_sys_table_row(table)))
......@@ -2080,25 +2223,25 @@ int spider_get_sys_xid(
) {
char *ptr;
DBUG_ENTER("spider_get_sys_xid");
ptr = get_field(mem_root, table->field[0]);
ptr = get_field(mem_root, table->field[SPIDER_XA_FORMAT_ID_POS]);
if (ptr)
{
xid->formatID = atoi(ptr);
} else
xid->formatID = 0;
ptr = get_field(mem_root, table->field[1]);
ptr = get_field(mem_root, table->field[SPIDER_XA_GTRID_LENGTH_POS]);
if (ptr)
{
xid->gtrid_length = atoi(ptr);
} else
xid->gtrid_length = 0;
ptr = get_field(mem_root, table->field[2]);
ptr = get_field(mem_root, table->field[SPIDER_XA_BQUAL_LENGTH_POS]);
if (ptr)
{
xid->bqual_length = atoi(ptr);
} else
xid->bqual_length = 0;
ptr = get_field(mem_root, table->field[3]);
ptr = get_field(mem_root, table->field[SPIDER_XA_DATA_POS]);
if (ptr)
{
strmov(xid->data, ptr);
......@@ -2114,7 +2257,7 @@ int spider_get_sys_server_info(
) {
char *ptr;
DBUG_ENTER("spider_get_sys_server_info");
if ((ptr = get_field(mem_root, table->field[4])))
if ((ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SCHEME_POS])))
{
share->tgt_wrappers_lengths[link_idx] = strlen(ptr);
share->tgt_wrappers[link_idx] = spider_create_string(ptr,
......@@ -2123,7 +2266,7 @@ int spider_get_sys_server_info(
share->tgt_wrappers_lengths[link_idx] = 0;
share->tgt_wrappers[link_idx] = NULL;
}
if ((ptr = get_field(mem_root, table->field[5])))
if ((ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_HOST_POS])))
{
share->tgt_hosts_lengths[link_idx] = strlen(ptr);
share->tgt_hosts[link_idx] = spider_create_string(ptr,
......@@ -2132,12 +2275,12 @@ int spider_get_sys_server_info(
share->tgt_hosts_lengths[link_idx] = 0;
share->tgt_hosts[link_idx] = NULL;
}
if ((ptr = get_field(mem_root, table->field[6])))
if ((ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_PORT_POS])))
{
share->tgt_ports[link_idx] = atol(ptr);
} else
share->tgt_ports[link_idx] = MYSQL_PORT;
if ((ptr = get_field(mem_root, table->field[7])))
if ((ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SOCKET_POS])))
{
share->tgt_sockets_lengths[link_idx] = strlen(ptr);
share->tgt_sockets[link_idx] = spider_create_string(ptr,
......@@ -2146,7 +2289,7 @@ int spider_get_sys_server_info(
share->tgt_sockets_lengths[link_idx] = 0;
share->tgt_sockets[link_idx] = NULL;
}
if ((ptr = get_field(mem_root, table->field[8])))
if ((ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_USERNAME_POS])))
{
share->tgt_usernames_lengths[link_idx] = strlen(ptr);
share->tgt_usernames[link_idx] =
......@@ -2155,7 +2298,7 @@ int spider_get_sys_server_info(
share->tgt_usernames_lengths[link_idx] = 0;
share->tgt_usernames[link_idx] = NULL;
}
if ((ptr = get_field(mem_root, table->field[9])))
if ((ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_PASSWORD_POS])))
{
share->tgt_passwords_lengths[link_idx] = strlen(ptr);
share->tgt_passwords[link_idx] =
......@@ -2165,8 +2308,8 @@ int spider_get_sys_server_info(
share->tgt_passwords[link_idx] = NULL;
}
if (
!table->field[10]->is_null() &&
(ptr = get_field(mem_root, table->field[10]))
!table->field[SPIDER_XA_MEMBER_SSL_CA_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SSL_CA_POS]))
) {
share->tgt_ssl_cas_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_cas[link_idx] =
......@@ -2176,8 +2319,8 @@ int spider_get_sys_server_info(
share->tgt_ssl_cas[link_idx] = NULL;
}
if (
!table->field[11]->is_null() &&
(ptr = get_field(mem_root, table->field[11]))
!table->field[SPIDER_XA_MEMBER_SSL_CAPATH_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SSL_CAPATH_POS]))
) {
share->tgt_ssl_capaths_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_capaths[link_idx] =
......@@ -2187,8 +2330,8 @@ int spider_get_sys_server_info(
share->tgt_ssl_capaths[link_idx] = NULL;
}
if (
!table->field[12]->is_null() &&
(ptr = get_field(mem_root, table->field[12]))
!table->field[SPIDER_XA_MEMBER_SSL_CERT_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SSL_CERT_POS]))
) {
share->tgt_ssl_certs_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_certs[link_idx] =
......@@ -2198,8 +2341,8 @@ int spider_get_sys_server_info(
share->tgt_ssl_certs[link_idx] = NULL;
}
if (
!table->field[13]->is_null() &&
(ptr = get_field(mem_root, table->field[13]))
!table->field[SPIDER_XA_MEMBER_SSL_CIPHER_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SSL_CIPHER_POS]))
) {
share->tgt_ssl_ciphers_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_ciphers[link_idx] =
......@@ -2209,8 +2352,8 @@ int spider_get_sys_server_info(
share->tgt_ssl_ciphers[link_idx] = NULL;
}
if (
!table->field[14]->is_null() &&
(ptr = get_field(mem_root, table->field[14]))
!table->field[SPIDER_XA_MEMBER_SSL_KEY_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_SSL_KEY_POS]))
) {
share->tgt_ssl_keys_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_keys[link_idx] =
......@@ -2220,15 +2363,17 @@ int spider_get_sys_server_info(
share->tgt_ssl_keys[link_idx] = NULL;
}
if (
!table->field[15]->is_null() &&
(ptr = get_field(mem_root, table->field[15]))
!table->field[SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS]->is_null() &&
(ptr = get_field(mem_root, table->
field[SPIDER_XA_MEMBER_SSL_VERIFY_SERVER_CERT_POS]))
) {
share->tgt_ssl_vscs[link_idx] = atol(ptr);
} else
share->tgt_ssl_vscs[link_idx] = 0;
if (
!table->field[16]->is_null() &&
(ptr = get_field(mem_root, table->field[16]))
!table->field[SPIDER_XA_MEMBER_DEFAULT_FILE_POS]->is_null() &&
(ptr = get_field(mem_root, table->
field[SPIDER_XA_MEMBER_DEFAULT_FILE_POS]))
) {
share->tgt_default_files_lengths[link_idx] = strlen(ptr);
share->tgt_default_files[link_idx] =
......@@ -2238,8 +2383,9 @@ int spider_get_sys_server_info(
share->tgt_default_files[link_idx] = NULL;
}
if (
!table->field[17]->is_null() &&
(ptr = get_field(mem_root, table->field[17]))
!table->field[SPIDER_XA_MEMBER_DEFAULT_GROUP_POS]->is_null() &&
(ptr = get_field(mem_root, table->
field[SPIDER_XA_MEMBER_DEFAULT_GROUP_POS]))
) {
share->tgt_default_groups_lengths[link_idx] = strlen(ptr);
share->tgt_default_groups[link_idx] =
......@@ -2248,6 +2394,17 @@ int spider_get_sys_server_info(
share->tgt_default_groups_lengths[link_idx] = 0;
share->tgt_default_groups[link_idx] = NULL;
}
if (
!table->field[SPIDER_XA_MEMBER_DSN_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_XA_MEMBER_DSN_POS]))
) {
share->tgt_dsns_lengths[link_idx] = strlen(ptr);
share->tgt_dsns[link_idx] =
spider_create_string(ptr, share->tgt_dsns_lengths[link_idx]);
} else {
share->tgt_dsns_lengths[link_idx] = 0;
share->tgt_dsns[link_idx] = NULL;
}
DBUG_RETURN(0);
}
......@@ -2262,7 +2419,7 @@ int spider_check_sys_xa_status(
char *ptr;
int error_num;
DBUG_ENTER("spider_check_sys_xa_status");
ptr = get_field(mem_root, table->field[4]);
ptr = get_field(mem_root, table->field[SPIDER_XA_STATUS_POS]);
if (ptr)
{
if (
......@@ -2286,13 +2443,13 @@ int spider_get_sys_tables(
) {
char *ptr;
DBUG_ENTER("spider_get_sys_tables");
if ((ptr = get_field(mem_root, table->field[0])))
if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_DB_NAME_POS])))
{
*db_name = spider_create_string(ptr, strlen(ptr));
} else {
*db_name = NULL;
}
if ((ptr = get_field(mem_root, table->field[1])))
if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_TABLE_NAME_POS])))
{
*table_name = spider_create_string(ptr, strlen(ptr));
} else {
......@@ -2310,55 +2467,67 @@ int spider_get_sys_tables_connect_info(
char *ptr;
int error_num = 0;
DBUG_ENTER("spider_get_sys_tables_connect_info");
if ((ptr = get_field(mem_root, table->field[3])))
DBUG_PRINT("info",("spider link_idx:%d", link_idx));
if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_PRIORITY_POS])))
{
share->priority = my_strtoll10(ptr, (char**) NULL, &error_num);
} else
share->priority = 1000000;
DBUG_PRINT("info",("spider priority:%lld", share->priority));
if (
!table->field[4]->is_null() &&
(ptr = get_field(mem_root, table->field[4]))
!table->field[SPIDER_TABLES_SERVER_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SERVER_POS]))
) {
share->server_names_lengths[link_idx] = strlen(ptr);
share->server_names[link_idx] =
spider_create_string(ptr, share->server_names_lengths[link_idx]);
DBUG_PRINT("info",("spider server_name:%s",
share->server_names[link_idx]));
} else {
share->server_names_lengths[link_idx] = 0;
share->server_names[link_idx] = NULL;
DBUG_PRINT("info",("spider server_name is NULL"));
}
if (
!table->field[5]->is_null() &&
(ptr = get_field(mem_root, table->field[5]))
!table->field[SPIDER_TABLES_SCHEME_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SCHEME_POS]))
) {
share->tgt_wrappers_lengths[link_idx] = strlen(ptr);
share->tgt_wrappers[link_idx] =
spider_create_string(ptr, share->tgt_wrappers_lengths[link_idx]);
DBUG_PRINT("info",("spider tgt_wrapper:%s",
share->tgt_wrappers[link_idx]));
} else {
share->tgt_wrappers_lengths[link_idx] = 0;
share->tgt_wrappers[link_idx] = NULL;
DBUG_PRINT("info",("spider tgt_wrapper is NULL"));
}
if (
!table->field[6]->is_null() &&
(ptr = get_field(mem_root, table->field[6]))
!table->field[SPIDER_TABLES_HOST_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_HOST_POS]))
) {
share->tgt_hosts_lengths[link_idx] = strlen(ptr);
share->tgt_hosts[link_idx] =
spider_create_string(ptr, share->tgt_hosts_lengths[link_idx]);
DBUG_PRINT("info",("spider tgt_host:%s",
share->tgt_hosts[link_idx]));
} else {
share->tgt_hosts_lengths[link_idx] = 0;
share->tgt_hosts[link_idx] = NULL;
DBUG_PRINT("info",("spider tgt_host is NULL"));
}
if (
!table->field[7]->is_null() &&
(ptr = get_field(mem_root, table->field[7]))
!table->field[SPIDER_TABLES_PORT_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_PORT_POS]))
) {
share->tgt_ports[link_idx] = atol(ptr);
} else {
share->tgt_ports[link_idx] = -1;
}
DBUG_PRINT("info",("spider port:%ld", share->tgt_ports[link_idx]));
if (
!table->field[8]->is_null() &&
(ptr = get_field(mem_root, table->field[8]))
!table->field[SPIDER_TABLES_SOCKET_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SOCKET_POS]))
) {
share->tgt_sockets_lengths[link_idx] = strlen(ptr);
share->tgt_sockets[link_idx] =
......@@ -2368,8 +2537,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_sockets[link_idx] = NULL;
}
if (
!table->field[9]->is_null() &&
(ptr = get_field(mem_root, table->field[9]))
!table->field[SPIDER_TABLES_USERNAME_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_USERNAME_POS]))
) {
share->tgt_usernames_lengths[link_idx] = strlen(ptr);
share->tgt_usernames[link_idx] =
......@@ -2379,8 +2548,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_usernames[link_idx] = NULL;
}
if (
!table->field[10]->is_null() &&
(ptr = get_field(mem_root, table->field[10]))
!table->field[SPIDER_TABLES_PASSWORD_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_PASSWORD_POS]))
) {
share->tgt_passwords_lengths[link_idx] = strlen(ptr);
share->tgt_passwords[link_idx] =
......@@ -2390,8 +2559,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_passwords[link_idx] = NULL;
}
if (
!table->field[11]->is_null() &&
(ptr = get_field(mem_root, table->field[11]))
!table->field[SPIDER_TABLES_SSL_CA_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CA_POS]))
) {
share->tgt_ssl_cas_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_cas[link_idx] =
......@@ -2401,8 +2570,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_ssl_cas[link_idx] = NULL;
}
if (
!table->field[12]->is_null() &&
(ptr = get_field(mem_root, table->field[12]))
!table->field[SPIDER_TABLES_SSL_CAPATH_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CAPATH_POS]))
) {
share->tgt_ssl_capaths_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_capaths[link_idx] =
......@@ -2412,8 +2581,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_ssl_capaths[link_idx] = NULL;
}
if (
!table->field[13]->is_null() &&
(ptr = get_field(mem_root, table->field[13]))
!table->field[SPIDER_TABLES_SSL_CERT_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CERT_POS]))
) {
share->tgt_ssl_certs_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_certs[link_idx] =
......@@ -2423,8 +2592,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_ssl_certs[link_idx] = NULL;
}
if (
!table->field[14]->is_null() &&
(ptr = get_field(mem_root, table->field[14]))
!table->field[SPIDER_TABLES_SSL_CIPHER_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_CIPHER_POS]))
) {
share->tgt_ssl_ciphers_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_ciphers[link_idx] =
......@@ -2434,8 +2603,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_ssl_ciphers[link_idx] = NULL;
}
if (
!table->field[15]->is_null() &&
(ptr = get_field(mem_root, table->field[15]))
!table->field[SPIDER_TABLES_SSL_KEY_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_SSL_KEY_POS]))
) {
share->tgt_ssl_keys_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_keys[link_idx] =
......@@ -2445,22 +2614,25 @@ int spider_get_sys_tables_connect_info(
share->tgt_ssl_keys[link_idx] = NULL;
}
if (
!table->field[16]->is_null() &&
(ptr = get_field(mem_root, table->field[16]))
!table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_TABLES_SSL_VERIFY_SERVER_CERT_POS]))
) {
share->tgt_ssl_vscs[link_idx] = atol(ptr);
} else
share->tgt_ssl_vscs[link_idx] = -1;
if (
!table->field[17]->is_null() &&
(ptr = get_field(mem_root, table->field[17]))
!table->field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS]->
is_null() &&
(ptr = get_field(mem_root, table->
field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS]))
) {
share->monitoring_binlog_pos_at_failing[link_idx] = atol(ptr);
} else
share->monitoring_binlog_pos_at_failing[link_idx] = 0;
if (
!table->field[18]->is_null() &&
(ptr = get_field(mem_root, table->field[18]))
!table->field[SPIDER_TABLES_DEFAULT_FILE_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_DEFAULT_FILE_POS]))
) {
share->tgt_default_files_lengths[link_idx] = strlen(ptr);
share->tgt_default_files[link_idx] =
......@@ -2470,8 +2642,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_default_files[link_idx] = NULL;
}
if (
!table->field[19]->is_null() &&
(ptr = get_field(mem_root, table->field[19]))
!table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_DEFAULT_GROUP_POS]))
) {
share->tgt_default_groups_lengths[link_idx] = strlen(ptr);
share->tgt_default_groups[link_idx] =
......@@ -2481,8 +2653,19 @@ int spider_get_sys_tables_connect_info(
share->tgt_default_groups[link_idx] = NULL;
}
if (
!table->field[20]->is_null() &&
(ptr = get_field(mem_root, table->field[20]))
!table->field[SPIDER_TABLES_DSN_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_DSN_POS]))
) {
share->tgt_dsns_lengths[link_idx] = strlen(ptr);
share->tgt_dsns[link_idx] =
spider_create_string(ptr, share->tgt_dsns_lengths[link_idx]);
} else {
share->tgt_dsns_lengths[link_idx] = 0;
share->tgt_dsns[link_idx] = NULL;
}
if (
!table->field[SPIDER_TABLES_TGT_DB_NAME_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_TGT_DB_NAME_POS]))
) {
share->tgt_dbs_lengths[link_idx] = strlen(ptr);
share->tgt_dbs[link_idx] =
......@@ -2492,8 +2675,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_dbs[link_idx] = NULL;
}
if (
!table->field[21]->is_null() &&
(ptr = get_field(mem_root, table->field[21]))
!table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_TGT_TABLE_NAME_POS]))
) {
share->tgt_table_names_lengths[link_idx] = strlen(ptr);
share->tgt_table_names[link_idx] =
......@@ -2503,8 +2686,8 @@ int spider_get_sys_tables_connect_info(
share->tgt_table_names[link_idx] = NULL;
}
if (
!table->field[24]->is_null() &&
(ptr = get_field(mem_root, table->field[24]))
!table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]))
) {
share->static_link_ids_lengths[link_idx] = strlen(ptr);
share->static_link_ids[link_idx] =
......@@ -2524,7 +2707,8 @@ int spider_get_sys_tables_monitoring_binlog_pos_at_failing(
char *ptr;
int error_num = 0;
DBUG_ENTER("spider_get_sys_tables_monitoring_binlog_pos_at_failing");
if ((ptr = get_field(mem_root, table->field[17])))
if ((ptr = get_field(mem_root, table->
field[SPIDER_TABLES_MONITORING_BINLOG_POS_AT_FAILING_POS])))
*monitoring_binlog_pos_at_failing = (long) my_strtoll10(ptr, (char**) NULL,
&error_num);
else
......@@ -2543,7 +2727,7 @@ int spider_get_sys_tables_link_status(
char *ptr;
int error_num = 0;
DBUG_ENTER("spider_get_sys_tables_link_status");
if ((ptr = get_field(mem_root, table->field[22])))
if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_LINK_STATUS_POS])))
{
share->link_statuses[link_idx] =
(long) my_strtoll10(ptr, (char**) NULL, &error_num);
......@@ -2562,7 +2746,7 @@ int spider_get_sys_tables_link_status(
char *ptr;
int error_num = 0;
DBUG_ENTER("spider_get_sys_tables_link_status");
if ((ptr = get_field(mem_root, table->field[22])))
if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_LINK_STATUS_POS])))
*link_status = (long) my_strtoll10(ptr, (char**) NULL, &error_num);
else
*link_status = 1;
......@@ -2578,7 +2762,7 @@ int spider_get_sys_tables_link_idx(
char *ptr;
int error_num = 0;
DBUG_ENTER("spider_get_sys_tables_link_idx");
if ((ptr = get_field(mem_root, table->field[2])))
if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_LINK_ID_POS])))
*link_idx = (int) my_strtoll10(ptr, (char**) NULL, &error_num);
else
*link_idx = 1;
......@@ -2596,8 +2780,9 @@ int spider_get_sys_tables_static_link_id(
DBUG_ENTER("spider_get_sys_tables_static_link_id");
*static_link_id = NULL;
if (
!table->field[24]->is_null() &&
(*static_link_id = get_field(mem_root, table->field[24]))
!table->field[SPIDER_TABLES_STATIC_LINK_ID_POS]->is_null() &&
(*static_link_id = get_field(mem_root, table->
field[SPIDER_TABLES_STATIC_LINK_ID_POS]))
) {
*static_link_id_length = strlen(*static_link_id);
} else {
......@@ -2619,12 +2804,18 @@ void spider_get_sys_table_sts_info(
#endif
long not_used_long;
DBUG_ENTER("spider_get_sys_table_sts_info");
stat->data_file_length = (ulonglong) table->field[2]->val_int();
stat->max_data_file_length = (ulonglong) table->field[3]->val_int();
stat->index_file_length = (ulonglong) table->field[4]->val_int();
stat->records = (ha_rows) table->field[5]->val_int();
stat->mean_rec_length = (ulong) table->field[6]->val_int();
table->field[7]->get_date(&mysql_time, SPIDER_date_mode_t(0));
stat->data_file_length = (ulonglong) table->
field[SPIDER_TABLE_STS_DATA_FILE_LENGTH_POS]->val_int();
stat->max_data_file_length = (ulonglong) table->
field[SPIDER_TABLE_STS_MAX_DATA_FILE_LENGTH_POS]->val_int();
stat->index_file_length = (ulonglong) table->
field[SPIDER_TABLE_STS_INDEX_FILE_LENGTH_POS]->val_int();
stat->records = (ha_rows) table->
field[SPIDER_TABLE_STS_RECORDS_POS]->val_int();
stat->mean_rec_length = (ulong) table->
field[SPIDER_TABLE_STS_MEAN_REC_LENGTH_POS]->val_int();
table->field[SPIDER_TABLE_STS_CHECK_TIME_POS]->get_date(&mysql_time,
SPIDER_date_mode_t(0));
#ifdef MARIADB_BASE_VERSION
stat->check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
......@@ -2632,7 +2823,8 @@ void spider_get_sys_table_sts_info(
stat->check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_my_bool);
#endif
table->field[8]->get_date(&mysql_time, SPIDER_date_mode_t(0));
table->field[SPIDER_TABLE_STS_CREATE_TIME_POS]->get_date(&mysql_time,
SPIDER_date_mode_t(0));
#ifdef MARIADB_BASE_VERSION
stat->create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
......@@ -2640,7 +2832,8 @@ void spider_get_sys_table_sts_info(
stat->create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_my_bool);
#endif
table->field[9]->get_date(&mysql_time, SPIDER_date_mode_t(0));
table->field[SPIDER_TABLE_STS_UPDATE_TIME_POS]->get_date(&mysql_time,
SPIDER_date_mode_t(0));
#ifdef MARIADB_BASE_VERSION
stat->update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
......@@ -2648,13 +2841,14 @@ void spider_get_sys_table_sts_info(
stat->update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_my_bool);
#endif
if (table->field[10]->is_null())
if (table->field[SPIDER_TABLE_STS_CHECKSUM_POS]->is_null())
{
stat->checksum_null = TRUE;
stat->checksum = 0;
} else {
stat->checksum_null = FALSE;
stat->checksum = (ha_checksum) table->field[10]->val_int();
stat->checksum = (ha_checksum) table->
field[SPIDER_TABLE_STS_CHECKSUM_POS]->val_int();
}
DBUG_VOID_RETURN;
}
......@@ -2666,10 +2860,11 @@ void spider_get_sys_table_crd_info(
) {
uint seq;
DBUG_ENTER("spider_get_sys_table_crd_info");
seq = (uint) table->field[2]->val_int();
seq = (uint) table->field[SPIDER_TABLE_CRD_KEY_SEQ_POS]->val_int();
if (seq < number_of_keys)
{
cardinality[seq] = (longlong) table->field[3]->val_int();
cardinality[seq] = (longlong) table->
field[SPIDER_TABLE_CRD_CARDINALITY_POS]->val_int();
}
DBUG_VOID_RETURN;
}
......@@ -2798,9 +2993,9 @@ int spider_get_sys_link_mon_key(
uint db_name_length, table_name_length, link_id_length;
DBUG_ENTER("spider_get_sys_link_mon_key");
if (
table->field[0]->is_null() ||
table->field[1]->is_null() ||
table->field[2]->is_null()
table->field[SPIDER_LINK_MON_SERVERS_DB_NAME_POS]->is_null() ||
table->field[SPIDER_LINK_MON_SERVERS_TABLE_NAME_POS]->is_null() ||
table->field[SPIDER_LINK_MON_SERVERS_LINK_ID_POS]->is_null()
) {
my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM,
ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0),
......@@ -2809,9 +3004,12 @@ int spider_get_sys_link_mon_key(
}
if (
!(db_name = get_field(mem_root, table->field[0])) ||
!(table_name = get_field(mem_root, table->field[1])) ||
!(link_id = get_field(mem_root, table->field[2]))
!(db_name = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_DB_NAME_POS])) ||
!(table_name = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_TABLE_NAME_POS])) ||
!(link_id = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_LINK_ID_POS]))
)
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
......@@ -2861,7 +3059,8 @@ int spider_get_sys_link_mon_server_id(
char *ptr;
int error_num = 0;
DBUG_ENTER("spider_get_sys_link_mon_server_id");
if ((ptr = get_field(mem_root, table->field[3])))
if ((ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SID_POS])))
*server_id = (uint32) my_strtoll10(ptr, (char**) NULL, &error_num);
else
*server_id = ~(uint32) 0;
......@@ -2878,8 +3077,9 @@ int spider_get_sys_link_mon_connect_info(
int error_num = 0;
DBUG_ENTER("spider_get_sys_link_mon_connect_info");
if (
!table->field[4]->is_null() &&
(ptr = get_field(mem_root, table->field[4]))
!table->field[SPIDER_LINK_MON_SERVERS_SERVER_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SERVER_POS]))
) {
share->server_names_lengths[link_idx] = strlen(ptr);
share->server_names[link_idx] =
......@@ -2889,8 +3089,9 @@ int spider_get_sys_link_mon_connect_info(
share->server_names[link_idx] = NULL;
}
if (
!table->field[5]->is_null() &&
(ptr = get_field(mem_root, table->field[5]))
!table->field[SPIDER_LINK_MON_SERVERS_SCHEME_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SCHEME_POS]))
) {
share->tgt_wrappers_lengths[link_idx] = strlen(ptr);
share->tgt_wrappers[link_idx] =
......@@ -2900,8 +3101,8 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_wrappers[link_idx] = NULL;
}
if (
!table->field[6]->is_null() &&
(ptr = get_field(mem_root, table->field[6]))
!table->field[SPIDER_LINK_MON_SERVERS_HOST_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_LINK_MON_SERVERS_HOST_POS]))
) {
share->tgt_hosts_lengths[link_idx] = strlen(ptr);
share->tgt_hosts[link_idx] =
......@@ -2911,16 +3112,17 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_hosts[link_idx] = NULL;
}
if (
!table->field[7]->is_null() &&
(ptr = get_field(mem_root, table->field[7]))
!table->field[SPIDER_LINK_MON_SERVERS_PORT_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_LINK_MON_SERVERS_PORT_POS]))
) {
share->tgt_ports[link_idx] = atol(ptr);
} else {
share->tgt_ports[link_idx] = -1;
}
if (
!table->field[8]->is_null() &&
(ptr = get_field(mem_root, table->field[8]))
!table->field[SPIDER_LINK_MON_SERVERS_SOCKET_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SOCKET_POS]))
) {
share->tgt_sockets_lengths[link_idx] = strlen(ptr);
share->tgt_sockets[link_idx] =
......@@ -2930,8 +3132,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_sockets[link_idx] = NULL;
}
if (
!table->field[9]->is_null() &&
(ptr = get_field(mem_root, table->field[9]))
!table->field[SPIDER_LINK_MON_SERVERS_USERNAME_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_USERNAME_POS]))
) {
share->tgt_usernames_lengths[link_idx] = strlen(ptr);
share->tgt_usernames[link_idx] =
......@@ -2941,8 +3144,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_usernames[link_idx] = NULL;
}
if (
!table->field[10]->is_null() &&
(ptr = get_field(mem_root, table->field[10]))
!table->field[SPIDER_LINK_MON_SERVERS_PASSWORD_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_PASSWORD_POS]))
) {
share->tgt_passwords_lengths[link_idx] = strlen(ptr);
share->tgt_passwords[link_idx] =
......@@ -2952,8 +3156,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_passwords[link_idx] = NULL;
}
if (
!table->field[11]->is_null() &&
(ptr = get_field(mem_root, table->field[11]))
!table->field[SPIDER_LINK_MON_SERVERS_SSL_CA_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SSL_CA_POS]))
) {
share->tgt_ssl_cas_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_cas[link_idx] =
......@@ -2963,8 +3168,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_ssl_cas[link_idx] = NULL;
}
if (
!table->field[12]->is_null() &&
(ptr = get_field(mem_root, table->field[12]))
!table->field[SPIDER_LINK_MON_SERVERS_SSL_CAPATH_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SSL_CAPATH_POS]))
) {
share->tgt_ssl_capaths_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_capaths[link_idx] =
......@@ -2974,8 +3180,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_ssl_capaths[link_idx] = NULL;
}
if (
!table->field[13]->is_null() &&
(ptr = get_field(mem_root, table->field[13]))
!table->field[SPIDER_LINK_MON_SERVERS_SSL_CERT_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SSL_CERT_POS]))
) {
share->tgt_ssl_certs_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_certs[link_idx] =
......@@ -2985,8 +3192,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_ssl_certs[link_idx] = NULL;
}
if (
!table->field[14]->is_null() &&
(ptr = get_field(mem_root, table->field[14]))
!table->field[SPIDER_LINK_MON_SERVERS_SSL_CIPHER_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SSL_CIPHER_POS]))
) {
share->tgt_ssl_ciphers_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_ciphers[link_idx] =
......@@ -2996,8 +3204,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_ssl_ciphers[link_idx] = NULL;
}
if (
!table->field[15]->is_null() &&
(ptr = get_field(mem_root, table->field[15]))
!table->field[SPIDER_LINK_MON_SERVERS_SSL_KEY_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SSL_KEY_POS]))
) {
share->tgt_ssl_keys_lengths[link_idx] = strlen(ptr);
share->tgt_ssl_keys[link_idx] =
......@@ -3007,15 +3216,18 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_ssl_keys[link_idx] = NULL;
}
if (
!table->field[16]->is_null() &&
(ptr = get_field(mem_root, table->field[16]))
!table->field[SPIDER_LINK_MON_SERVERS_SSL_VERIFY_SERVER_CERT_POS]->
is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_SSL_VERIFY_SERVER_CERT_POS]))
) {
share->tgt_ssl_vscs[link_idx] = atol(ptr);
} else
share->tgt_ssl_vscs[link_idx] = -1;
if (
!table->field[17]->is_null() &&
(ptr = get_field(mem_root, table->field[17]))
!table->field[SPIDER_LINK_MON_SERVERS_DEFAULT_FILE_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_DEFAULT_FILE_POS]))
) {
share->tgt_default_files_lengths[link_idx] = strlen(ptr);
share->tgt_default_files[link_idx] =
......@@ -3025,8 +3237,9 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_default_files[link_idx] = NULL;
}
if (
!table->field[18]->is_null() &&
(ptr = get_field(mem_root, table->field[18]))
!table->field[SPIDER_LINK_MON_SERVERS_DEFAULT_GROUP_POS]->is_null() &&
(ptr = get_field(mem_root,
table->field[SPIDER_LINK_MON_SERVERS_DEFAULT_GROUP_POS]))
) {
share->tgt_default_groups_lengths[link_idx] = strlen(ptr);
share->tgt_default_groups[link_idx] =
......@@ -3035,6 +3248,17 @@ int spider_get_sys_link_mon_connect_info(
share->tgt_default_groups_lengths[link_idx] = 0;
share->tgt_default_groups[link_idx] = NULL;
}
if (
!table->field[SPIDER_LINK_MON_SERVERS_DSN_POS]->is_null() &&
(ptr = get_field(mem_root, table->field[SPIDER_LINK_MON_SERVERS_DSN_POS]))
) {
share->tgt_dsns_lengths[link_idx] = strlen(ptr);
share->tgt_dsns[link_idx] =
spider_create_string(ptr, share->tgt_dsns_lengths[link_idx]);
} else {
share->tgt_dsns_lengths[link_idx] = 0;
share->tgt_dsns[link_idx] = NULL;
}
DBUG_RETURN(error_num);
}
......
......@@ -51,15 +51,15 @@
#define SPIDER_SYS_XA_COL_CNT 5
#define SPIDER_SYS_XA_PK_COL_CNT 3
#define SPIDER_SYS_XA_IDX1_COL_CNT 1
#define SPIDER_SYS_XA_MEMBER_COL_CNT 18
#define SPIDER_SYS_XA_MEMBER_COL_CNT 19
#define SPIDER_SYS_XA_MEMBER_PK_COL_CNT 6
#define SPIDER_SYS_TABLES_COL_CNT 25
#define SPIDER_SYS_TABLES_COL_CNT 26
#define SPIDER_SYS_TABLES_PK_COL_CNT 3
#define SPIDER_SYS_TABLES_IDX1_COL_CNT 1
#define SPIDER_SYS_TABLES_UIDX1_COL_CNT 3
#define SPIDER_SYS_LINK_MON_TABLE_COL_CNT 19
#define SPIDER_SYS_LINK_MON_TABLE_COL_CNT 20
#define SPIDER_SYS_LINK_FAILED_TABLE_COL_CNT 4
#define SPIDER_SYS_XA_FAILED_TABLE_COL_CNT 21
#define SPIDER_SYS_XA_FAILED_TABLE_COL_CNT 22
#define SPIDER_SYS_POS_FOR_RECOVERY_TABLE_COL_CNT 7
#define SPIDER_SYS_TABLE_STS_COL_CNT 11
#define SPIDER_SYS_TABLE_STS_PK_COL_CNT 2
......@@ -274,11 +274,6 @@ void spider_store_tables_link_status(
long link_status
);
void spider_store_link_chk_server_id(
TABLE *table,
uint32 server_id
);
void spider_store_binlog_pos_failed_link_idx(
TABLE *table,
int failed_link_idx
......
......@@ -799,6 +799,17 @@ int spider_free_share_alloc(
}
spider_free(spider_current_trx, share->tgt_default_groups, MYF(0));
}
if (share->tgt_dsns)
{
for (roop_count = 0; roop_count < (int) share->tgt_dsns_length;
roop_count++)
{
if (share->tgt_dsns[roop_count])
spider_free(spider_current_trx, share->tgt_dsns[roop_count],
MYF(0));
}
spider_free(spider_current_trx, share->tgt_dsns, MYF(0));
}
if (share->tgt_pk_names)
{
for (roop_count = 0; roop_count < (int) share->tgt_pk_names_length;
......@@ -1002,6 +1013,11 @@ void spider_free_tmp_share_alloc(
spider_free(spider_current_trx, share->tgt_default_groups[0], MYF(0));
share->tgt_default_groups[0] = NULL;
}
if (share->tgt_dsns && share->tgt_dsns[0])
{
spider_free(spider_current_trx, share->tgt_dsns[0], MYF(0));
share->tgt_dsns[0] = NULL;
}
if (share->tgt_pk_names && share->tgt_pk_names[0])
{
spider_free(spider_current_trx, share->tgt_pk_names[0], MYF(0));
......@@ -2251,6 +2267,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_STR_LIST("dff", tgt_default_files);
SPIDER_PARAM_STR_LIST("dfg", tgt_default_groups);
SPIDER_PARAM_LONGLONG("dol", direct_order_limit, 0);
SPIDER_PARAM_STR_LIST("dsn", tgt_dsns);
SPIDER_PARAM_INT_WITH_MAX("erm", error_read_mode, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("ewm", error_write_mode, 0, 1);
#ifdef HA_CAN_FORCE_BULK_DELETE
......@@ -2665,6 +2682,8 @@ int spider_parse_connect_info(
share->all_link_count = share->tgt_default_files_length;
if (share->all_link_count < share->tgt_default_groups_length)
share->all_link_count = share->tgt_default_groups_length;
if (share->all_link_count < share->tgt_dsns_length)
share->all_link_count = share->tgt_dsns_length;
if (share->all_link_count < share->tgt_pk_names_length)
share->all_link_count = share->tgt_pk_names_length;
if (share->all_link_count < share->tgt_sequence_names_length)
......@@ -2828,6 +2847,13 @@ int spider_parse_connect_info(
&share->tgt_default_groups_charlen,
share->all_link_count)))
goto error;
if ((error_num = spider_increase_string_list(
&share->tgt_dsns,
&share->tgt_dsns_lengths,
&share->tgt_dsns_length,
&share->tgt_dsns_charlen,
share->all_link_count)))
goto error;
if ((error_num = spider_increase_string_list(
&share->tgt_pk_names,
&share->tgt_pk_names_lengths,
......@@ -2986,9 +3012,73 @@ int spider_parse_connect_info(
if (!(share_alter->tmp_server_names = (char **)
spider_bulk_malloc(spider_current_trx, 43, MYF(MY_WME | MY_ZEROFILL),
&share_alter->tmp_server_names,
(uint) (sizeof(char *) * 16 * share->all_link_count),
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_table_names,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_dbs,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_hosts,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_usernames,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_passwords,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_sockets,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_wrappers,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_cas,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_capaths,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_certs,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_ciphers,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_keys,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_default_files,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_default_groups,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_tgt_dsns,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_static_link_ids,
(uint) (sizeof(char *) * share->all_link_count),
&share_alter->tmp_server_names_lengths,
(uint) (sizeof(uint *) * 16 * share->all_link_count),
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_table_names_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_dbs_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_hosts_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_usernames_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_passwords_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_sockets_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_wrappers_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_cas_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_capaths_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_certs_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_ciphers_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_ssl_keys_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_default_files_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_default_groups_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_dsns_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_static_link_ids_lengths,
(uint) (sizeof(uint *) * share->all_link_count),
&share_alter->tmp_tgt_ports,
(uint) (sizeof(long) * share->all_link_count),
&share_alter->tmp_tgt_ssl_vscs,
......@@ -3006,64 +3096,36 @@ int spider_parse_connect_info(
memcpy(share_alter->tmp_server_names, share->server_names,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_table_names =
share_alter->tmp_server_names + share->all_link_count;
memcpy(share_alter->tmp_tgt_table_names, share->tgt_table_names,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_dbs =
share_alter->tmp_tgt_table_names + share->all_link_count;
memcpy(share_alter->tmp_tgt_dbs, share->tgt_dbs,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_hosts =
share_alter->tmp_tgt_dbs + share->all_link_count;
memcpy(share_alter->tmp_tgt_hosts, share->tgt_hosts,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_usernames =
share_alter->tmp_tgt_hosts + share->all_link_count;
memcpy(share_alter->tmp_tgt_usernames, share->tgt_usernames,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_passwords =
share_alter->tmp_tgt_usernames + share->all_link_count;
memcpy(share_alter->tmp_tgt_passwords, share->tgt_passwords,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_sockets =
share_alter->tmp_tgt_passwords + share->all_link_count;
memcpy(share_alter->tmp_tgt_sockets, share->tgt_sockets,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_wrappers =
share_alter->tmp_tgt_sockets + share->all_link_count;
memcpy(share_alter->tmp_tgt_wrappers, share->tgt_wrappers,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_ssl_cas =
share_alter->tmp_tgt_wrappers + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_cas, share->tgt_ssl_cas,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_ssl_capaths =
share_alter->tmp_tgt_ssl_cas + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_capaths, share->tgt_ssl_capaths,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_ssl_certs =
share_alter->tmp_tgt_ssl_capaths + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_certs, share->tgt_ssl_certs,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_ssl_ciphers =
share_alter->tmp_tgt_ssl_certs + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_ciphers, share->tgt_ssl_ciphers,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_ssl_keys =
share_alter->tmp_tgt_ssl_ciphers + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_keys, share->tgt_ssl_keys,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_default_files =
share_alter->tmp_tgt_ssl_keys + share->all_link_count;
memcpy(share_alter->tmp_tgt_default_files, share->tgt_default_files,
sizeof(char *) * share->all_link_count);
share_alter->tmp_tgt_default_groups =
share_alter->tmp_tgt_default_files + share->all_link_count;
memcpy(share_alter->tmp_tgt_default_groups, share->tgt_default_groups,
sizeof(char *) * share->all_link_count);
share_alter->tmp_static_link_ids =
share_alter->tmp_tgt_default_groups + share->all_link_count;
memcpy(share_alter->tmp_tgt_dsns, share->tgt_dsns,
sizeof(char *) * share->all_link_count);
memcpy(share_alter->tmp_static_link_ids, share->static_link_ids,
sizeof(char *) * share->all_link_count);
......@@ -3080,75 +3142,48 @@ int spider_parse_connect_info(
memcpy(share_alter->tmp_server_names_lengths,
share->server_names_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_table_names_lengths =
share_alter->tmp_server_names_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_table_names_lengths,
share->tgt_table_names_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_dbs_lengths =
share_alter->tmp_tgt_table_names_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_dbs_lengths, share->tgt_dbs_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_hosts_lengths =
share_alter->tmp_tgt_dbs_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_hosts_lengths, share->tgt_hosts_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_usernames_lengths =
share_alter->tmp_tgt_hosts_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_usernames_lengths,
share->tgt_usernames_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_passwords_lengths =
share_alter->tmp_tgt_usernames_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_passwords_lengths,
share->tgt_passwords_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_sockets_lengths =
share_alter->tmp_tgt_passwords_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_sockets_lengths, share->tgt_sockets_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_wrappers_lengths =
share_alter->tmp_tgt_sockets_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_wrappers_lengths,
share->tgt_wrappers_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_ssl_cas_lengths =
share_alter->tmp_tgt_wrappers_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_cas_lengths,
share->tgt_ssl_cas_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_ssl_capaths_lengths =
share_alter->tmp_tgt_ssl_cas_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_capaths_lengths,
share->tgt_ssl_capaths_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_ssl_certs_lengths =
share_alter->tmp_tgt_ssl_capaths_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_certs_lengths,
share->tgt_ssl_certs_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_ssl_ciphers_lengths =
share_alter->tmp_tgt_ssl_certs_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_ciphers_lengths,
share->tgt_ssl_ciphers_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_ssl_keys_lengths =
share_alter->tmp_tgt_ssl_ciphers_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_ssl_keys_lengths,
share->tgt_ssl_keys_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_default_files_lengths =
share_alter->tmp_tgt_ssl_keys_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_default_files_lengths,
share->tgt_default_files_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_tgt_default_groups_lengths =
share_alter->tmp_tgt_default_files_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_default_groups_lengths,
share->tgt_default_groups_lengths,
sizeof(uint) * share->all_link_count);
share_alter->tmp_static_link_ids_lengths =
share_alter->tmp_tgt_default_groups_lengths + share->all_link_count;
memcpy(share_alter->tmp_tgt_dsns_lengths,
share->tgt_dsns_lengths,
sizeof(uint) * share->all_link_count);
memcpy(share_alter->tmp_static_link_ids_lengths,
share->static_link_ids_lengths,
sizeof(uint) * share->all_link_count);
......@@ -3170,6 +3205,8 @@ int spider_parse_connect_info(
share->tgt_default_files_charlen;
share_alter->tmp_tgt_default_groups_charlen =
share->tgt_default_groups_charlen;
share_alter->tmp_tgt_dsns_charlen =
share->tgt_dsns_charlen;
share_alter->tmp_static_link_ids_charlen =
share->static_link_ids_charlen;
......@@ -3189,6 +3226,8 @@ int spider_parse_connect_info(
share_alter->tmp_tgt_default_files_length = share->tgt_default_files_length;
share_alter->tmp_tgt_default_groups_length =
share->tgt_default_groups_length;
share_alter->tmp_tgt_dsns_length =
share->tgt_dsns_length;
share_alter->tmp_static_link_ids_length =
share->static_link_ids_length;
share_alter->tmp_tgt_ports_length = share->tgt_ports_length;
......@@ -3411,6 +3450,18 @@ int spider_parse_connect_info(
goto error;
}
DBUG_PRINT("info",
("spider tgt_dsns_lengths[%d] = %u", roop_count,
share->tgt_dsns_lengths[roop_count]));
if (share->tgt_dsns_lengths[roop_count] >
SPIDER_CONNECT_INFO_MAX_LEN)
{
error_num = ER_SPIDER_INVALID_CONNECT_INFO_TOO_LONG_NUM;
my_printf_error(error_num, ER_SPIDER_INVALID_CONNECT_INFO_TOO_LONG_STR,
MYF(0), share->tgt_dsns[roop_count], "default_group");
goto error;
}
DBUG_PRINT("info",
("spider tgt_pk_names_lengths[%d] = %u", roop_count,
share->tgt_pk_names_lengths[roop_count]));
......@@ -4247,7 +4298,8 @@ int spider_create_conn_keys(
+ share->tgt_ssl_keys_lengths[roop_count] + 1
+ 1 + 1
+ share->tgt_default_files_lengths[roop_count] + 1
+ share->tgt_default_groups_lengths[roop_count];
+ share->tgt_default_groups_lengths[roop_count] + 1
+ share->tgt_dsns_lengths[roop_count];
share->conn_keys_charlen += conn_keys_lengths[roop_count] + 2;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
hs_r_conn_keys_lengths[roop_count]
......@@ -4424,6 +4476,13 @@ int spider_create_conn_keys(
tmp_name = strmov(tmp_name + 1, share->tgt_default_groups[roop_count]);
} else
tmp_name++;
if (share->tgt_dsns[roop_count])
{
DBUG_PRINT("info",("spider tgt_dsns[%d]=%s", roop_count,
share->tgt_dsns[roop_count]));
tmp_name = strmov(tmp_name + 1, share->tgt_dsns[roop_count]);
} else
tmp_name++;
tmp_name++;
tmp_name++;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
......@@ -8410,12 +8469,13 @@ void spider_set_tmp_share_pointer(
tmp_share->tgt_ssl_keys = &tmp_connect_info[12];
tmp_share->tgt_default_files = &tmp_connect_info[13];
tmp_share->tgt_default_groups = &tmp_connect_info[14];
tmp_share->tgt_pk_names = &tmp_connect_info[15];
tmp_share->tgt_sequence_names = &tmp_connect_info[16];
tmp_share->static_link_ids = &tmp_connect_info[17];
tmp_share->tgt_dsns = &tmp_connect_info[15];
tmp_share->tgt_pk_names = &tmp_connect_info[16];
tmp_share->tgt_sequence_names = &tmp_connect_info[17];
tmp_share->static_link_ids = &tmp_connect_info[18];
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
tmp_share->hs_read_socks = &tmp_connect_info[18];
tmp_share->hs_write_socks = &tmp_connect_info[19];
tmp_share->hs_read_socks = &tmp_connect_info[19];
tmp_share->hs_write_socks = &tmp_connect_info[20];
#endif
tmp_share->tgt_ports = &tmp_long[0];
tmp_share->tgt_ssl_vscs = &tmp_long[1];
......@@ -8463,12 +8523,13 @@ void spider_set_tmp_share_pointer(
tmp_share->tgt_ssl_keys_lengths = &tmp_connect_info_length[12];
tmp_share->tgt_default_files_lengths = &tmp_connect_info_length[13];
tmp_share->tgt_default_groups_lengths = &tmp_connect_info_length[14];
tmp_share->tgt_pk_names_lengths = &tmp_connect_info_length[15];
tmp_share->tgt_sequence_names_lengths = &tmp_connect_info_length[16];
tmp_share->static_link_ids_lengths = &tmp_connect_info_length[17];
tmp_share->tgt_dsns_lengths = &tmp_connect_info_length[15];
tmp_share->tgt_pk_names_lengths = &tmp_connect_info_length[16];
tmp_share->tgt_sequence_names_lengths = &tmp_connect_info_length[17];
tmp_share->static_link_ids_lengths = &tmp_connect_info_length[18];
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
tmp_share->hs_read_socks_lengths = &tmp_connect_info_length[18];
tmp_share->hs_write_socks_lengths = &tmp_connect_info_length[19];
tmp_share->hs_read_socks_lengths = &tmp_connect_info_length[19];
tmp_share->hs_write_socks_lengths = &tmp_connect_info_length[20];
#endif
tmp_share->server_names_length = 1;
tmp_share->tgt_table_names_length = 1;
......@@ -8485,6 +8546,7 @@ void spider_set_tmp_share_pointer(
tmp_share->tgt_ssl_keys_length = 1;
tmp_share->tgt_default_files_length = 1;
tmp_share->tgt_default_groups_length = 1;
tmp_share->tgt_dsns_length = 1;
tmp_share->tgt_pk_names_length = 1;
tmp_share->tgt_sequence_names_length = 1;
tmp_share->static_link_ids_length = 1;
......
......@@ -505,6 +505,7 @@ int spider_create_trx_alter_table(
char **tmp_tgt_ssl_keys;
char **tmp_tgt_default_files;
char **tmp_tgt_default_groups;
char **tmp_tgt_dsns;
char **tmp_static_link_ids;
uint *tmp_server_names_lengths;
uint *tmp_tgt_table_names_lengths;
......@@ -521,6 +522,7 @@ int spider_create_trx_alter_table(
uint *tmp_tgt_ssl_keys_lengths;
uint *tmp_tgt_default_files_lengths;
uint *tmp_tgt_default_groups_lengths;
uint *tmp_tgt_dsns_lengths;
uint *tmp_static_link_ids_lengths;
long *tmp_tgt_ports;
long *tmp_tgt_ssl_vscs;
......@@ -541,6 +543,7 @@ int spider_create_trx_alter_table(
char *tmp_tgt_ssl_keys_char;
char *tmp_tgt_default_files_char;
char *tmp_tgt_default_groups_char;
char *tmp_tgt_dsns_char;
char *tmp_static_link_ids_char;
uint old_elements;
......@@ -567,6 +570,7 @@ int spider_create_trx_alter_table(
&tmp_tgt_ssl_keys, (uint) (sizeof(char *) * share->all_link_count),
&tmp_tgt_default_files, (uint) (sizeof(char *) * share->all_link_count),
&tmp_tgt_default_groups, (uint) (sizeof(char *) * share->all_link_count),
&tmp_tgt_dsns, (uint) (sizeof(char *) * share->all_link_count),
&tmp_static_link_ids, (uint) (sizeof(char *) * share->all_link_count),
&tmp_server_names_lengths, (uint) (sizeof(uint) * share->all_link_count),
......@@ -592,6 +596,7 @@ int spider_create_trx_alter_table(
(uint) (sizeof(uint) * share->all_link_count),
&tmp_tgt_default_groups_lengths,
(uint) (sizeof(uint) * share->all_link_count),
&tmp_tgt_dsns_lengths, (uint) (sizeof(uint) * share->all_link_count),
&tmp_static_link_ids_lengths,
(uint) (sizeof(uint) * share->all_link_count),
......@@ -631,6 +636,8 @@ int spider_create_trx_alter_table(
(share_alter->tmp_tgt_default_files_charlen + 1)),
&tmp_tgt_default_groups_char, (uint) (sizeof(char) *
(share_alter->tmp_tgt_default_groups_charlen + 1)),
&tmp_tgt_dsns_char, (uint) (sizeof(char) *
(share_alter->tmp_tgt_dsns_charlen + 1)),
&tmp_static_link_ids_char, (uint) (sizeof(char) *
(share_alter->tmp_static_link_ids_charlen + 1)),
NullS))
......@@ -666,6 +673,7 @@ int spider_create_trx_alter_table(
alter_table->tmp_tgt_ssl_keys = tmp_tgt_ssl_keys;
alter_table->tmp_tgt_default_files = tmp_tgt_default_files;
alter_table->tmp_tgt_default_groups = tmp_tgt_default_groups;
alter_table->tmp_tgt_dsns = tmp_tgt_dsns;
alter_table->tmp_static_link_ids = tmp_static_link_ids;
alter_table->tmp_tgt_ports = tmp_tgt_ports;
......@@ -689,6 +697,7 @@ int spider_create_trx_alter_table(
alter_table->tmp_tgt_ssl_keys_lengths = tmp_tgt_ssl_keys_lengths;
alter_table->tmp_tgt_default_files_lengths = tmp_tgt_default_files_lengths;
alter_table->tmp_tgt_default_groups_lengths = tmp_tgt_default_groups_lengths;
alter_table->tmp_tgt_dsns_lengths = tmp_tgt_dsns_lengths;
alter_table->tmp_static_link_ids_lengths = tmp_static_link_ids_lengths;
for(roop_count = 0; roop_count < (int) share->all_link_count; roop_count++)
......@@ -789,6 +798,12 @@ int spider_create_trx_alter_table(
tmp_tgt_default_groups_char +=
share_alter->tmp_tgt_default_groups_lengths[roop_count] + 1;
tmp_tgt_dsns[roop_count] = tmp_tgt_dsns_char;
memcpy(tmp_tgt_dsns_char, share_alter->tmp_tgt_dsns[roop_count],
sizeof(char) * share_alter->tmp_tgt_dsns_lengths[roop_count]);
tmp_tgt_dsns_char +=
share_alter->tmp_tgt_dsns_lengths[roop_count] + 1;
if (share_alter->tmp_static_link_ids[roop_count])
{
tmp_static_link_ids[roop_count] = tmp_static_link_ids_char;
......@@ -842,6 +857,8 @@ int spider_create_trx_alter_table(
memcpy(tmp_tgt_default_groups_lengths,
share_alter->tmp_tgt_default_groups_lengths,
sizeof(uint) * share->all_link_count);
memcpy(tmp_tgt_dsns_lengths, share_alter->tmp_tgt_dsns_lengths,
sizeof(uint) * share->all_link_count);
memcpy(tmp_static_link_ids_lengths,
share_alter->tmp_static_link_ids_lengths,
sizeof(uint) * share->all_link_count);
......@@ -876,6 +893,8 @@ int spider_create_trx_alter_table(
share_alter->tmp_tgt_default_files_length;
alter_table->tmp_tgt_default_groups_length =
share_alter->tmp_tgt_default_groups_length;
alter_table->tmp_tgt_dsns_length =
share_alter->tmp_tgt_dsns_length;
alter_table->tmp_static_link_ids_length =
share_alter->tmp_static_link_ids_length;
alter_table->tmp_tgt_ports_length =
......@@ -1079,6 +1098,16 @@ bool spider_cmp_trx_alter_table(
cmp2->tmp_tgt_default_groups[roop_count])
)
) ||
(
cmp1->tmp_tgt_dsns[roop_count] !=
cmp2->tmp_tgt_dsns[roop_count] &&
(
!cmp1->tmp_tgt_dsns[roop_count] ||
!cmp2->tmp_tgt_dsns[roop_count] ||
strcmp(cmp1->tmp_tgt_dsns[roop_count],
cmp2->tmp_tgt_dsns[roop_count])
)
) ||
(
cmp1->tmp_static_link_ids[roop_count] !=
cmp2->tmp_static_link_ids[roop_count] &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment