Kouhei Sutou
null+****@clear*****
Fri Aug 26 17:25:04 JST 2016
Kouhei Sutou 2016-07-28 11:07:17 +0900 (Thu, 28 Jul 2016) New Revision: 087e08235d7652e452776a27871bfdb5c9ad79f8 https://github.com/groonga/groonga/commit/087e08235d7652e452776a27871bfdb5c9ad79f8 Message: Add object ID to DDL change log Added files: test/command/suite/column_create/index/source/log.expected test/command/suite/column_create/index/source/log.test Modified files: lib/db.c test/command/suite/column_remove/fix_size/with_index.expected test/command/suite/column_remove/fix_size/with_index.test test/command/suite/column_remove/fix_size/without_index.expected test/command/suite/column_remove/fix_size/without_index.test test/command/suite/column_remove/index.expected test/command/suite/column_remove/index.test test/command/suite/column_remove/variable_size/with_index.expected test/command/suite/column_remove/variable_size/with_index.test test/command/suite/column_remove/variable_size/without_index.expected test/command/suite/column_remove/variable_size/without_index.test test/command/suite/table_remove/array/with_columns.expected test/command/suite/table_remove/array/with_columns.test test/command/suite/table_remove/array/without_columns.expected test/command/suite/table_remove/array/without_columns.test test/command/suite/table_remove/double_array_trie/with_columns.expected test/command/suite/table_remove/double_array_trie/with_columns.test test/command/suite/table_remove/double_array_trie/without_columns.expected test/command/suite/table_remove/double_array_trie/without_columns.test test/command/suite/table_remove/hash/with_columns.expected test/command/suite/table_remove/hash/with_columns.test test/command/suite/table_remove/hash/without_columns.expected test/command/suite/table_remove/hash/without_columns.test test/command/suite/table_remove/patricia_trie/with_columns.expected test/command/suite/table_remove/patricia_trie/with_columns.test test/command/suite/table_remove/patricia_trie/without_columns.expected test/command/suite/table_remove/patricia_trie/without_columns.test Modified: lib/db.c (+29 -12) =================================================================== --- lib/db.c 2016-07-27 19:24:57 +0900 (d8fc06f) +++ lib/db.c 2016-07-28 11:07:17 +0900 (df1f715) @@ -1175,7 +1175,8 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name, id = grn_obj_register(ctx, db, name, name_size); if (ERRP(ctx, GRN_ERROR)) { return NULL; } if (GRN_OBJ_PERSISTENT & flags) { - GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:table_create %.*s", name_size, name); + GRN_LOG(ctx, GRN_LOG_NOTICE, + "DDL:%u:table_create %.*s", id, name_size, name); if (!path) { if (GRN_DB_PERSISTENT_P(db)) { grn_db_generate_pathname(ctx, db, id, buffer); @@ -4759,12 +4760,6 @@ grn_column_create(grn_ctx *ctx, grn_obj *table, domain = DB_OBJ(table)->id; is_persistent_table = !(domain & GRN_OBJ_TMP_OBJECT); - if (is_persistent_table) { - uint32_t s = 0; - const char *n = _grn_table_key(ctx, ctx->impl->db, domain, &s); - GRN_LOG(ctx, GRN_LOG_NOTICE, - "DDL:column_create %.*s %.*s", s, n, name_size, name); - } if (!domain) { ERR(GRN_FUNCTION_NOT_IMPLEMENTED, @@ -4822,6 +4817,17 @@ grn_column_create(grn_ctx *ctx, grn_obj *table, if (is_persistent_table) { id = grn_obj_register(ctx, db, fullname, name_size); if (ERRP(ctx, GRN_ERROR)) { goto exit; } + + { + uint32_t table_name_size = 0; + const char *table_name; + table_name = _grn_table_key(ctx, ctx->impl->db, domain, &table_name_size); + GRN_LOG(ctx, GRN_LOG_NOTICE, + "DDL:%u:column_create %.*s %.*s", + id, + table_name_size, table_name, + name_size, name); + } } else { int added; id = grn_pat_add(ctx, ctx->impl->temporary_columns, @@ -8325,7 +8331,11 @@ grn_obj_set_info_source_log(grn_ctx *ctx, grn_obj *obj, grn_obj *value) grn_obj buf; grn_id *vp = (grn_id *)GRN_BULK_HEAD(value); uint32_t vs = GRN_BULK_VSIZE(value), s = 0; - const char *n = _grn_table_key(ctx, ctx->impl->db, DB_OBJ(obj)->id, &s); + grn_id id; + const char *n; + + id = DB_OBJ(obj)->id; + n = _grn_table_key(ctx, ctx->impl->db, id, &s); GRN_TEXT_INIT(&buf, 0); GRN_TEXT_PUT(ctx, &buf, n, s); GRN_TEXT_PUTC(ctx, &buf, ' '); @@ -8335,7 +8345,9 @@ grn_obj_set_info_source_log(grn_ctx *ctx, grn_obj *obj, grn_obj *value) vs -= sizeof(grn_id); if (vs) { GRN_TEXT_PUTC(ctx, &buf, ','); } } - GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:set_source %.*s", + GRN_LOG(ctx, GRN_LOG_NOTICE, + "DDL:%u:set_source %.*s", + id, (int)GRN_BULK_VSIZE(&buf), GRN_BULK_HEAD(&buf)); GRN_OBJ_FIN(ctx, &buf); } @@ -8440,7 +8452,8 @@ grn_obj_set_info_token_filters(grn_ctx *ctx, token_filter_name_size); } if (n_token_filters > 0 || n_token_filters != n_current_token_filters) { - GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:set_token_filters %.*s", + GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:%u:set_token_filters %.*s", + DB_OBJ(table)->id, (int)GRN_BULK_VSIZE(&token_filter_names), GRN_BULK_HEAD(&token_filter_names)); } @@ -9411,10 +9424,14 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj, grn_bool dependent) const char *io_path; char *path; if (ctx->impl && ctx->impl->db) { + grn_id id; uint32_t s = 0; - const char *n = _grn_table_key(ctx, ctx->impl->db, DB_OBJ(obj)->id, &s); + const char *n; + + id = DB_OBJ(obj)->id; + n = _grn_table_key(ctx, ctx->impl->db, id, &s); if (s > 0) { - GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:obj_remove %.*s", s, n); + GRN_LOG(ctx, GRN_LOG_NOTICE, "DDL:%u:obj_remove %.*s", id, s, n); } } if (obj->header.type != GRN_PROC && Added: test/command/suite/column_create/index/source/log.expected (+12 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/column_create/index/source/log.expected 2016-07-28 11:07:17 +0900 (b671034) @@ -0,0 +1,12 @@ +table_create Data TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Data value1 COLUMN_SCALAR Text +[[0,0.0,0.0],true] +column_create Data value2 COLUMN_SCALAR Text +[[0,0.0,0.0],true] +table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +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| DDL:260:set_source Lexicon.data_values Data.value1,Data.value2 Added: test/command/suite/column_create/index/source/log.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/column_create/index/source/log.test 2016-07-28 11:07:17 +0900 (9e64683) @@ -0,0 +1,12 @@ +table_create Data TABLE_NO_KEY +column_create Data value1 COLUMN_SCALAR Text +column_create Data value2 COLUMN_SCALAR Text + +table_create Lexicon TABLE_PAT_KEY ShortText \ + --default_tokenizer TokenBigram \ + --normalizer NormalizerAuto + +#@add-important-log-levels notice +column_create Lexicon data_values COLUMN_INDEX|WITH_SECTION|WITH_POSITION \ + Data value1,value2 +#@remove-important-log-levels notice 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-27 19:24:57 +0900 (a0d2107) +++ test/command/suite/column_remove/fix_size/with_index.expected 2016-07-28 11:07:17 +0900 (4eb7f45) @@ -15,6 +15,8 @@ column_create Users age COLUMN_SCALAR UInt8 column_create Ages users_age COLUMN_INDEX Users age 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 dump table_create Ages TABLE_PAT_KEY UInt8 Modified: test/command/suite/column_remove/fix_size/with_index.test (+2 -0) =================================================================== --- test/command/suite/column_remove/fix_size/with_index.test 2016-07-27 19:24:57 +0900 (3c14ad7) +++ test/command/suite/column_remove/fix_size/with_index.test 2016-07-28 11:07:17 +0900 (bfa900c) @@ -6,6 +6,8 @@ column_create Ages users_age COLUMN_INDEX Users age dump +#@add-important-log-levels notice column_remove Users age +#@remove-important-log-levels notice dump 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-27 19:24:57 +0900 (2b33bdb) +++ test/command/suite/column_remove/fix_size/without_index.expected 2016-07-28 11:07:17 +0900 (d4e7431) @@ -7,5 +7,6 @@ table_create Users TABLE_PAT_KEY ShortText column_create Users age COLUMN_SCALAR UInt8 column_remove Users age [[0,0.0,0.0],true] +#|n| DDL:257:obj_remove Users.age dump table_create Users TABLE_PAT_KEY ShortText Modified: test/command/suite/column_remove/fix_size/without_index.test (+2 -0) =================================================================== --- test/command/suite/column_remove/fix_size/without_index.test 2016-07-27 19:24:57 +0900 (2ec953f) +++ test/command/suite/column_remove/fix_size/without_index.test 2016-07-28 11:07:17 +0900 (b2fd3de) @@ -3,6 +3,8 @@ column_create Users age COLUMN_SCALAR UInt8 dump +#@add-important-log-levels notice column_remove Users age +#@remove-important-log-levels notice dump Modified: test/command/suite/column_remove/index.expected (+1 -0) =================================================================== --- test/command/suite/column_remove/index.expected 2016-07-27 19:24:57 +0900 (4457e6b) +++ test/command/suite/column_remove/index.expected 2016-07-28 11:07:17 +0900 (ce57200) @@ -15,6 +15,7 @@ column_create Users name COLUMN_SCALAR ShortText 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 dump table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto Modified: test/command/suite/column_remove/index.test (+2 -0) =================================================================== --- test/command/suite/column_remove/index.test 2016-07-27 19:24:57 +0900 (063c2c4) +++ test/command/suite/column_remove/index.test 2016-07-28 11:07:17 +0900 (8ca439a) @@ -8,6 +8,8 @@ column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name dump +#@add-important-log-levels notice column_remove Terms users_name +#@remove-important-log-levels notice dump 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-27 19:24:57 +0900 (ee5cee5) +++ test/command/suite/column_remove/variable_size/with_index.expected 2016-07-28 11:07:17 +0900 (e4d0f8d) @@ -15,6 +15,8 @@ column_create Users name COLUMN_SCALAR ShortText column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name 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 dump table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto Modified: test/command/suite/column_remove/variable_size/with_index.test (+2 -0) =================================================================== --- test/command/suite/column_remove/variable_size/with_index.test 2016-07-27 19:24:57 +0900 (9981359) +++ test/command/suite/column_remove/variable_size/with_index.test 2016-07-28 11:07:17 +0900 (12af385) @@ -8,6 +8,8 @@ column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name dump +#@add-important-log-levels notice column_remove Users name +#@remove-important-log-levels notice dump 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-27 19:24:57 +0900 (8196096) +++ test/command/suite/column_remove/variable_size/without_index.expected 2016-07-28 11:07:17 +0900 (15babb4) @@ -7,5 +7,6 @@ table_create Users TABLE_PAT_KEY ShortText column_create Users name COLUMN_SCALAR ShortText column_remove Users name [[0,0.0,0.0],true] +#|n| DDL:257:obj_remove Users.name dump table_create Users TABLE_PAT_KEY ShortText Modified: test/command/suite/column_remove/variable_size/without_index.test (+2 -0) =================================================================== --- test/command/suite/column_remove/variable_size/without_index.test 2016-07-27 19:24:57 +0900 (152ae04) +++ test/command/suite/column_remove/variable_size/without_index.test 2016-07-28 11:07:17 +0900 (4f2751b) @@ -3,6 +3,8 @@ column_create Users name COLUMN_SCALAR ShortText dump +#@add-important-log-levels notice column_remove Users name +#@remove-important-log-levels notice dump Modified: test/command/suite/table_remove/array/with_columns.expected (+2 -0) =================================================================== --- test/command/suite/table_remove/array/with_columns.expected 2016-07-27 19:24:57 +0900 (becfb98) +++ test/command/suite/table_remove/array/with_columns.expected 2016-07-28 11:07:17 +0900 (c1abea6) @@ -7,4 +7,6 @@ table_create Users TABLE_NO_KEY column_create Users name COLUMN_SCALAR ShortText table_remove Users [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Users +#|n| DDL:257:obj_remove Users.name dump Modified: test/command/suite/table_remove/array/with_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/array/with_columns.test 2016-07-27 19:24:57 +0900 (6d5aa41) +++ test/command/suite/table_remove/array/with_columns.test 2016-07-28 11:07:17 +0900 (c5de4e1) @@ -3,7 +3,9 @@ column_create Users name COLUMN_SCALAR ShortText dump +#@add-important-log-levels notice table_remove Users +#@remove-important-log-levels notice #@read-timeout 0.1 dump Modified: test/command/suite/table_remove/array/without_columns.expected (+1 -0) =================================================================== --- test/command/suite/table_remove/array/without_columns.expected 2016-07-27 19:24:57 +0900 (3a68f5b) +++ test/command/suite/table_remove/array/without_columns.expected 2016-07-28 11:07:17 +0900 (f3fc987) @@ -4,4 +4,5 @@ dump table_create Names TABLE_NO_KEY table_remove Names [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Names dump Modified: test/command/suite/table_remove/array/without_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/array/without_columns.test 2016-07-27 19:24:57 +0900 (bb485c3) +++ test/command/suite/table_remove/array/without_columns.test 2016-07-28 11:07:17 +0900 (756a319) @@ -2,7 +2,9 @@ table_create Names TABLE_NO_KEY dump +#@add-important-log-levels notice table_remove Names +#@remove-important-log-levels notice #@read-timeout 0.1 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-27 19:24:57 +0900 (48bbcef) +++ test/command/suite/table_remove/double_array_trie/with_columns.expected 2016-07-28 11:07:17 +0900 (cd0aa73) @@ -7,4 +7,6 @@ table_create Users TABLE_DAT_KEY ShortText column_create Users name COLUMN_SCALAR ShortText table_remove Users [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Users +#|n| DDL:257:obj_remove Users.name dump Modified: test/command/suite/table_remove/double_array_trie/with_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/double_array_trie/with_columns.test 2016-07-27 19:24:57 +0900 (d833733) +++ test/command/suite/table_remove/double_array_trie/with_columns.test 2016-07-28 11:07:17 +0900 (b7ec93c) @@ -3,7 +3,9 @@ column_create Users name COLUMN_SCALAR ShortText dump +#@add-important-log-levels notice table_remove Users +#@remove-important-log-levels notice #@read-timeout 0.1 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-27 19:24:57 +0900 (8a8ffad) +++ test/command/suite/table_remove/double_array_trie/without_columns.expected 2016-07-28 11:07:17 +0900 (58ca009) @@ -4,4 +4,5 @@ dump table_create Names TABLE_DAT_KEY ShortText table_remove Names [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Names dump Modified: test/command/suite/table_remove/double_array_trie/without_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/double_array_trie/without_columns.test 2016-07-27 19:24:57 +0900 (c139d76) +++ test/command/suite/table_remove/double_array_trie/without_columns.test 2016-07-28 11:07:17 +0900 (7eeba57) @@ -2,7 +2,9 @@ table_create Names TABLE_DAT_KEY ShortText dump +#@add-important-log-levels notice table_remove Names +#@remove-important-log-levels notice #@read-timeout 0.1 dump Modified: test/command/suite/table_remove/hash/with_columns.expected (+2 -0) =================================================================== --- test/command/suite/table_remove/hash/with_columns.expected 2016-07-27 19:24:57 +0900 (afc7822) +++ test/command/suite/table_remove/hash/with_columns.expected 2016-07-28 11:07:17 +0900 (f1c1ebb) @@ -7,4 +7,6 @@ table_create Users TABLE_HASH_KEY ShortText column_create Users name COLUMN_SCALAR ShortText table_remove Users [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Users +#|n| DDL:257:obj_remove Users.name dump Modified: test/command/suite/table_remove/hash/with_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/hash/with_columns.test 2016-07-27 19:24:57 +0900 (e04a279) +++ test/command/suite/table_remove/hash/with_columns.test 2016-07-28 11:07:17 +0900 (0cb6a67) @@ -3,7 +3,9 @@ column_create Users name COLUMN_SCALAR ShortText dump +#@add-important-log-levels notice table_remove Users +#@remove-important-log-levels notice #@read-timeout 0.1 dump Modified: test/command/suite/table_remove/hash/without_columns.expected (+1 -0) =================================================================== --- test/command/suite/table_remove/hash/without_columns.expected 2016-07-27 19:24:57 +0900 (2735627) +++ test/command/suite/table_remove/hash/without_columns.expected 2016-07-28 11:07:17 +0900 (909a27f) @@ -4,4 +4,5 @@ dump table_create Names TABLE_HASH_KEY ShortText table_remove Names [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Names dump Modified: test/command/suite/table_remove/hash/without_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/hash/without_columns.test 2016-07-27 19:24:57 +0900 (e2fa178) +++ test/command/suite/table_remove/hash/without_columns.test 2016-07-28 11:07:17 +0900 (0b1f4ab) @@ -2,7 +2,9 @@ table_create Names TABLE_HASH_KEY ShortText dump +#@add-important-log-levels notice table_remove Names +#@remove-important-log-levels notice #@read-timeout 0.1 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-27 19:24:57 +0900 (09efd31) +++ test/command/suite/table_remove/patricia_trie/with_columns.expected 2016-07-28 11:07:17 +0900 (f5ba68c) @@ -7,4 +7,6 @@ table_create Users TABLE_PAT_KEY ShortText column_create Users name COLUMN_SCALAR ShortText table_remove Users [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Users +#|n| DDL:257:obj_remove Users.name dump Modified: test/command/suite/table_remove/patricia_trie/with_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/patricia_trie/with_columns.test 2016-07-27 19:24:57 +0900 (92cc8eb) +++ test/command/suite/table_remove/patricia_trie/with_columns.test 2016-07-28 11:07:17 +0900 (b12d87a) @@ -3,7 +3,9 @@ column_create Users name COLUMN_SCALAR ShortText dump +#@add-important-log-levels notice table_remove Users +#@remove-important-log-levels notice #@read-timeout 0.1 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-27 19:24:57 +0900 (b8265e8) +++ test/command/suite/table_remove/patricia_trie/without_columns.expected 2016-07-28 11:07:17 +0900 (13ec9c0) @@ -4,4 +4,5 @@ dump table_create Names TABLE_PAT_KEY ShortText table_remove Names [[0,0.0,0.0],true] +#|n| DDL:256:obj_remove Names dump Modified: test/command/suite/table_remove/patricia_trie/without_columns.test (+2 -0) =================================================================== --- test/command/suite/table_remove/patricia_trie/without_columns.test 2016-07-27 19:24:57 +0900 (271466b) +++ test/command/suite/table_remove/patricia_trie/without_columns.test 2016-07-28 11:07:17 +0900 (2d4231a) @@ -2,7 +2,9 @@ table_create Names TABLE_PAT_KEY ShortText dump +#@add-important-log-levels notice table_remove Names +#@remove-important-log-levels notice #@read-timeout 0.1 dump -------------- next part -------------- HTML����������������������������... Descargar