dbwrap_cache: Check negative first
authorVolker Lendecke <vl@samba.org>
Sat, 7 Dec 2013 12:58:43 +0000 (12:58 +0000)
committerStefan Metzmacher <metze@samba.org>
Sat, 14 Dec 2013 09:10:25 +0000 (10:10 +0100)
dbwrap_cache is right now used for notify most, and we hope to have very
few notifies around. So negative hits will be more likely than positive

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/dbwrap/dbwrap_cache.c

index 6c6b795..c5f7cce 100644 (file)
@@ -69,13 +69,13 @@ static NTSTATUS dbwrap_cache_parse_record(
                return NT_STATUS_NO_MEMORY;
        }
 
+       if (dbwrap_exists(ctx->negative, key)) {
+               return NT_STATUS_NOT_FOUND;
+       }
        status = dbwrap_parse_record(ctx->positive, key, parser, private_data);
        if (NT_STATUS_IS_OK(status)) {
                return status;
        }
-       if (dbwrap_exists(ctx->negative, key)) {
-               return NT_STATUS_NOT_FOUND;
-       }
 
        status = dbwrap_fetch(ctx->backing, talloc_tos(), key, &value);