From 4873adace0826765ec330063330d6ce9481a4b8b Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Mon, 7 Feb 2005 08:51:27 +0100 Subject: [PATCH 1/2] Corrected fragmentation calculation to take into account that LQH creates "2 fragments per fragment" in 4.1 and 5.0 +added some comments to ndb fragmentation calulation --- sql/ha_ndbcluster.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9f0da616289..b4e05ace27b 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3513,18 +3513,23 @@ static void ndb_set_fragmentation(NDBTAB &tab, TABLE *form, uint pk_length) uint no_fragments; { #if MYSQL_VERSION_ID >= 50000 - uint acc_row_size= 25+2; + uint acc_row_size= 25 + /*safety margin*/ 2; #else uint acc_row_size= pk_length*4; /* add acc overhead */ - if (pk_length <= 8) - acc_row_size+= 25+2; /* main page will set the limit */ - else - acc_row_size+= 4+4; /* overflow page will set the limit */ + if (pk_length <= 8) /* main page will set the limit */ + acc_row_size+= 25 + /*safety margin*/ 2; + else /* overflow page will set the limit */ + acc_row_size+= 4 + /*safety margin*/ 4; #endif ulonglong acc_fragment_size= 512*1024*1024; ulonglong max_rows= form->max_rows; +#if MYSQL_VERSION_ID >= 50100 + no_fragments= ((max_rows*acc_row_size)/acc_fragment_size+1 + +1/*correct rounding*/)/2; +#else no_fragments= (max_rows*acc_row_size)/acc_fragment_size+1; +#endif } { uint no_nodes= g_ndb_cluster_connection->no_db_nodes(); From 6bbaeed5b96da2ff56c3d118f4a44b8d992e3cf9 Mon Sep 17 00:00:00 2001 From: "tomas@poseidon.ndb.mysql.com" <> Date: Mon, 7 Feb 2005 09:58:37 +0100 Subject: [PATCH 2/2] ha_ndbcluster.cc: corrected typo in previous changeset --- sql/ha_ndbcluster.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index b4e05ace27b..9e34baae198 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3525,10 +3525,10 @@ static void ndb_set_fragmentation(NDBTAB &tab, TABLE *form, uint pk_length) ulonglong acc_fragment_size= 512*1024*1024; ulonglong max_rows= form->max_rows; #if MYSQL_VERSION_ID >= 50100 + no_fragments= (max_rows*acc_row_size)/acc_fragment_size+1; +#else no_fragments= ((max_rows*acc_row_size)/acc_fragment_size+1 +1/*correct rounding*/)/2; -#else - no_fragments= (max_rows*acc_row_size)/acc_fragment_size+1; #endif } {