[Groonga-commit] groonga/groonga at 35fb549 [master] Add spec change log

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jul 28 11:52:46 JST 2016


Kouhei Sutou	2016-07-28 11:52:46 +0900 (Thu, 28 Jul 2016)

  New Revision: 35fb54962ce09f7e132697a78eba6068df921e3f
  https://github.com/groonga/groonga/commit/35fb54962ce09f7e132697a78eba6068df921e3f

  Message:
    Add spec change log

  Added files:
    test/command/suite/table_create/token_filters/log.expected
    test/command/suite/table_create/token_filters/log.test
  Modified files:
    lib/db.c
    test/command/suite/column_create/index/source/log.expected
    test/command/suite/column_remove/fix_size/with_index.expected
    test/command/suite/column_remove/fix_size/without_index.expected
    test/command/suite/column_remove/index.expected
    test/command/suite/column_remove/variable_size/with_index.expected
    test/command/suite/column_remove/variable_size/without_index.expected
    test/command/suite/table_remove/array/with_columns.expected
    test/command/suite/table_remove/array/without_columns.expected
    test/command/suite/table_remove/double_array_trie/with_columns.expected
    test/command/suite/table_remove/double_array_trie/without_columns.expected
    test/command/suite/table_remove/hash/with_columns.expected
    test/command/suite/table_remove/hash/without_columns.expected
    test/command/suite/table_remove/patricia_trie/with_columns.expected
    test/command/suite/table_remove/patricia_trie/without_columns.expected

  Modified: lib/db.c (+82 -8)
===================================================================
--- lib/db.c    2016-07-28 11:07:17 +0900 (df1f715)
+++ lib/db.c    2016-07-28 11:52:46 +0900 (c5e1d78)
@@ -8187,6 +8187,39 @@ grn_obj_spec_save(grn_ctx *ctx, grn_db_obj *obj)
     grn_vector_delimit(ctx, &v, 0, 0);
     break;
   }
+  {
+    const char *name;
+    uint32_t name_size = 0;
+    const char *range_name = NULL;
+    uint32_t range_name_size = 0;
+
+    name = _grn_table_key(ctx, s->keys, obj->id, &name_size);
+    switch (obj->header.type) {
+    case GRN_TABLE_HASH_KEY :
+    case GRN_TABLE_PAT_KEY :
+    case GRN_TABLE_DAT_KEY :
+    case GRN_TABLE_NO_KEY :
+    case GRN_COLUMN_FIX_SIZE :
+    case GRN_COLUMN_VAR_SIZE :
+    case GRN_COLUMN_INDEX :
+      if (obj->range != GRN_ID_NIL) {
+        range_name = _grn_table_key(ctx, s->keys, obj->range, &range_name_size);
+      }
+      break;
+    default :
+      break;
+    }
+    GRN_LOG(ctx, GRN_LOG_NOTICE,
+            "spec:%u:update:%.*s:%u(%s):%u%s%.*s%s",
+            obj->id,
+            name_size, name,
+            obj->header.type,
+            grn_obj_type_to_string(obj->header.type),
+            obj->range,
+            range_name_size == 0 ? "" : "(",
+            range_name_size, range_name,
+            range_name_size == 0 ? "" : ")");
+  }
   grn_ja_putv(ctx, s->specs, obj->id, &v, 0);
   grn_obj_close(ctx, &v);
 }
@@ -9155,11 +9188,31 @@ is_removable_table(grn_ctx *ctx, grn_obj *table, grn_obj *db)
   return removable;
 }
 
