[Groonga-commit] groonga/groonga at 9914f50 [master] cache: fix fetch return GRN_SUCCESS for not found case

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Apr 4 17:19:40 JST 2017


Kouhei Sutou	2017-04-04 17:19:40 +0900 (Tue, 04 Apr 2017)

  New Revision: 9914f50c2434add432ae3064be4e98b73169c80b
  https://github.com/groonga/groonga/commit/9914f50c2434add432ae3064be4e98b73169c80b

  Message:
    cache: fix fetch return GRN_SUCCESS for not found case

  Modified files:
    lib/cache.c

  Modified: lib/cache.c (+7 -0)
===================================================================
--- lib/cache.c    2017-04-04 17:18:58 +0900 (9098384)
+++ lib/cache.c    2017-04-04 17:19:40 +0900 (758dd4d)
@@ -420,8 +420,15 @@ grn_cache_fetch_persistent(grn_ctx *ctx, grn_cache *cache,
     return rc;
   }
 
+  /* TODO: How about GRN_NOT_FOUND? */
+  rc = GRN_INVALID_ARGUMENT;
+
   cache->nfetches++;
   cache_id = grn_hash_get(cache->ctx, keys, key, key_len, (void **)&entry);
+  if (cache_id == GRN_ID_NIL) {
+    goto exit;
+  }
+
   if (cache_id != GRN_ID_NIL) {
     if (entry->modified_time.tv_sec <=
         grn_db_get_last_modified(ctx, ctx->impl->db)) {
-------------- next part --------------
HTML����������������������������...
下载 



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