diff --git a/src/ckdb.h b/src/ckdb.h index 0fe69735..db78d7ab 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.302" +#define CKDB_VERSION DB_VERSION"-2.303" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index 96718995..a6cec406 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -4924,13 +4924,26 @@ flail: } k_list_transfer_to_head(new_markersummary_store, markersummary_store); - ks_item = STORE_HEAD_NOLOCK(new_keysummary_store); - while (ks_item) { - // move the new keysummaries into the tree - add_to_ktree(keysummary_root, ks_item); - ks_item = ks_item->next; + if (!key_update) { + ks_item = STORE_HEAD_NOLOCK(new_keysummary_store); + while (ks_item) { + // move the new keysummaries into the tree + add_to_ktree(keysummary_root, ks_item); + ks_item = ks_item->next; + } + k_list_transfer_to_head(new_keysummary_store, + keysummary_store); + } else { + /* Discard the new data to save RAM, + * since we don't actually use it in key_update */ + ks_item = STORE_HEAD_NOLOCK(new_keysummary_store); + while (ks_item) { + free_keysummary_data(ks_item); + ks_item = ks_item->next; + } + k_list_transfer_to_head(new_keysummary_store, + keysummary_free); } - k_list_transfer_to_head(new_keysummary_store, keysummary_store); /* For normal shift processing this wont be very quick * so it will be a 'long' LOCK */ @@ -4996,7 +5009,8 @@ flail: nonblank ? EMPTY : " ONLY BLANK KEYS"); // This should never happen - if (kshareacc != (shareacc << 1) || kdiffacc != (diffacc << 1)) { + if (!key_update && (kshareacc != (shareacc << 1) || + kdiffacc != (diffacc << 1))) { LOGERR("%s() CODE BUG: keysummary share/diff counts " "are wrong!", shortname); }