[Groonga-commit] groonga/grnxx at a8a0db4 [master] Fix a bug that sweep() corrupts a doubly linked list.

Back to archive index

susumu.yata null+****@clear*****
Wed May 22 12:37:15 JST 2013


susumu.yata	2013-05-22 12:37:15 +0900 (Wed, 22 May 2013)

  New Revision: a8a0db47cd36cb020e954e35db523345e5b2e73f
  https://github.com/groonga/grnxx/commit/a8a0db47cd36cb020e954e35db523345e5b2e73f

  Message:
    Fix a bug that sweep() corrupts a doubly linked list.

  Modified files:
    lib/grnxx/storage/storage_impl.cpp

  Modified: lib/grnxx/storage/storage_impl.cpp (+10 -0)
===================================================================
--- lib/grnxx/storage/storage_impl.cpp    2013-05-22 07:24:16 +0900 (658f55c)
+++ lib/grnxx/storage/storage_impl.cpp    2013-05-22 12:37:15 +0900 (cc5c944)
@@ -800,12 +800,22 @@ bool StorageImpl::sweep_subtree(Time threshold, NodeHeader *node_header) {
 
 bool StorageImpl::merge_idle_nodes(NodeHeader *node_header,
                                    NodeHeader *next_node_header) {
+  NodeHeader *next_next_node_header = nullptr;
+  if (next_node_header->next_node_id != STORAGE_INVALID_NODE_ID) {
+    next_next_node_header = get_node_header(next_node_header->next_node_id);
+    if (!next_next_node_header) {
+      return false;
+    }
+  }
   if (!unregister_idle_node(node_header) ||
       !unregister_idle_node(next_node_header)) {
     return false;
   }
   node_header->size += next_node_header->size;
   node_header->next_node_id = next_node_header->next_node_id;
+  if (next_next_node_header) {
+    next_next_node_header->prev_node_id = node_header->id;
+  }
   *next_node_header = NodeHeader(next_node_header->id);
   next_node_header->next_phantom_node_id = header_->latest_phantom_node_id;
   next_node_header->modified_time = clock_.now();
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index