Skip to content

Commit 7bd225e

Browse files
MDEV-30920 Remove need_lock and table from spider_close_sys_table()
They became obsolete after commit cfd145f: commit cfd145f Author: Nayuta Yanagisawa <nayuta.yanagisawa@hey.com> Date: Fri Jan 28 01:03:06 2022 +0900 MDEV-27641 Spider: remove #if MYSQL_VERSION_ID < ${VERSION}
1 parent 5a1f752 commit 7bd225e

File tree

7 files changed

+173
-280
lines changed

7 files changed

+173
-280
lines changed

storage/spider/ha_spider.cc

Lines changed: 15 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8597,7 +8597,6 @@ int ha_spider::create(
85978597
SPIDER_TRX *trx;
85988598
TABLE *table_tables = NULL;
85998599
SPIDER_Open_tables_backup open_tables_backup;
8600-
bool need_lock = FALSE;
86018600
DBUG_ENTER("ha_spider::create");
86028601
DBUG_PRINT("info",("spider this=%p", this));
86038602
DBUG_PRINT("info",("spider name=%s", name));
@@ -8675,7 +8674,7 @@ int ha_spider::create(
86758674
if (
86768675
!(table_tables = spider_open_sys_table(
86778676
current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
8678-
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE,
8677+
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup,
86798678
&error_num))
86808679
) {
86818680
goto error;
@@ -8692,8 +8691,7 @@ int ha_spider::create(
86928691
) {
86938692
goto error;
86948693
}
8695-
spider_close_sys_table(current_thd, table_tables,
8696-
&open_tables_backup, FALSE);
8694+
spider_sys_close_table(current_thd, &open_tables_backup);
86978695
table_tables = NULL;
86988696
} else if (
86998697
sql_command == SQLCOM_ALTER_TABLE
@@ -8726,11 +8724,10 @@ int ha_spider::create(
87268724
) &&
87278725
memcmp(name + strlen(name) - 5, "#TMP#", 5)
87288726
) {
8729-
need_lock = TRUE;
87308727
if (
87318728
!(table_tables = spider_open_sys_table(
87328729
current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
8733-
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE,
8730+
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup,
87348731
&error_num))
87358732
) {
87368733
goto error;
@@ -8740,8 +8737,7 @@ int ha_spider::create(
87408737
) {
87418738
goto error;
87428739
}
8743-
spider_close_sys_table(current_thd, table_tables,
8744-
&open_tables_backup, TRUE);
8740+
spider_sys_close_table(current_thd, &open_tables_backup);
87458741
table_tables = NULL;
87468742
}
87478743
}
@@ -8770,8 +8766,7 @@ int ha_spider::create(
87708766

87718767
error:
87728768
if (table_tables)
8773-
spider_close_sys_table(current_thd, table_tables,
8774-
&open_tables_backup, need_lock);
8769+
spider_sys_close_table(current_thd, &open_tables_backup);
87758770
if (tmp_share.lgtm_tblhnd_share)
87768771
spider_free_lgtm_tblhnd_share_alloc(tmp_share.lgtm_tblhnd_share, FALSE);
87778772
if (tmp_share.static_key_cardinality)
@@ -8843,7 +8838,6 @@ int ha_spider::rename_table(
88438838
SPIDER_ALTER_TABLE *alter_table_from, *alter_table_to;
88448839
SPIDER_LGTM_TBLHND_SHARE *from_lgtm_tblhnd_share, *to_lgtm_tblhnd_share;
88458840
SPIDER_Open_tables_backup open_tables_backup;
8846-
bool need_lock = FALSE;
88478841
DBUG_ENTER("ha_spider::rename_table");
88488842
DBUG_PRINT("info",("spider this=%p", this));
88498843
DBUG_PRINT("info",("spider from=%s", from));
@@ -8875,7 +8869,7 @@ int ha_spider::rename_table(
88758869
if (
88768870
!(table_tables = spider_open_sys_table(
88778871
current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
8878-
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE,
8872+
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup,
88798873
&error_num))
88808874
) {
88818875
goto error;
@@ -8886,8 +8880,7 @@ int ha_spider::rename_table(
88868880
) {
88878881
goto error;
88888882
}
8889-
spider_close_sys_table(current_thd, table_tables,
8890-
&open_tables_backup, FALSE);
8883+
spider_sys_close_table(current_thd, &open_tables_backup);
88918884
table_tables = NULL;
88928885

88938886
/* release table mon list */
@@ -8929,21 +8922,10 @@ int ha_spider::rename_table(
89298922
DBUG_PRINT("info",
89308923
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
89318924
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
8932-
if (
8933-
(thd->lex->alter_info.partition_flags &
8934-
(
8935-
SPIDER_ALTER_PARTITION_ADD | SPIDER_ALTER_PARTITION_DROP |
8936-
SPIDER_ALTER_PARTITION_COALESCE | SPIDER_ALTER_PARTITION_REORGANIZE |
8937-
SPIDER_ALTER_PARTITION_TABLE_REORG | SPIDER_ALTER_PARTITION_REBUILD
8938-
)
8939-
)
8940-
)
8941-
need_lock = TRUE;
8942-
89438925
if (
89448926
!(table_tables = spider_open_sys_table(
89458927
current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
8946-
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, need_lock,
8928+
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup,
89478929
&error_num))
89488930
) {
89498931
goto error;
@@ -8972,8 +8954,7 @@ int ha_spider::rename_table(
89728954
goto error;
89738955
}
89748956
}
8975-
spider_close_sys_table(current_thd, table_tables,
8976-
&open_tables_backup, need_lock);
8957+
spider_sys_close_table(current_thd, &open_tables_backup);
89778958
table_tables = NULL;
89788959

89798960
if (!alter_table_from->now_create)
@@ -9031,8 +9012,7 @@ int ha_spider::rename_table(
90319012

90329013
error:
90339014
if (table_tables)
9034-
spider_close_sys_table(current_thd, table_tables,
9035-
&open_tables_backup, need_lock);
9015+
spider_sys_close_table(current_thd, &open_tables_backup);
90369016
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
90379017
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
90389018
to, to_len, to_hash_value, TRUE, FALSE, &tmp_error_num);
@@ -9052,7 +9032,6 @@ int ha_spider::delete_table(
90529032
uint sql_command = thd_sql_command(thd);
90539033
SPIDER_ALTER_TABLE *alter_table;
90549034
SPIDER_Open_tables_backup open_tables_backup;
9055-
bool need_lock = FALSE;
90569035
DBUG_ENTER("ha_spider::delete_table");
90579036
DBUG_PRINT("info",("spider this=%p", this));
90589037
DBUG_PRINT("info",("spider name=%s", name));
@@ -9098,28 +9077,16 @@ int ha_spider::delete_table(
90989077
DBUG_PRINT("info",
90999078
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
91009079
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
9101-
if (
9102-
sql_command == SQLCOM_ALTER_TABLE &&
9103-
(thd->lex->alter_info.partition_flags &
9104-
(
9105-
SPIDER_ALTER_PARTITION_ADD | SPIDER_ALTER_PARTITION_DROP |
9106-
SPIDER_ALTER_PARTITION_COALESCE | SPIDER_ALTER_PARTITION_REORGANIZE |
9107-
SPIDER_ALTER_PARTITION_TABLE_REORG | SPIDER_ALTER_PARTITION_REBUILD
9108-
)
9109-
)
9110-
)
9111-
need_lock = TRUE;
9112-
91139080
if ((error_num = spider_sys_delete_table_sts(
9114-
current_thd, name, name_len, need_lock)))
9081+
current_thd, name, name_len)))
91159082
goto error;
91169083
if ((error_num = spider_sys_delete_table_crd(
9117-
current_thd, name, name_len, need_lock)))
9084+
current_thd, name, name_len)))
91189085
goto error;
91199086
if (
91209087
!(table_tables = spider_open_sys_table(
91219088
current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
9122-
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, need_lock,
9089+
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup,
91239090
&error_num))
91249091
) {
91259092
goto error;
@@ -9130,8 +9097,7 @@ int ha_spider::delete_table(
91309097
) {
91319098
goto error;
91329099
}
9133-
spider_close_sys_table(current_thd, table_tables,
9134-
&open_tables_backup, need_lock);
9100+
spider_sys_close_table(current_thd, &open_tables_backup);
91359101
table_tables = NULL;
91369102

91379103
/* release table mon list */
@@ -9155,8 +9121,7 @@ int ha_spider::delete_table(
91559121

91569122
error:
91579123
if (table_tables)
9158-
spider_close_sys_table(current_thd, table_tables,
9159-
&open_tables_backup, need_lock);
9124+
spider_sys_close_table(current_thd, &open_tables_backup);
91609125
DBUG_RETURN(error_num);
91619126
}
91629127

storage/spider/spd_copy_tables.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ int spider_udf_get_copy_tgt_tables(
355355
!(table_tables = spider_open_sys_table(
356356
thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
357357
SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup,
358-
need_lock, &error_num))
358+
&error_num))
359359
) {
360360
my_error(error_num, MYF(0));
361361
goto error;
@@ -543,8 +543,7 @@ int spider_udf_get_copy_tgt_tables(
543543
error_num = spider_sys_index_next_same(table_tables, table_key);
544544
} while (error_num == 0);
545545
spider_sys_index_end(table_tables);
546-
spider_close_sys_table(thd, table_tables,
547-
&open_tables_backup, need_lock);
546+
spider_sys_close_table(thd, &open_tables_backup);
548547
table_tables = NULL;
549548

550549
if (!copy_tables->table_conn[0])
@@ -566,8 +565,7 @@ int spider_udf_get_copy_tgt_tables(
566565

567566
error:
568567
if (table_tables)
569-
spider_close_sys_table(thd, table_tables,
570-
&open_tables_backup, need_lock);
568+
spider_sys_close_table(thd, &open_tables_backup);
571569
if (table_conn)
572570
{
573571
spider_free_tmp_dbton_share(tmp_share);

storage/spider/spd_ping_table.cc

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ int spider_get_ping_table_mon(
267267
!(table_link_mon = spider_open_sys_table(
268268
thd, SPIDER_SYS_LINK_MON_TABLE_NAME_STR,
269269
SPIDER_SYS_LINK_MON_TABLE_NAME_LEN, FALSE, &open_tables_backup,
270-
need_lock, &error_num))
270+
&error_num))
271271
) {
272272
my_error(error_num, MYF(0));
273273
goto error;
@@ -386,8 +386,7 @@ int spider_get_ping_table_mon(
386386
error_num = spider_sys_index_next_same(table_link_mon, table_key);
387387
} while (error_num == 0);
388388
spider_sys_index_end(table_link_mon);
389-
spider_close_sys_table(thd, table_link_mon,
390-
&open_tables_backup, need_lock);
389+
spider_sys_close_table(thd, &open_tables_backup);
391390
table_link_mon = NULL;
392391
table_mon_list->list_size = list_size;
393392

@@ -403,8 +402,7 @@ int spider_get_ping_table_mon(
403402

404403
error:
405404
if (table_link_mon)
406-
spider_close_sys_table(thd, table_link_mon,
407-
&open_tables_backup, need_lock);
405+
spider_sys_close_table(thd, &open_tables_backup);
408406
table_mon = table_mon_list->first;
409407
table_mon_list->first = NULL;
410408
table_mon_list->current = NULL;
@@ -474,7 +472,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
474472
if (
475473
!(table_tables = spider_open_sys_table(
476474
thd, SPIDER_SYS_TABLES_TABLE_NAME_STR,
477-
SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup, need_lock,
475+
SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup,
478476
error_num))
479477
) {
480478
my_error(*error_num, MYF(0));
@@ -512,8 +510,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
512510
table_tables->file->print_error(*error_num, MYF(0));
513511
goto error;
514512
}
515-
spider_close_sys_table(thd, table_tables,
516-
&open_tables_backup, need_lock);
513+
spider_sys_close_table(thd, &open_tables_backup);
517514
table_tables = NULL;
518515

519516
if (
@@ -576,8 +573,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
576573
error_caller_mutex_init:
577574
error:
578575
if (table_tables)
579-
spider_close_sys_table(thd, table_tables,
580-
&open_tables_backup, need_lock);
576+
spider_sys_close_table(thd, &open_tables_backup);
581577
free_root(&mem_root, MYF(0));
582578
if (table_mon_list)
583579
{
@@ -791,11 +787,10 @@ int spider_get_ping_table_gtid_pos(
791787
goto error_sys_index_end;
792788
}
793789
#ifdef SPIDER_REQUIRE_DEFINE_FOR_SECONDARY_OPEN_TABLES_BACKUP
794-
spider_close_sys_table(thd, table_gtid_pos,
790+
spider_sys_close_table(thd, table_gtid_pos,
795791
&open_tables_backup_gtid_pos, need_lock);
796792
#endif
797-
spider_close_sys_table(thd, table_tables, &open_tables_backup_tables,
798-
need_lock);
793+
spider_sys_close_table(thd, &open_tables_backup_tables);
799794

800795
DBUG_RETURN(0);
801796

@@ -806,13 +801,12 @@ int spider_get_ping_table_gtid_pos(
806801
error_sys_index_end:
807802
error_get_sys_table_by_idx:
808803
#ifdef SPIDER_REQUIRE_DEFINE_FOR_SECONDARY_OPEN_TABLES_BACKUP
809-
spider_close_sys_table(thd, table_gtid_pos,
804+
spider_sys_close_table(thd, table_gtid_pos,
810805
&open_tables_backup_gtid_pos,
811806
need_lock);
812807
error_open_table_gtid_pos:
813808
#endif
814-
spider_close_sys_table(thd, table_tables, &open_tables_backup_tables,
815-
need_lock);
809+
spider_sys_close_table(thd, &open_tables_backup_tables);
816810
error_open_table_tables:
817811
DBUG_RETURN(error_num);
818812
}
@@ -833,7 +827,7 @@ int spider_init_ping_table_mon_cache(
833827
!(table_link_mon = spider_open_sys_table(
834828
thd, SPIDER_SYS_LINK_MON_TABLE_NAME_STR,
835829
SPIDER_SYS_LINK_MON_TABLE_NAME_LEN, FALSE, &open_tables_backup,
836-
need_lock, &error_num))
830+
&error_num))
837831
) {
838832
my_error(error_num, MYF(0));
839833
goto error_open_sys_table;
@@ -921,7 +915,7 @@ int spider_init_ping_table_mon_cache(
921915
spider_mon_table_cache_version = spider_mon_table_cache_version_req;
922916
}
923917
pthread_mutex_unlock(&spider_mon_table_cache_mutex);
924-
spider_close_sys_table(thd, table_link_mon, &open_tables_backup, need_lock);
918+
spider_sys_close_table(thd, &open_tables_backup);
925919
DBUG_RETURN(0);
926920

927921
error_push_dynamic:
@@ -930,7 +924,7 @@ int spider_init_ping_table_mon_cache(
930924
spider_sys_index_end(table_link_mon);
931925
error_sys_index_first:
932926
pthread_mutex_unlock(&spider_mon_table_cache_mutex);
933-
spider_close_sys_table(thd, table_link_mon, &open_tables_backup, need_lock);
927+
spider_sys_close_table(thd, &open_tables_backup);
934928
error_open_sys_table:
935929
DBUG_RETURN(error_num);
936930
}
@@ -1223,9 +1217,9 @@ long long spider_ping_table_body(
12231217
conv_name_length, link_idx, SPIDER_LINK_STATUS_NG);
12241218
spider_sys_update_tables_link_status(trx->thd,
12251219
conv_name.c_ptr(), conv_name_length, link_idx,
1226-
SPIDER_LINK_STATUS_NG, TRUE);
1220+
SPIDER_LINK_STATUS_NG);
12271221
spider_sys_log_tables_link_failed(trx->thd,
1228-
conv_name.c_ptr(), conv_name_length, link_idx, TRUE);
1222+
conv_name.c_ptr(), conv_name_length, link_idx);
12291223
status_changed_to_ng = TRUE;
12301224
}
12311225
/*
@@ -1296,9 +1290,9 @@ long long spider_ping_table_body(
12961290
conv_name_length, link_idx, SPIDER_LINK_STATUS_NG);
12971291
spider_sys_update_tables_link_status(trx->thd,
12981292
conv_name.c_ptr(), conv_name_length, link_idx,
1299-
SPIDER_LINK_STATUS_NG, TRUE);
1293+
SPIDER_LINK_STATUS_NG);
13001294
spider_sys_log_tables_link_failed(trx->thd,
1301-
conv_name.c_ptr(), conv_name_length, link_idx, TRUE);
1295+
conv_name.c_ptr(), conv_name_length, link_idx);
13021296
status_changed_to_ng = TRUE;
13031297
}
13041298
/*
@@ -1359,9 +1353,9 @@ long long spider_ping_table_body(
13591353
conv_name_length, link_idx, SPIDER_LINK_STATUS_NG);
13601354
spider_sys_update_tables_link_status(trx->thd,
13611355
conv_name.c_ptr(), conv_name_length, link_idx,
1362-
SPIDER_LINK_STATUS_NG, TRUE);
1356+
SPIDER_LINK_STATUS_NG);
13631357
spider_sys_log_tables_link_failed(trx->thd,
1364-
conv_name.c_ptr(), conv_name_length, link_idx, TRUE);
1358+
conv_name.c_ptr(), conv_name_length, link_idx);
13651359
status_changed_to_ng = TRUE;
13661360
}
13671361
/*
@@ -1715,9 +1709,9 @@ int spider_ping_table_mon_from_table(
17151709
link_idx));
17161710
share->link_statuses[link_idx] = SPIDER_LINK_STATUS_NG;
17171711
spider_sys_update_tables_link_status(thd, conv_name,
1718-
conv_name_length, link_idx, SPIDER_LINK_STATUS_NG, need_lock);
1712+
conv_name_length, link_idx, SPIDER_LINK_STATUS_NG);
17191713
spider_sys_log_tables_link_failed(thd, conv_name,
1720-
conv_name_length, link_idx, need_lock);
1714+
conv_name_length, link_idx);
17211715
}
17221716
/*
17231717
pthread_mutex_unlock(&table_mon_list->update_status_mutex);

0 commit comments

Comments
 (0)