Commit 27fcdb16 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all...

MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default (#1328)

followup for be5c432a

ha_partition::calculate_checksum() has to invoke calculate_checksum()
for partitions unconditionally, not under (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM).
Because the server uses ::info() to ask for a live checksum, while
calculate_checksum() must, precisely, calculate it the slow way,
also for tables that don't have the live checksum at all.

Also, fix the compilation on Windows (ha_checksum/ulonglong type mix).
parent bb70d419
...@@ -10645,22 +10645,20 @@ int ha_partition::calculate_checksum() ...@@ -10645,22 +10645,20 @@ int ha_partition::calculate_checksum()
} }
} }
m_pre_calling= FALSE; m_pre_calling= FALSE;
if ((table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM)))
handler **file= m_file;
do
{ {
handler **file= m_file; if ((error= (*file)->calculate_checksum()))
do
{ {
if ((error= (*file)->calculate_checksum())) DBUG_RETURN(error);
{ }
DBUG_RETURN(error); if (!(*file)->stats.checksum_null)
} {
if (!(*file)->stats.checksum_null) stats.checksum+= (*file)->stats.checksum;
{ stats.checksum_null= FALSE;
stats.checksum+= (*file)->stats.checksum; }
stats.checksum_null= FALSE; } while (*(++file));
}
} while (*(++file));
}
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -5054,7 +5054,7 @@ int handler::calculate_checksum() ...@@ -5054,7 +5054,7 @@ int handler::calculate_checksum()
return HA_ERR_ABORTED_BY_USER; return HA_ERR_ABORTED_BY_USER;
ha_checksum row_crc= 0; ha_checksum row_crc= 0;
error= table->file->ha_rnd_next(table->record[0]); error= ha_rnd_next(table->record[0]);
if (error) if (error)
break; break;
...@@ -5108,7 +5108,7 @@ int handler::calculate_checksum() ...@@ -5108,7 +5108,7 @@ int handler::calculate_checksum()
stats.checksum+= row_crc; stats.checksum+= row_crc;
} }
table->file->ha_rnd_end(); ha_rnd_end();
return error == HA_ERR_END_OF_FILE ? 0 : error; return error == HA_ERR_END_OF_FILE ? 0 : error;
} }
......
...@@ -245,7 +245,7 @@ class ha_spider: public handler ...@@ -245,7 +245,7 @@ class ha_spider: public handler
#endif #endif
ha_rows table_rows; ha_rows table_rows;
#ifdef HA_HAS_CHECKSUM_EXTENDED #ifdef HA_HAS_CHECKSUM_EXTENDED
ulonglong checksum_val; ha_checksum checksum_val;
bool checksum_null; bool checksum_null;
uint action_flags; uint action_flags;
#endif #endif
......
...@@ -1142,9 +1142,9 @@ int spider_db_mbase_result::fetch_simple_action( ...@@ -1142,9 +1142,9 @@ int spider_db_mbase_result::fetch_simple_action(
if (mysql_row[position]) if (mysql_row[position])
{ {
spider->checksum_val = spider->checksum_val =
(ulonglong) my_strtoll10(mysql_row[position], (char**) NULL, (ha_checksum) my_strtoll10(mysql_row[position], (char**) NULL,
&error_num); &error_num);
DBUG_PRINT("info", ("spider checksum=%llu", spider->checksum_val)); DBUG_PRINT("info", ("spider checksum=%llu", (ulonglong)spider->checksum_val));
spider->checksum_null = FALSE; spider->checksum_null = FALSE;
} else { } else {
spider->checksum_null = TRUE; spider->checksum_null = TRUE;
......
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