[Groonga-commit] groonga/groonga at f151bfd [master] grn_db_recover: reduce memory usage when only 1 thread mode

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Wed Jan 4 23:21:49 JST 2017


Kouhei Sutou	2017-01-04 23:21:49 +0900 (Wed, 04 Jan 2017)

  New Revision: f151bfd2d6ea803508fe9e597de0e6aeebfefe9c
  https://github.com/groonga/groonga/commit/f151bfd2d6ea803508fe9e597de0e6aeebfefe9c

  Message:
    grn_db_recover: reduce memory usage when only 1 thread mode

  Modified files:
    lib/db.c

  Modified: lib/db.c (+11 -0)
===================================================================
--- lib/db.c    2017-01-04 13:35:49 +0900 (ae4d877)
+++ lib/db.c    2017-01-04 23:21:49 +0900 (62c264b)
@@ -14780,9 +14780,12 @@ grn_db_recover(grn_ctx *ctx, grn_obj *db)
 {
   grn_table_cursor *cursor;
   grn_id id;
+  grn_bool is_close_opened_object_mode;
 
   GRN_API_ENTER;
 
+  is_close_opened_object_mode = (grn_thread_get_limit() == 1);
+
   grn_db_recover_database(ctx, db);
   if (ctx->rc != GRN_SUCCESS) {
     GRN_API_RETURN(ctx->rc);
@@ -14799,6 +14802,10 @@ grn_db_recover(grn_ctx *ctx, grn_obj *db)
   while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) {
     grn_obj *object;
 
+    if (is_close_opened_object_mode) {
+      grn_ctx_push_temporary_open_space(ctx);
+    }
+
     if ((object = grn_ctx_at(ctx, id))) {
       switch (object->header.type) {
       case GRN_TABLE_NO_KEY :
@@ -14824,6 +14831,10 @@ grn_db_recover(grn_ctx *ctx, grn_obj *db)
       }
     }
 
+    if (is_close_opened_object_mode) {
+      grn_ctx_pop_temporary_open_space(ctx);
+    }
+
     if (ctx->rc != GRN_SUCCESS) {
       break;
     }
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る