Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a bug that updated flags aren't used on open

  • Loading branch information...
commit b15d0783e6885558e5df7a8375b52623d52539e4 1 parent faaca35
@kou kou authored
Showing with 18 additions and 6 deletions.
  1. +1 −1  lib/dat.cpp
  2. +15 −3 lib/db.c
  3. +1 −1  lib/hash.c
  4. +1 −1  lib/pat.c
View
2  lib/dat.cpp
@@ -346,7 +346,6 @@ grn_dat_open(grn_ctx *ctx, const char *path)
}
dat->file_id = dat->header->file_id;
dat->encoding = dat->header->encoding;
- dat->obj.header.flags = dat->header->flags;
dat->tokenizer = grn_ctx_at(ctx, dat->header->tokenizer);
if (dat->header->flags & GRN_OBJ_KEY_NORMALIZE) {
dat->header->flags &= ~GRN_OBJ_KEY_NORMALIZE;
@@ -355,6 +354,7 @@ grn_dat_open(grn_ctx *ctx, const char *path)
} else {
dat->normalizer = grn_ctx_at(ctx, dat->header->normalizer);
}
+ dat->obj.header.flags = dat->header->flags;
return dat;
}
View
18 lib/db.c
@@ -7193,17 +7193,29 @@ grn_ctx_at(grn_ctx *ctx, grn_id id)
case GRN_TABLE_HASH_KEY :
GET_PATH(spec, buffer, s, id);
vp->ptr = (grn_obj *)grn_hash_open(ctx, buffer);
- UNPACK_INFO();
+ if (vp->ptr) {
+ grn_obj_flags flags = vp->ptr->header.flags;
+ UNPACK_INFO();
+ vp->ptr->header.flags = flags;
+ }
break;
case GRN_TABLE_PAT_KEY :
GET_PATH(spec, buffer, s, id);
vp->ptr = (grn_obj *)grn_pat_open(ctx, buffer);
- UNPACK_INFO();
+ if (vp->ptr) {
+ grn_obj_flags flags = vp->ptr->header.flags;
+ UNPACK_INFO();
+ vp->ptr->header.flags = flags;
+ }
break;
case GRN_TABLE_DAT_KEY :
GET_PATH(spec, buffer, s, id);
vp->ptr = (grn_obj *)grn_dat_open(ctx, buffer);
- UNPACK_INFO();
+ if (vp->ptr) {
+ grn_obj_flags flags = vp->ptr->header.flags;
+ UNPACK_INFO();
+ vp->ptr->header.flags = flags;
+ }
break;
case GRN_TABLE_NO_KEY :
GET_PATH(spec, buffer, s, id);
View
2  lib/hash.c
@@ -1618,7 +1618,6 @@ grn_hash_open(grn_ctx *ctx, const char *path)
if (hash) {
if (!(header->flags & GRN_HASH_TINY)) {
GRN_DB_OBJ_SET_TYPE(hash, GRN_TABLE_HASH_KEY);
- hash->obj.header.flags = header->flags;
hash->ctx = ctx;
hash->key_size = header->key_size;
hash->encoding = header->encoding;
@@ -1638,6 +1637,7 @@ grn_hash_open(grn_ctx *ctx, const char *path)
} else {
hash->normalizer = grn_ctx_at(ctx, header->normalizer);
}
+ hash->obj.header.flags = header->flags;
return hash;
} else {
GRN_LOG(ctx, GRN_LOG_NOTICE,
View
2  lib/pat.c
@@ -525,7 +525,6 @@ grn_pat_open(grn_ctx *ctx, const char *path)
pat->key_size = header->key_size;
pat->value_size = header->value_size;
pat->encoding = header->encoding;
- pat->obj.header.flags = header->flags;
pat->tokenizer = grn_ctx_at(ctx, header->tokenizer);
if (header->flags & GRN_OBJ_KEY_NORMALIZE) {
header->flags &= ~GRN_OBJ_KEY_NORMALIZE;
@@ -534,6 +533,7 @@ grn_pat_open(grn_ctx *ctx, const char *path)
} else {
pat->normalizer = grn_ctx_at(ctx, header->normalizer);
}
+ pat->obj.header.flags = header->flags;
PAT_AT(pat, 0, node0);
if (!node0) {
grn_io_close(ctx, io);
Please sign in to comment.
Something went wrong with that request. Please try again.