Skip to content

Commit

Permalink
fix divided lock table issue of Spider
Browse files Browse the repository at this point in the history
  • Loading branch information
Kentoku committed Jun 5, 2020
1 parent 418f161 commit d3a6ed0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
54 changes: 52 additions & 2 deletions storage/spider/ha_spider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,26 @@ THR_LOCK_DATA **ha_spider::store_lock(
!spider_param_local_lock_table(thd)
) {
wide_handler->lock_table_type = 1;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_handler_share && partition_handler_share->handlers)
{
uint roop_count;
for (roop_count = 0; roop_count < partition_handler_share->no_parts;
++roop_count)
{
if (unlikely((store_error_num =
partition_handler_share->handlers[roop_count]->
append_lock_tables_list())))
{
break;
}
}
} else {
#endif
store_error_num = append_lock_tables_list();
#ifdef WITH_PARTITION_STORAGE_ENGINE
}
#endif
}
} else {
DBUG_PRINT("info",("spider default lock route"));
Expand All @@ -1181,6 +1201,27 @@ THR_LOCK_DATA **ha_spider::store_lock(
spider_param_semi_table_lock(thd, wide_handler->semi_table_lock)
) {
wide_handler->lock_table_type = 2;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_handler_share && partition_handler_share->handlers)
{
uint roop_count;
for (roop_count = 0;
roop_count < partition_handler_share->no_parts;
++roop_count)
{
if (unlikely((store_error_num =
partition_handler_share->handlers[roop_count]->
append_lock_tables_list())))
{
break;
}
}
} else {
#endif
store_error_num = append_lock_tables_list();
#ifdef WITH_PARTITION_STORAGE_ENGINE
}
#endif
}
}
if (
Expand Down Expand Up @@ -16014,10 +16055,10 @@ int ha_spider::set_union_table_name_pos_sql()
DBUG_RETURN(0);
}

int ha_spider::lock_tables()
int ha_spider::append_lock_tables_list()
{
int error_num, roop_count;
DBUG_ENTER("ha_spider::lock_tables");
DBUG_ENTER("ha_spider::append_lock_tables_list");
DBUG_PRINT("info",("spider lock_table_type=%u",
wide_handler->lock_table_type));

Expand Down Expand Up @@ -16081,6 +16122,15 @@ int ha_spider::lock_tables()
}
}
}
DBUG_RETURN(0);
}

int ha_spider::lock_tables()
{
int error_num, roop_count;
DBUG_ENTER("ha_spider::lock_tables");
DBUG_PRINT("info",("spider lock_table_type=%u",
wide_handler->lock_table_type));

#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if ((conn_kinds & SPIDER_CONN_KIND_MYSQL))
Expand Down
1 change: 1 addition & 0 deletions storage/spider/ha_spider.h
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ class ha_spider: public handler
#endif
int init_union_table_name_pos_sql();
int set_union_table_name_pos_sql();
int append_lock_tables_list();
int lock_tables();
int dml_init();
#ifdef HA_CAN_BULK_ACCESS
Expand Down

0 comments on commit d3a6ed0

Please sign in to comment.