[Groonga-commit] groonga/groonga at 45eee91 [master] dump: order index column by name instead of ID

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 25 13:48:50 JST 2016


Kouhei Sutou	2016-07-25 13:48:50 +0900 (Mon, 25 Jul 2016)

  New Revision: 45eee9163cffcad413cc0e2ea43ebaac81cf6eab
  https://github.com/groonga/groonga/commit/45eee9163cffcad413cc0e2ea43ebaac81cf6eab

  Message:
    dump: order index column by name instead of ID
    
    It breaks dump output compatibility but it can be restored as usual.

  Added files:
    test/command/suite/dump/schema/column/index/order.expected
    test/command/suite/dump/schema/column/index/order.test
  Modified files:
    lib/proc/proc_dump.c
    test/command/suite/dump/schema/plugin/suggest.expected
    test/command/suite/sharding/logical_table_remove/referenced/default.expected
    test/command/suite/sharding/logical_table_remove/referenced/dependent.expected

  Modified: lib/proc/proc_dump.c (+1 -1)
===================================================================
--- lib/proc/proc_dump.c    2016-07-25 13:35:23 +0900 (1667ba7)
+++ lib/proc/proc_dump.c    2016-07-25 13:48:50 +0900 (41b11d3)
@@ -944,7 +944,7 @@ dump_indexes(grn_ctx *ctx, grn_dumper *dumper)
   }
 
   GRN_TABLE_EACH_BEGIN_FLAGS(ctx, grn_ctx_db(ctx), cursor, id,
-                             GRN_CURSOR_BY_ID | GRN_CURSOR_ASCENDING) {
+                             GRN_CURSOR_BY_KEY | GRN_CURSOR_ASCENDING) {
     void *name;
     int name_size;
     grn_bool is_opened = GRN_TRUE;

  Added: test/command/suite/dump/schema/column/index/order.expected (+33 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/dump/schema/column/index/order.expected    2016-07-25 13:48:50 +0900 (f921c7b)
@@ -0,0 +1,33 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms users_name_index COLUMN_INDEX|WITH_POSITION Users name
+[[0,0.0,0.0],true]
+table_create Names TABLE_PAT_KEY ShortText   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Names users_name_index COLUMN_INDEX Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice", "name": "Alice"}
+]
+[[0,0.0,0.0],1]
+dump
+table_create Names TABLE_PAT_KEY ShortText --normalizer NormalizerAuto
+
+table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+
+load --table Users
+[
+["_key","name"],
+["alice","Alice"]
+]
+
+column_create Names users_name_index COLUMN_INDEX Users name
+column_create Terms users_name_index COLUMN_INDEX|WITH_POSITION Users name

  Added: test/command/suite/dump/schema/column/index/order.test (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/dump/schema/column/index/order.test    2016-07-25 13:48:50 +0900 (f17776d)
@@ -0,0 +1,18 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms users_name_index COLUMN_INDEX|WITH_POSITION Users name
+
+table_create Names TABLE_PAT_KEY ShortText \
+  --normalizer NormalizerAuto
+column_create Names users_name_index COLUMN_INDEX Users name
+
+load --table Users
+[
+{"_key": "alice", "name": "Alice"}
+]
+
+dump

  Modified: test/command/suite/dump/schema/plugin/suggest.expected (+1 -1)
===================================================================
--- test/command/suite/dump/schema/plugin/suggest.expected    2016-07-25 13:35:23 +0900 (cfd7d8e)
+++ test/command/suite/dump/schema/plugin/suggest.expected    2016-07-25 13:48:50 +0900 (23eecc0)
@@ -42,5 +42,5 @@ load --table configuration
 ]
 
 column_create bigram item_dataset_key COLUMN_INDEX|WITH_POSITION item_dataset _key
-column_create kana item_dataset_kana COLUMN_INDEX item_dataset kana
 column_create item_dataset co COLUMN_INDEX pair_dataset pre
+column_create kana item_dataset_kana COLUMN_INDEX item_dataset kana

  Modified: test/command/suite/sharding/logical_table_remove/referenced/default.expected (+1 -1)
===================================================================
--- test/command/suite/sharding/logical_table_remove/referenced/default.expected    2016-07-25 13:35:23 +0900 (4e21244)
+++ test/command/suite/sharding/logical_table_remove/referenced/default.expected    2016-07-25 13:48:50 +0900 (d17f626)
@@ -101,6 +101,6 @@ load --table Times_20150204
 [1423025400.0]
 ]
 
-column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
 column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
 column_create PathTerms_20150204 index COLUMN_INDEX|WITH_POSITION Paths_20150204 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp

  Modified: test/command/suite/sharding/logical_table_remove/referenced/dependent.expected (+1 -1)
===================================================================
--- test/command/suite/sharding/logical_table_remove/referenced/dependent.expected    2016-07-25 13:35:23 +0900 (f259298)
+++ test/command/suite/sharding/logical_table_remove/referenced/dependent.expected    2016-07-25 13:48:50 +0900 (8b1febc)
@@ -79,5 +79,5 @@ load --table Logs_20150203
 [2,"/var/",1422975599.0]
 ]
 
-column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
 column_create PathTerms_20150203 index COLUMN_INDEX|WITH_POSITION Paths_20150203 _key
+column_create Times_20150203 timestamp_index COLUMN_INDEX Logs_20150203 timestamp
-------------- next part --------------
HTML����������������������������...
下载 



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