diff options
author | Yuchen Pei <yuchen.pei@mariadb.com> | 2023-03-23 17:32:09 +1100 |
---|---|---|
committer | Yuchen Pei <yuchen.pei@mariadb.com> | 2023-03-24 12:43:38 +1100 |
commit | b56fb14b5c0363e80b1cf4e897f34c1a6a67e158 (patch) | |
tree | bb090263a83724fa4a1330b42eed4d5bb650ff95 | |
parent | 5499906df6bbd550f3dbcfdef3dea64ea3b1a221 (diff) | |
download | mariadb-git-bb-11.1-ycp-spider-maint.tar.gz |
MDEV-30265 Document some sts related functions in spider.bb-11.1-ycp-spider-maint
-rw-r--r-- | storage/spider/spd_db_mysql.cc | 7 | ||||
-rw-r--r-- | storage/spider/spd_sys_table.cc | 55 | ||||
-rw-r--r-- | storage/spider/spd_table.cc | 3 |
3 files changed, 64 insertions, 1 deletions
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index eadc3a59af8..af576bda65e 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -803,6 +803,7 @@ SPIDER_DB_ROW *spider_db_mbase_result::fetch_row_from_tmp_table( DBUG_RETURN((SPIDER_DB_ROW *) &row); } +/* Fetches table status into `stat` */ int spider_db_mbase_result::fetch_table_status( int mode, ha_statistics &stat @@ -13393,6 +13394,9 @@ int spider_mbase_handler::sts_mode_exchange( DBUG_RETURN(sts_mode); } +/** + Executes show table status query and stores results in share->stat. +*/ int spider_mbase_handler::show_table_status( int link_idx, int sts_mode, @@ -13423,7 +13427,7 @@ int spider_mbase_handler::show_table_status( share); if ( (error_num = spider_db_set_names(spider, conn, link_idx)) || - ( + ( /* Executes the `show table status` query */ spider_db_query( conn, mysql_share->show_table_status[0 + pos].ptr(), @@ -13536,6 +13540,7 @@ int spider_mbase_handler::show_table_status( conn->mta_conn_mutex_unlock_later = FALSE; SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); + /* Fetches query results into share->stat. */ error_num = res->fetch_table_status( sts_mode, share->stat diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index fdab66161d5..209e6dd7f93 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -979,6 +979,16 @@ void spider_store_xa_member_info( DBUG_VOID_RETURN; } +/** + Store the DB and table names in a table. + + If `name` starts with "./", separate out db and table names from + `name`. Otherwise store empty strings as names. + + @param table The table to store the info + @param name The name of the table + @param name_length The length of the name +*/ void spider_store_tables_name( TABLE *table, const char *name, @@ -1443,6 +1453,12 @@ void spider_store_binlog_pos_gtid( DBUG_VOID_RETURN; } +/** + Store sts info in the spider sts table. + + Stores all fields except the db name and table name, which are + stored in `spider_store_tables_name()`. +*/ void spider_store_table_sts_info( TABLE *table, ha_statistics *stat @@ -1595,6 +1611,18 @@ int spider_insert_sys_table( DBUG_RETURN(error_num); } +/** + Inserts or updates a row in the spider sts system table + + @param table The spider sts system table + @param name The name of the spider table whose stat will be + inserted / updated in the sts table + @param name_length Length of the name + @param stat The stat of the spider table that will be + inserted / updated in the sts table + + @retval 0 or error +*/ int spider_insert_or_update_table_sts( TABLE *table, const char *name, @@ -2716,6 +2744,14 @@ int spider_get_sys_tables_static_link_id( DBUG_RETURN(error_num); } +/** + Reads the table status from the system sts table + + The result is set into `stat` + + @param table The system sts table + @param stat The stat to read the table status into +*/ void spider_get_sys_table_sts_info( TABLE *table, ha_statistics *stat @@ -3207,6 +3243,16 @@ int spider_get_link_statuses( DBUG_RETURN(0); } +/** + Insert or update status of a table into the system sts table + + @param thd Connection + @param name Name of the table whose status will be stored + @param name_length Length of `name` + @param stat The table status that will be stored into the + system sts table + @param need_lock Unused (fixme) +*/ int spider_sys_insert_or_update_table_sts( THD *thd, const char *name, @@ -3345,6 +3391,15 @@ error: DBUG_RETURN(error_num); } +/** + Read table status of a table from the system sts table. + + @param thd Connection + @param name The name of the table for which to read status of + @param name_length The length `name` + @param stat The struct to read the status into + @param need_lock Unused (fixme) +*/ int spider_sys_get_table_sts( THD *thd, const char *name, diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index f8ebb9618e0..bdb3e7455cf 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -7138,8 +7138,11 @@ int spider_get_sts( if (need_to_get) { if (get_type == 0) + /* Copy table status from share to share->wide_share */ spider_copy_sts_to_share(share, share->wide_share); else { + /* Executes a `show table status` query and store the results in + share->stat */ error_num = spider_db_show_table_status(spider, link_idx, sts_mode, flag); } } |