null+****@clear*****
null+****@clear*****
2011年 6月 30日 (木) 08:23:53 JST
Daijiro MORI 2011-06-29 23:23:53 +0000 (Wed, 29 Jun 2011)
New Revision: a5f4f3902ae24123fd769e8808e9bb1b6bfcd19b
Log:
Fixed missing creating trie file in grn_dat_add
Modified files:
lib/dat.cpp
Modified: lib/dat.cpp (+4 -2)
===================================================================
--- lib/dat.cpp 2011-06-29 12:14:19 +0000 (5129fe3)
+++ lib/dat.cpp 2011-06-29 23:23:53 +0000 (0ff5f0c)
@@ -25,6 +25,8 @@
extern "C" {
+std::size_t INITIAL_FILE_SIZE = 1 << 20;
+
static void
grn_dat_init(grn_dat *dat) {
GRN_DB_OBJ_SET_TYPE(dat, GRN_TABLE_DAT_KEY);
@@ -183,11 +185,11 @@ grn_dat_add(grn_ctx *ctx, grn_dat *dat, const void *key,
char buffer[PATH_MAX];
gen_pathname(path, buffer, file_id);
grn::dat::Trie *new_trie = new grn::dat::Trie;
- new_trie->open(buffer);
+ new_trie->create(buffer, INITIAL_FILE_SIZE);
dat->handle = new_trie;
} else {
grn::dat::Trie *new_trie = new grn::dat::Trie;
- new_trie->open(NULL);
+ new_trie->create(NULL, INITIAL_FILE_SIZE);
dat->handle = new_trie;
}
dat->file_id = dat->header->file_id = file_id;