Skip to content
Permalink
Browse files

fix segmentfalt error when table data_free is too big

  • Loading branch information...
arstercz committed Sep 23, 2019
1 parent 1a78a95 commit 0217bbd1e0e57b3ba785978250ab2ad5c2170cca
Showing with 9 additions and 7 deletions.
  1. +9 −7 client/mysql.cc
@@ -3527,7 +3527,9 @@ before alter table, current database is null.\n\n");
}

char sqlSize[350];
sprintf(sqlSize, "select round(sum(DATA_LENGTH+INDEX_LENGTH+DATA_FREE)/1024/1024) \
// ignore DATA_FREE, as TokuDB's DATA_FREE may be too big.
// read more from https://jira.percona.com/browse/PS-5704
sprintf(sqlSize, "select round(sum(DATA_LENGTH+INDEX_LENGTH)/1024/1024) \
as size from information_schema.tables \
where table_schema = '%s' and table_name = '%s'",
dbname, tablename);
@@ -3539,19 +3541,19 @@ before alter table, current database is null.\n\n");
}
MYSQL_RES *result_msg = mysql_store_result(&mysql);
if (result_msg == NULL) {
//fprintf(stderr, "\t[WARN] - cann't find %s.%s\n",
// mysql.db, TableName);
//return 0;
fprintf(stderr, "\t[WARN] - cann't find %s.%s, error: %s\n",
mysql.db, TableName, mysql_error(&mysql));
return 0;
}
int tableSize = 0;
MYSQL_ROW row_result;
while ((row_result = mysql_fetch_row(result_msg)))
{
if (row_result[0] == NULL)
{
//fprintf(stderr, "\t[WARN] - cann't get %s.%s size\n",
// dbname, TableName);
//return 0;
fprintf(stderr, "\t[WARN] - cann't get %s.%s size\n",
dbname, TableName);
return 0;
} else
if (opt_sql_filter) {
tableSize = atoi(row_result[0]);

0 comments on commit 0217bbd

Please sign in to comment.
You can’t perform that action at this time.