+static inline grn_rc
+_grn_obj_remove_spec(grn_ctx *ctx, grn_obj *db, grn_id id, uint8_t type)
+{
+  const char *name;
+  uint32_t name_size = 0;
+
+  name = _grn_table_key(ctx, db, id, &name_size);
+  GRN_LOG(ctx, GRN_LOG_NOTICE,
+          "spec:%u:remove:%.*s:%u(%s)",
+          id,
+          name_size, name,
+          type,
+          grn_obj_type_to_string(type));
+
+  return grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+}
+
 static grn_rc
 _grn_obj_remove_pat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                     const char *path, grn_bool dependent)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   if (dependent) {
     rc = remove_reference_tables(ctx, obj, db);
@@ -9183,7 +9236,7 @@ _grn_obj_remove_pat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_pat_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9199,6 +9252,9 @@ _grn_obj_remove_dat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                     const char *path, grn_bool dependent)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   if (dependent) {
     rc = remove_reference_tables(ctx, obj, db);
@@ -9222,7 +9278,7 @@ _grn_obj_remove_dat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_dat_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9238,6 +9294,9 @@ _grn_obj_remove_hash(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                      const char *path, grn_bool dependent)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   if (dependent) {
     rc = remove_reference_tables(ctx, obj, db);
@@ -9261,7 +9320,7 @@ _grn_obj_remove_hash(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_hash_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9277,6 +9336,9 @@ _grn_obj_remove_array(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                       const char *path, grn_bool dependent)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   if (dependent) {
     rc = remove_reference_tables(ctx, obj, db);
@@ -9298,7 +9360,7 @@ _grn_obj_remove_array(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_array_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9314,6 +9376,9 @@ _grn_obj_remove_ja(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                    const char *path)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   rc = remove_index(ctx, obj, GRN_HOOK_SET);
   if (rc != GRN_SUCCESS) { return rc; }
@@ -9323,7 +9388,7 @@ _grn_obj_remove_ja(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_ja_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9339,6 +9404,9 @@ _grn_obj_remove_ra(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                    const char *path)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   rc = remove_index(ctx, obj, GRN_HOOK_SET);
   if (rc != GRN_SUCCESS) { return rc; }
@@ -9348,7 +9416,7 @@ _grn_obj_remove_ra(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_ra_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9363,6 +9431,9 @@ _grn_obj_remove_index(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                       const char *path)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   delete_source_hook(ctx, obj);
   rc = grn_obj_close(ctx, obj);
@@ -9371,7 +9442,7 @@ _grn_obj_remove_index(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   if (path) {
     rc = grn_ii_remove(ctx, path);
     if (rc != GRN_SUCCESS) { return rc; }
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }
@@ -9387,6 +9458,9 @@ _grn_obj_remove_db_obj(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
                        const char *path)
 {
   grn_rc rc = GRN_SUCCESS;
+  uint8_t type;
+
+  type = obj->header.type;
 
   rc = grn_obj_close(ctx, obj);
   if (rc != GRN_SUCCESS) { return rc; }
@@ -9397,7 +9471,7 @@ _grn_obj_remove_db_obj(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
   }
 
   if (!(id & GRN_OBJ_TMP_OBJECT)) {
-    rc = grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    rc = _grn_obj_remove_spec(ctx, db, id, type);
     if (rc != GRN_SUCCESS) { return rc; }
     rc = grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
     if (rc != GRN_SUCCESS) { return rc; }

  Modified: test/command/suite/column_create/index/source/log.expected (+4 -0)
===================================================================
--- test/command/suite/column_create/index/source/log.expected    2016-07-28 11:07:17 +0900 (b671034)
+++ test/command/suite/column_create/index/source/log.expected    2016-07-28 11:52:46 +0900 (799e501)
@@ -9,4 +9,8 @@ table_create Lexicon TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram
 column_create Lexicon data_values COLUMN_INDEX|WITH_SECTION|WITH_POSITION   Data value1,value2
 [[0,0.0,0.0],true]
 #|n| DDL:260:column_create Lexicon data_values
+#|n| spec:260:update:Lexicon.data_values:72(column:index):256(Data)
 #|n| DDL:260:set_source Lexicon.data_values Data.value1,Data.value2
+#|n| spec:257:update:Data.value1:65(column:var_size):15(Text)
+#|n| spec:258:update:Data.value2:65(column:var_size):15(Text)
+#|n| spec:260:update:Lexicon.data_values:72(column:index):256(Data)

  Modified: test/command/suite/column_remove/fix_size/with_index.expected (+2 -0)
===================================================================
--- test/command/suite/column_remove/fix_size/with_index.expected    2016-07-28 11:07:17 +0900 (4eb7f45)
+++ test/command/suite/column_remove/fix_size/with_index.expected    2016-07-28 11:52:46 +0900 (9a498f7)
@@ -17,6 +17,8 @@ column_remove Users age
 [[0,0.0,0.0],true]
 #|n| DDL:257:obj_remove Users.age
 #|n| DDL:259:obj_remove Ages.users_age
+#|n| spec:259:remove:Ages.users_age:72(column:index)
+#|n| spec:257:remove:Users.age:64(column:fix_size)
 dump
 table_create Ages TABLE_PAT_KEY UInt8
 

  Modified: test/command/suite/column_remove/fix_size/without_index.expected (+1 -0)
===================================================================
--- test/command/suite/column_remove/fix_size/without_index.expected    2016-07-28 11:07:17 +0900 (d4e7431)
+++ test/command/suite/column_remove/fix_size/without_index.expected    2016-07-28 11:52:46 +0900 (ac1e530)
@@ -8,5 +8,6 @@ column_create Users age COLUMN_SCALAR UInt8
 column_remove Users age
 [[0,0.0,0.0],true]
 #|n| DDL:257:obj_remove Users.age
+#|n| spec:257:remove:Users.age:64(column:fix_size)
 dump
 table_create Users TABLE_PAT_KEY ShortText

  Modified: test/command/suite/column_remove/index.expected (+2 -0)
===================================================================
--- test/command/suite/column_remove/index.expected    2016-07-28 11:07:17 +0900 (ce57200)
+++ test/command/suite/column_remove/index.expected    2016-07-28 11:52:46 +0900 (e3b41e4)
@@ -16,6 +16,8 @@ column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name
 column_remove Terms users_name
 [[0,0.0,0.0],true]
 #|n| DDL:259:obj_remove Terms.users_name
+#|n| spec:257:update:Users.name:65(column:var_size):14(ShortText)
+#|n| spec:259:remove:Terms.users_name:72(column:index)
 dump
 table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
 

  Modified: test/command/suite/column_remove/variable_size/with_index.expected (+2 -0)
===================================================================
--- test/command/suite/column_remove/variable_size/with_index.expected    2016-07-28 11:07:17 +0900 (e4d0f8d)
+++ test/command/suite/column_remove/variable_size/with_index.expected    2016-07-28 11:52:46 +0900 (ed8d7f1)
@@ -17,6 +17,8 @@ column_remove Users name
 [[0,0.0,0.0],true]
 #|n| DDL:257:obj_remove Users.name
 #|n| DDL:259:obj_remove Terms.users_name
+#|n| spec:259:remove:Terms.users_name:72(column:index)
+#|n| spec:257:remove:Users.name:65(column:var_size)
 dump
 table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
 

  Modified: test/command/suite/column_remove/variable_size/without_index.expected (+1 -0)
===================================================================
--- test/command/suite/column_remove/variable_size/without_index.expected    2016-07-28 11:07:17 +0900 (15babb4)
+++ test/command/suite/column_remove/variable_size/without_index.expected    2016-07-28 11:52:46 +0900 (901326a)
@@ -8,5 +8,6 @@ column_create Users name COLUMN_SCALAR ShortText
 column_remove Users name
 [[0,0.0,0.0],true]
 #|n| DDL:257:obj_remove Users.name
+#|n| spec:257:remove:Users.name:65(column:var_size)
 dump
 table_create Users TABLE_PAT_KEY ShortText

  Added: test/command/suite/table_create/token_filters/log.expected (+8 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_create/token_filters/log.expected    2016-07-28 11:52:46 +0900 (01dea1e)
@@ -0,0 +1,8 @@
+plugin_register token_filters/stop_word
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto   --token_filters TokenFilterStopWord,TokenFilterStopWord
+[[0,0.0,0.0],true]
+#|n| DDL:257:table_create Terms
+#|n| spec:257:update:Terms:49(table:pat_key):0
+#|n| DDL:257:set_token_filters TokenFilterStopWord,TokenFilterStopWord
+#|n| spec:257:update:Terms:49(table:pat_key):0

  Added: test/command/suite/table_create/token_filters/log.test (+8 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_create/token_filters/log.test    2016-07-28 11:52:46 +0900 (58f7a25)
@@ -0,0 +1,8 @@
+plugin_register token_filters/stop_word
+
+#@add-important-log-levels notice
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto \
+  --token_filters TokenFilterStopWord,TokenFilterStopWord
+#@remove-important-log-levels notice

  Modified: test/command/suite/table_remove/array/with_columns.expected (+2 -0)
===================================================================
--- test/command/suite/table_remove/array/with_columns.expected    2016-07-28 11:07:17 +0900 (c1abea6)
+++ test/command/suite/table_remove/array/with_columns.expected    2016-07-28 11:52:46 +0900 (7c1235e)
@@ -9,4 +9,6 @@ table_remove Users
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Users
 #|n| DDL:257:obj_remove Users.name
+#|n| spec:257:remove:Users.name:65(column:var_size)
+#|n| spec:256:remove:Users:51(table:no_key)
 dump

  Modified: test/command/suite/table_remove/array/without_columns.expected (+1 -0)
===================================================================
--- test/command/suite/table_remove/array/without_columns.expected    2016-07-28 11:07:17 +0900 (f3fc987)
+++ test/command/suite/table_remove/array/without_columns.expected    2016-07-28 11:52:46 +0900 (2b1deea)
@@ -5,4 +5,5 @@ table_create Names TABLE_NO_KEY
 table_remove Names
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Names
+#|n| spec:256:remove:Names:51(table:no_key)
 dump

  Modified: test/command/suite/table_remove/double_array_trie/with_columns.expected (+2 -0)
===================================================================
--- test/command/suite/table_remove/double_array_trie/with_columns.expected    2016-07-28 11:07:17 +0900 (cd0aa73)
+++ test/command/suite/table_remove/double_array_trie/with_columns.expected    2016-07-28 11:52:46 +0900 (5be34ba)
@@ -9,4 +9,6 @@ table_remove Users
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Users
 #|n| DDL:257:obj_remove Users.name
+#|n| spec:257:remove:Users.name:65(column:var_size)
+#|n| spec:256:remove:Users:50(table:dat_key)
 dump

  Modified: test/command/suite/table_remove/double_array_trie/without_columns.expected (+1 -0)
===================================================================
--- test/command/suite/table_remove/double_array_trie/without_columns.expected    2016-07-28 11:07:17 +0900 (58ca009)
+++ test/command/suite/table_remove/double_array_trie/without_columns.expected    2016-07-28 11:52:46 +0900 (bf63ecd)
@@ -5,4 +5,5 @@ table_create Names TABLE_DAT_KEY ShortText
 table_remove Names
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Names
+#|n| spec:256:remove:Names:50(table:dat_key)
 dump

  Modified: test/command/suite/table_remove/hash/with_columns.expected (+2 -0)
===================================================================
--- test/command/suite/table_remove/hash/with_columns.expected    2016-07-28 11:07:17 +0900 (f1c1ebb)
+++ test/command/suite/table_remove/hash/with_columns.expected    2016-07-28 11:52:46 +0900 (70e5e7f)
@@ -9,4 +9,6 @@ table_remove Users
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Users
 #|n| DDL:257:obj_remove Users.name
+#|n| spec:257:remove:Users.name:65(column:var_size)
+#|n| spec:256:remove:Users:48(table:hash_key)
 dump

  Modified: test/command/suite/table_remove/hash/without_columns.expected (+1 -0)
===================================================================
--- test/command/suite/table_remove/hash/without_columns.expected    2016-07-28 11:07:17 +0900 (909a27f)
+++ test/command/suite/table_remove/hash/without_columns.expected    2016-07-28 11:52:46 +0900 (5e78641)
@@ -5,4 +5,5 @@ table_create Names TABLE_HASH_KEY ShortText
 table_remove Names
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Names
+#|n| spec:256:remove:Names:48(table:hash_key)
 dump

  Modified: test/command/suite/table_remove/patricia_trie/with_columns.expected (+2 -0)
===================================================================
--- test/command/suite/table_remove/patricia_trie/with_columns.expected    2016-07-28 11:07:17 +0900 (f5ba68c)
+++ test/command/suite/table_remove/patricia_trie/with_columns.expected    2016-07-28 11:52:46 +0900 (f61af42)
@@ -9,4 +9,6 @@ table_remove Users
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Users
 #|n| DDL:257:obj_remove Users.name
+#|n| spec:257:remove:Users.name:65(column:var_size)
+#|n| spec:256:remove:Users:49(table:pat_key)
 dump

  Modified: test/command/suite/table_remove/patricia_trie/without_columns.expected (+1 -0)
===================================================================
--- test/command/suite/table_remove/patricia_trie/without_columns.expected    2016-07-28 11:07:17 +0900 (13ec9c0)
+++ test/command/suite/table_remove/patricia_trie/without_columns.expected    2016-07-28 11:52:46 +0900 (7dc5238)
@@ -5,4 +5,5 @@ table_create Names TABLE_PAT_KEY ShortText
 table_remove Names
 [[0,0.0,0.0],true]
 #|n| DDL:256:obj_remove Names
+#|n| spec:256:remove:Names:49(table:pat_key)
 dump
-------------- next part --------------
HTML����������������������������...
下载 



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