Kouhei Sutou
null+****@clear*****
Tue Nov 1 23:29:27 JST 2016
Kouhei Sutou 2016-11-01 23:29:27 +0900 (Tue, 01 Nov 2016) New Revision: 5fd19c9b809fa46c3c8f530d22e3db648bc17544 https://github.com/pgroonga/pgroonga/commit/5fd19c9b809fa46c3c8f530d22e3db648bc17544 Message: Simplify Modified files: src/pgrn_create.c src/pgrn_groonga.c src/pgrn_groonga.h src/pgrn_jsonb.c src/pgrn_jsonb.h src/pgrn_wal.c src/pgrn_wal.h src/pgroonga.c Modified: src/pgrn_create.c (+21 -47) =================================================================== --- src/pgrn_create.c 2016-11-01 01:17:57 +0900 (b5a0ea9) +++ src/pgrn_create.c 2016-11-01 23:29:27 +0900 (a2ae35e) @@ -6,45 +6,32 @@ #include "pgrn_groonga.h" #include "pgrn_options.h" #include "pgrn_value.h" -#include "pgrn_wal.h" static grn_ctx *ctx = &PGrnContext; void PGrnCreateSourcesCtidColumn(PGrnCreateData *data) { - grn_column_flags flags = GRN_OBJ_COLUMN_SCALAR; - grn_obj *type; - - type = grn_ctx_at(ctx, GRN_DB_UINT64); - data->sourcesCtidColumn = PGrnCreateColumn(data->sourcesTable, + data->sourcesCtidColumn = PGrnCreateColumn(data->index, + data->sourcesTable, PGrnSourcesCtidColumnName, GRN_OBJ_COLUMN_SCALAR, - type); - PGrnWALCreateColumn(data->index, - data->sourcesTable, - PGrnSourcesCtidColumnName, - flags, - type); + grn_ctx_at(ctx, GRN_DB_UINT64)); } void PGrnCreateSourcesTable(PGrnCreateData *data) { char sourcesTableName[GRN_TABLE_MAX_KEY_SIZE]; - grn_table_flags flags = GRN_OBJ_TABLE_NO_KEY; snprintf(sourcesTableName, sizeof(sourcesTableName), PGrnSourcesTableNameFormat, data->relNode); - data->sourcesTable = PGrnCreateTable(sourcesTableName, + data->sourcesTable = PGrnCreateTable(data->index, + sourcesTableName, GRN_OBJ_TABLE_NO_KEY, + NULL, + NULL, NULL); - PGrnWALCreateTable(data->index, - sourcesTableName, - flags, - NULL, - NULL, - NULL); PGrnCreateSourcesCtidColumn(data); } @@ -93,15 +80,11 @@ PGrnCreateDataColumn(PGrnCreateData *data) char columnName[GRN_TABLE_MAX_KEY_SIZE]; PGrnColumnNameEncode(data->desc->attrs[data->i]->attname.data, columnName); - PGrnCreateColumn(data->sourcesTable, + PGrnCreateColumn(data->index, + data->sourcesTable, columnName, flags, range); - PGrnWALCreateColumn(data->index, - data->sourcesTable, - columnName, - flags, - range); } } @@ -127,12 +110,6 @@ PGrnCreateLexicon(PGrnCreateData *data) break; } - snprintf(lexiconName, sizeof(lexiconName), - PGrnLexiconNameFormat, data->relNode, data->i); - type = grn_ctx_at(ctx, typeID); - lexicon = PGrnCreateTable(lexiconName, flags, type); - GRN_PTR_PUT(ctx, data->lexicons, lexicon); - if (data->forFullTextSearch || data->forRegexpSearch || data->forPrefixSearch) @@ -153,24 +130,25 @@ PGrnCreateLexicon(PGrnCreateData *data) if (!PGrnIsNoneValue(tokenizerName)) { tokenizer = PGrnLookup(tokenizerName, ERROR); - grn_obj_set_info(ctx, lexicon, GRN_INFO_DEFAULT_TOKENIZER, - tokenizer); } } if (!PGrnIsNoneValue(normalizerName)) { normalizer = PGrnLookup(normalizerName, ERROR); - grn_obj_set_info(ctx, lexicon, GRN_INFO_NORMALIZER, normalizer); } } - PGrnWALCreateTable(data->index, - lexiconName, - flags, - type, - tokenizer, - normalizer); + snprintf(lexiconName, sizeof(lexiconName), + PGrnLexiconNameFormat, data->relNode, data->i); + type = grn_ctx_at(ctx, typeID); + lexicon = PGrnCreateTable(data->index, + lexiconName, + flags, + type, + tokenizer, + normalizer); + GRN_PTR_PUT(ctx, data->lexicons, lexicon); } void @@ -186,13 +164,9 @@ PGrnCreateIndexColumn(PGrnCreateData *data) if (data->forFullTextSearch || data->forRegexpSearch) flags |= GRN_OBJ_WITH_POSITION; - PGrnCreateColumn(lexicon, + PGrnCreateColumn(data->index, + lexicon, PGrnIndexColumnName, flags, data->sourcesTable); - PGrnWALCreateColumn(data->index, - lexicon, - PGrnIndexColumnName, - flags, - data->sourcesTable); } Modified: src/pgrn_groonga.c (+53 -11) =================================================================== --- src/pgrn_groonga.c 2016-11-01 01:17:57 +0900 (80dd222) +++ src/pgrn_groonga.c 2016-11-01 23:29:27 +0900 (8091afd) @@ -3,6 +3,7 @@ #include "pgrn_column_name.h" #include "pgrn_global.h" #include "pgrn_groonga.h" +#include "pgrn_wal.h" bool PGrnIsLZ4Available; @@ -169,23 +170,35 @@ PGrnLookupIndexColumn(Relation index, unsigned int nthAttribute, int errorLevel) } grn_obj * -PGrnCreateTable(const char *name, +PGrnCreateTable(Relation index, + const char *name, grn_table_flags flags, - grn_obj *type) + grn_obj *type, + grn_obj *tokenizer, + grn_obj *normalizer) { unsigned int nameSize = 0; if (name) nameSize = strlen(name); - return PGrnCreateTableWithSize(name, nameSize, flags, type); + return PGrnCreateTableWithSize(index, + name, + nameSize, + flags, + type, + tokenizer, + normalizer); } grn_obj * -PGrnCreateTableWithSize(const char *name, +PGrnCreateTableWithSize(Relation index, + const char *name, size_t nameSize, grn_table_flags flags, - grn_obj *type) + grn_obj *type, + grn_obj *tokenizer, + grn_obj *normalizer) { grn_obj *table; @@ -200,17 +213,31 @@ PGrnCreateTableWithSize(const char *name, type, NULL); PGrnCheck("pgroonga: failed to create table"); + if (tokenizer) + grn_obj_set_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, tokenizer); + if (normalizer) + grn_obj_set_info(ctx, table, GRN_INFO_NORMALIZER, normalizer); + + PGrnWALCreateTable(index, + name, + nameSize, + flags, + type, + tokenizer, + normalizer); return table; } grn_obj * -PGrnCreateColumn(grn_obj *table, +PGrnCreateColumn(Relation index, + grn_obj *table, const char *name, grn_column_flags flags, grn_obj *type) { - return PGrnCreateColumnWithSize(table, + return PGrnCreateColumnWithSize(index, + table, name, strlen(name), flags, @@ -218,7 +245,8 @@ PGrnCreateColumn(grn_obj *table, } grn_obj * -PGrnCreateColumnWithSize(grn_obj *table, +PGrnCreateColumnWithSize(Relation index, + grn_obj *table, const char *name, size_t nameSize, grn_column_flags flags, @@ -226,17 +254,22 @@ PGrnCreateColumnWithSize(grn_obj *table, { grn_obj *column; + flags |= GRN_OBJ_PERSISTENT; column = grn_column_create(ctx, table, name, nameSize, NULL, - GRN_OBJ_PERSISTENT | flags, + flags, type); PGrnCheck("pgroonga: failed to create column"); + PGrnWALCreateColumn(index, table, name, nameSize, flags, type); + return column; } void -PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source) +PGrnIndexColumnSetSource(Relation index, + grn_obj *indexColumn, + grn_obj *source) { grn_id sourceID; @@ -245,7 +278,16 @@ PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source) sourceID = grn_obj_id(ctx, source); GRN_RECORD_PUT(ctx, &(buffers->sourceIDs), sourceID); - grn_obj_set_info(ctx, indexColumn, GRN_INFO_SOURCE, &(buffers->sourceIDs)); + PGrnIndexColumnSetSourceIDs(index, indexColumn, &(buffers->sourceIDs)); +} + +void +PGrnIndexColumnSetSourceIDs(Relation index, + grn_obj *indexColumn, + grn_obj *sourceIDs) +{ + grn_obj_set_info(ctx, indexColumn, GRN_INFO_SOURCE, sourceIDs); + PGrnWALSetSourceIDs(index, indexColumn, sourceIDs); } bool Modified: src/pgrn_groonga.h (+20 -7) =================================================================== --- src/pgrn_groonga.h 2016-11-01 01:17:57 +0900 (e1c27d4) +++ src/pgrn_groonga.h 2016-11-01 23:29:27 +0900 (a7b487d) @@ -32,24 +32,37 @@ grn_obj *PGrnLookupIndexColumn(Relation index, unsigned int nthAttribute, int errorLevel); -grn_obj *PGrnCreateTable(const char *name, +grn_obj *PGrnCreateTable(Relation index, + const char *name, grn_table_flags flags, - grn_obj *type); -grn_obj *PGrnCreateTableWithSize(const char *name, + grn_obj *type, + grn_obj *tokenizer, + grn_obj *normalizer); +grn_obj *PGrnCreateTableWithSize(Relation index, + const char *name, size_t nameSize, grn_table_flags flags, - grn_obj *type); -grn_obj *PGrnCreateColumn(grn_obj *table, + grn_obj *type, + grn_obj *tokenizer, + grn_obj *normalizer); +grn_obj *PGrnCreateColumn(Relation index, + grn_obj *table, const char*name, grn_column_flags flags, grn_obj *type); -grn_obj *PGrnCreateColumnWithSize(grn_obj *table, +grn_obj *PGrnCreateColumnWithSize(Relation index, + grn_obj *table, const char*name, size_t nameSize, grn_column_flags flags, grn_obj *type); -void PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source); +void PGrnIndexColumnSetSource(Relation index, + grn_obj *indexColumn, + grn_obj *source); +void PGrnIndexColumnSetSourceIDs(Relation index, + grn_obj *indexColumn, + grn_obj *sourceIDs); bool PGrnRemoveObject(const char *name); Modified: src/pgrn_jsonb.c (+87 -126) =================================================================== --- src/pgrn_jsonb.c 2016-11-01 01:17:57 +0900 (1807b88) +++ src/pgrn_jsonb.c 2016-11-01 23:29:27 +0900 (47babcd) @@ -170,118 +170,82 @@ PGrnJSONBLookupSizeLexicon(Relation index, } static grn_obj * -PGrnJSONBCreateTable(Relation index, - const char *name, - grn_table_flags flags, - grn_obj *type, - grn_obj *tokenizer, - grn_obj *normalizer) -{ - grn_obj *table; - - table = PGrnCreateTable(name, flags, type); - PGrnWALCreateTable(index, name, flags, type, tokenizer, normalizer); - - if (tokenizer) - grn_obj_set_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, tokenizer); - if (normalizer) - grn_obj_set_info(ctx, table, GRN_INFO_NORMALIZER, normalizer); - - return table; -} - -static grn_obj * PGrnJSONBCreatePathsTable(Relation index, const char *name) { - return PGrnJSONBCreateTable(index, - name, - GRN_OBJ_TABLE_PAT_KEY, - grn_ctx_at(ctx, GRN_DB_SHORT_TEXT), - NULL, - NULL); + return PGrnCreateTable(index, + name, + GRN_OBJ_TABLE_PAT_KEY, + grn_ctx_at(ctx, GRN_DB_SHORT_TEXT), + NULL, + NULL); } static grn_obj * PGrnJSONBCreateTypesTable(Relation index, const char *name) { - return PGrnJSONBCreateTable(index, - name, - GRN_OBJ_TABLE_PAT_KEY, - grn_ctx_at(ctx, GRN_DB_SHORT_TEXT), - NULL, - NULL); + return PGrnCreateTable(index, + name, + GRN_OBJ_TABLE_PAT_KEY, + grn_ctx_at(ctx, GRN_DB_SHORT_TEXT), + NULL, + NULL); } static grn_obj * PGrnJSONBCreateValuesTable(Relation index, const char *name) { - return PGrnJSONBCreateTable(index, - name, - GRN_OBJ_TABLE_HASH_KEY, - grn_ctx_at(ctx, GRN_DB_UINT64), - NULL, - NULL); -} - -static grn_obj * -PGrnJSONBCreateColumn(Relation index, - grn_obj *table, - const char *name, - grn_column_flags flags, - grn_obj *type) -{ - grn_obj *column; - - column = PGrnCreateColumn(table, name, flags, type); - PGrnWALCreateColumn(index, table, name, flags, type); - - return column; + return PGrnCreateTable(index, + name, + GRN_OBJ_TABLE_HASH_KEY, + grn_ctx_at(ctx, GRN_DB_UINT64), + NULL, + NULL); } static void PGrnJSONBCreateDataColumns(Relation index, PGrnJSONBCreateData *jsonbData) { - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "path", - GRN_OBJ_COLUMN_SCALAR, - jsonbData->pathsTable); - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "paths", - GRN_OBJ_COLUMN_VECTOR, - jsonbData->pathsTable); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "path", + GRN_OBJ_COLUMN_SCALAR, + jsonbData->pathsTable); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "paths", + GRN_OBJ_COLUMN_VECTOR, + jsonbData->pathsTable); { grn_column_flags flags = 0; if (PGrnIsLZ4Available) flags |= GRN_OBJ_COMPRESS_LZ4; - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "string", - flags, - grn_ctx_at(ctx, GRN_DB_LONG_TEXT)); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "string", + flags, + grn_ctx_at(ctx, GRN_DB_LONG_TEXT)); } - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "number", - 0, - grn_ctx_at(ctx, GRN_DB_FLOAT)); - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "boolean", - 0, - grn_ctx_at(ctx, GRN_DB_BOOL)); - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "size", - 0, - grn_ctx_at(ctx, GRN_DB_UINT32)); - PGrnJSONBCreateColumn(index, - jsonbData->valuesTable, - "type", - 0, - jsonbData->typesTable); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "number", + 0, + grn_ctx_at(ctx, GRN_DB_FLOAT)); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "boolean", + 0, + grn_ctx_at(ctx, GRN_DB_BOOL)); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "size", + 0, + grn_ctx_at(ctx, GRN_DB_UINT32)); + PGrnCreateColumn(index, + jsonbData->valuesTable, + "type", + 0, + jsonbData->typesTable); } static void @@ -825,19 +789,19 @@ PGrnJSONBCreateFullTextSearchIndexColumn(PGrnCreateData *data, tokenizer = PGrnLookup(tokenizerName, ERROR); if (!PGrnIsNoneValue(normalizerName)) normalizer = PGrnLookup(normalizerName, ERROR); - lexicon = PGrnJSONBCreateTable(data->index, - lexiconName, - flags, - type, - tokenizer, - normalizer); + lexicon = PGrnCreateTable(data->index, + lexiconName, + flags, + type, + tokenizer, + normalizer); GRN_PTR_PUT(ctx, data->lexicons, lexicon); - PGrnJSONBCreateColumn(data->index, - lexicon, - PGrnIndexColumnName, - GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_POSITION, - jsonbData->valuesTable); + PGrnCreateColumn(data->index, + lexicon, + PGrnIndexColumnName, + GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_POSITION, + jsonbData->valuesTable); } static void @@ -853,34 +817,34 @@ PGrnJSONBCreateIndexColumn(PGrnCreateData *data, snprintf(lexiconName, sizeof(lexiconName), PGrnJSONValueLexiconNameFormat, typeName, data->relNode, data->i); - lexicon = PGrnJSONBCreateTable(data->index, - lexiconName, - tableType, - type, - NULL, - NULL); + lexicon = PGrnCreateTable(data->index, + lexiconName, + tableType, + type, + NULL, + NULL); GRN_PTR_PUT(ctx, data->lexicons, lexicon); - PGrnJSONBCreateColumn(data->index, - lexicon, - PGrnIndexColumnName, - GRN_OBJ_COLUMN_INDEX, - jsonbData->valuesTable); + PGrnCreateColumn(data->index, + lexicon, + PGrnIndexColumnName, + GRN_OBJ_COLUMN_INDEX, + jsonbData->valuesTable); } static void PGrnJSONBCreateIndexColumns(PGrnCreateData *data, PGrnJSONBCreateData *jsonbData) { - PGrnJSONBCreateColumn(data->index, - jsonbData->valuesTable, - PGrnIndexColumnName, - GRN_OBJ_COLUMN_INDEX, - data->sourcesTable); - PGrnJSONBCreateColumn(data->index, - jsonbData->pathsTable, - PGrnIndexColumnName, - GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_SECTION, - jsonbData->valuesTable); + PGrnCreateColumn(data->index, + jsonbData->valuesTable, + PGrnIndexColumnName, + GRN_OBJ_COLUMN_INDEX, + data->sourcesTable); + PGrnCreateColumn(data->index, + jsonbData->pathsTable, + PGrnIndexColumnName, + GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_SECTION, + jsonbData->valuesTable); /* TODO: 4KiB over string value can't be searched. */ PGrnJSONBCreateIndexColumn(data, @@ -973,8 +937,7 @@ PGrnJSONBValueSetSource(Relation index, } source = PGrnLookupColumn(jsonValuesTable, columnName, ERROR); - PGrnIndexColumnSetSource(indexColumn, source); - PGrnWALSetSource(index, indexColumn, source); + PGrnIndexColumnSetSource(index, indexColumn, source); grn_obj_unlink(ctx, source); grn_obj_unlink(ctx, indexColumn); @@ -1007,9 +970,7 @@ PGrnJSONBSetSources(Relation index, indexColumn = PGrnLookupColumn(jsonPathsTable, PGrnIndexColumnName, ERROR); - grn_obj_set_info(ctx, indexColumn, GRN_INFO_SOURCE, sourceIDs); - PGrnWALSetSources(index, indexColumn, sourceIDs); - grn_obj_unlink(ctx, indexColumn); + PGrnIndexColumnSetSourceIDs(index, indexColumn, sourceIDs); } PGrnJSONBValueSetSource(index, jsonValuesTable, "string", "String", Modified: src/pgrn_jsonb.h (+0 -1) =================================================================== --- src/pgrn_jsonb.h 2016-11-01 01:17:57 +0900 (bf408e0) +++ src/pgrn_jsonb.h 2016-11-01 23:29:27 +0900 (c484eb3) @@ -5,7 +5,6 @@ #include "pgrn_create.h" #include "pgrn_search.h" -#include "pgrn_wal.h" void PGrnInitializeJSONB(void); void PGrnFinalizeJSONB(void); Modified: src/pgrn_wal.c (+26 -52) =================================================================== --- src/pgrn_wal.c 2016-11-01 01:17:57 +0900 (b692cf5) +++ src/pgrn_wal.c 2016-11-01 23:29:27 +0900 (3f38f8a) @@ -137,10 +137,14 @@ PGrnWALEnsureStatusesTable(void) if (walStatuses) return; - walStatuses = PGrnCreateTable(PGRN_WAL_STATUES_TABLE_NAME, + walStatuses = PGrnCreateTable(NULL, + PGRN_WAL_STATUES_TABLE_NAME, GRN_OBJ_TABLE_HASH_KEY, - grn_ctx_at(ctx, GRN_DB_UINT32)); - PGrnCreateColumn(walStatuses, + grn_ctx_at(ctx, GRN_DB_UINT32), + NULL, + NULL); + PGrnCreateColumn(NULL, + walStatuses, PGRN_WAL_STATUES_CURRENT_COLUMN_NAME, GRN_OBJ_COLUMN_SCALAR, grn_ctx_at(ctx, GRN_DB_UINT64)); @@ -689,6 +693,7 @@ PGrnWALInsertKey(PGrnWALData *data, grn_obj *key) void PGrnWALCreateTable(Relation index, const char *name, + size_t nameSize, grn_table_flags flags, grn_obj *type, grn_obj *tokenizer, @@ -710,7 +715,8 @@ PGrnWALCreateTable(Relation index, msgpack_pack_uint32(packer, PGRN_WAL_ACTION_CREATE_TABLE); msgpack_pack_cstr(packer, "name"); - msgpack_pack_cstr(packer, name); + msgpack_pack_str(packer, nameSize); + msgpack_pack_str_body(packer, name, nameSize); msgpack_pack_cstr(packer, "flags"); msgpack_pack_uint32(packer, flags); @@ -732,6 +738,7 @@ void PGrnWALCreateColumn(Relation index, grn_obj *table, const char *name, + size_t nameSize, grn_column_flags flags, grn_obj *type) { @@ -754,7 +761,8 @@ PGrnWALCreateColumn(Relation index, msgpack_pack_grn_obj(packer, table); msgpack_pack_cstr(packer, "name"); - msgpack_pack_cstr(packer, name); + msgpack_pack_str(packer, nameSize); + msgpack_pack_str_body(packer, name, nameSize); msgpack_pack_cstr(packer, "flags"); msgpack_pack_uint32(packer, flags); @@ -767,40 +775,9 @@ PGrnWALCreateColumn(Relation index, } void -PGrnWALSetSource(Relation index, - grn_obj *column, - grn_obj *source) -{ -#ifdef PGRN_SUPPORT_WAL - PGrnWALData *data; - msgpack_packer *packer; - size_t nElements = 3; - - data = PGrnWALStart(index); - if (!data) - return; - - packer = &(data->packer); - msgpack_pack_map(packer, nElements); - - msgpack_pack_cstr(packer, "_action"); - msgpack_pack_uint32(packer, PGRN_WAL_ACTION_SET_SOURCES); - - msgpack_pack_cstr(packer, "column"); - msgpack_pack_grn_obj(packer, column); - - msgpack_pack_cstr(packer, "sources"); - msgpack_pack_array(packer, 1); - msgpack_pack_grn_obj(packer, source); - - PGrnWALFinish(data); -#endif -} - -void -PGrnWALSetSources(Relation index, - grn_obj *column, - grn_obj *sources) +PGrnWALSetSourceIDs(Relation index, + grn_obj *column, + grn_obj *sourceIDs) { #ifdef PGRN_SUPPORT_WAL PGrnWALData *data; @@ -824,12 +801,12 @@ PGrnWALSetSources(Relation index, { unsigned int i, nElements; - nElements = GRN_BULK_VSIZE(sources) / sizeof(grn_id); + nElements = GRN_BULK_VSIZE(sourceIDs) / sizeof(grn_id); msgpack_pack_array(packer, nElements); for (i = 0; i < nElements; i++) { grn_obj *source; - source = grn_ctx_at(ctx, GRN_RECORD_VALUE_AT(sources, i)); + source = grn_ctx_at(ctx, GRN_RECORD_VALUE_AT(sourceIDs, i)); msgpack_pack_grn_obj(packer, source); } } @@ -1270,7 +1247,6 @@ PGrnWALApplyCreateTable(PGrnWALApplyData *data, grn_obj *tokenizer = NULL; grn_obj *normalizer = NULL; uint32_t i; - grn_obj *table; for (i = currentElement; i < map->size; i++) { @@ -1299,15 +1275,13 @@ PGrnWALApplyCreateTable(PGrnWALApplyData *data, } } - table = PGrnCreateTableWithSize(name, nameSize, flags, type); - if (tokenizer) - { - grn_obj_set_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER, tokenizer); - } - if (normalizer) - { - grn_obj_set_info(ctx, table, GRN_INFO_NORMALIZER, normalizer); - } + PGrnCreateTableWithSize(NULL, + name, + nameSize, + flags, + type, + tokenizer, + normalizer); } static void @@ -1346,7 +1320,7 @@ PGrnWALApplyCreateColumn(PGrnWALApplyData *data, } } - PGrnCreateColumnWithSize(table, name, nameSize, flags, type); + PGrnCreateColumnWithSize(NULL, table, name, nameSize, flags, type); } static void Modified: src/pgrn_wal.h (+5 -6) =================================================================== --- src/pgrn_wal.h 2016-11-01 01:17:57 +0900 (63930f1) +++ src/pgrn_wal.h 2016-11-01 23:29:27 +0900 (c56a4e8) @@ -31,6 +31,7 @@ void PGrnWALInsertKey(PGrnWALData *data, void PGrnWALCreateTable(Relation index, const char *name, + size_t nameSize, grn_table_flags flags, grn_obj *type, grn_obj *tokenizer, @@ -39,14 +40,12 @@ void PGrnWALCreateTable(Relation index, void PGrnWALCreateColumn(Relation index, grn_obj *table, const char *name, + size_t nameSize, grn_column_flags flags, grn_obj *type); -void PGrnWALSetSource(Relation index, - grn_obj *column, - grn_obj *source); -void PGrnWALSetSources(Relation index, - grn_obj *column, - grn_obj *sources); +void PGrnWALSetSourceIDs(Relation index, + grn_obj *column, + grn_obj *sourceIDs); void PGrnWALApply(Relation index); Modified: src/pgroonga.c (+1 -2) =================================================================== --- src/pgroonga.c 2016-11-01 01:17:57 +0900 (70dbdc0) +++ src/pgroonga.c 2016-11-01 23:29:27 +0900 (d8e201a) @@ -876,8 +876,7 @@ PGrnSetSources(Relation index, grn_obj *sourcesTable) } source = PGrnLookupColumn(sourcesTable, name->data, ERROR); - PGrnIndexColumnSetSource(indexColumn, source); - PGrnWALSetSource(index, indexColumn, source); + PGrnIndexColumnSetSource(index, indexColumn, source); grn_obj_unlink(ctx, source); grn_obj_unlink(ctx, indexColumn); } -------------- next part -------------- HTML����������������������������... ダウンロード