susumu.yata
null+****@clear*****
Tue Aug 6 12:02:13 JST 2013
susumu.yata 2013-08-06 12:02:13 +0900 (Tue, 06 Aug 2013) New Revision: 7b64ec8ab6608c858488a1a5029140cca32f64c3 https://github.com/groonga/grnxx/commit/7b64ec8ab6608c858488a1a5029140cca32f64c3 Message: Refresh components before defragmentation. Modified files: lib/grnxx/map/hash_table.cpp lib/grnxx/map/patricia.cpp Modified: lib/grnxx/map/hash_table.cpp (+5 -0) =================================================================== --- lib/grnxx/map/hash_table.cpp 2013-08-06 11:52:56 +0900 (fbe6513) +++ lib/grnxx/map/hash_table.cpp 2013-08-06 12:02:13 +0900 (72d30d5) @@ -336,6 +336,11 @@ bool HashTable<T>::replace(KeyArg src_key, KeyArg dest_key, int64_t *key_id) { template <typename T> void HashTable<T>::defrag(double usage_rate_threshold) { + refresh_table(); + if (max_key_id() == MAP_MIN_KEY_ID) { + // Nothing to do. + return; + } rebuild(); pool_->defrag(usage_rate_threshold); } Modified: lib/grnxx/map/patricia.cpp (+5 -0) =================================================================== --- lib/grnxx/map/patricia.cpp 2013-08-06 11:52:56 +0900 (f69cbbe) +++ lib/grnxx/map/patricia.cpp 2013-08-06 12:02:13 +0900 (04d4651) @@ -1475,6 +1475,11 @@ bool Patricia<Bytes>::find_longest_prefix_match(KeyArg query, int64_t *key_id, } void Patricia<Bytes>::defrag(double usage_rate_threshold) { + refresh_nodes(); + if (max_key_id() == MAP_MIN_KEY_ID) { + // Nothing to do. + return; + } defrag_nodes(); pool_->defrag(usage_rate_threshold); } -------------- next part -------------- HTML����������������������������... 下載