]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
cache: restore flagging entries written into cache restore-rrarray-entry-cached
authorMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 23 Mar 2018 16:40:36 +0000 (09:40 -0700)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 23 Mar 2018 16:56:40 +0000 (09:56 -0700)
This was probably lost during the cache backend rewrite in 2.x

fixes #332

lib/cache/api.c
lib/utils.h

index 01cec8e8f9ad21b283bf884ed1d82f1c3574748d..577272b4c3602f851d82ee9e730af3e767a5b20a 100644 (file)
@@ -652,6 +652,8 @@ int cache_stash(kr_layer_t *ctx, knot_pkt_t *pkt)
                                VERBOSE_MSG(qry, "=> stashing RRs errored out\n");
                                goto finally;
                        }
+                       /* Mark entry as cached for the rest of the query processing */
+                       entry->cached = true;
                        /* LATER(optim.): maybe filter out some type-rank combinations
                         * that won't be useful as separate RRsets. */
                }
@@ -712,7 +714,7 @@ static int stash_rrset(const ranked_rr_array_t *arr, int arr_i,
                /* TODO: ATM we assume that some properties are the same
                 * for all RRSIGs in the set (esp. label count). */
                ranked_rr_array_entry_t *e = arr->at[j];
-               bool ok = e->qry_uid == qry->uid && !e->cached
+               bool ok = e->qry_uid == qry->uid
                        && e->rr->type == KNOT_RRTYPE_RRSIG
                        && knot_rrsig_type_covered(&e->rr->rrs, 0) == rr->type
                        && knot_dname_is_equal(rr->owner, e->rr->owner);
index bd646751c5b1f1ed1f171b034d28607f661129fb..4f4cac33a845b5e571dbf9adda34534d9d51e54f 100644 (file)
@@ -145,7 +145,7 @@ struct ranked_rr_array_entry {
        uint32_t qry_uid;
        uint8_t rank; /**< enum kr_rank */
        uint8_t revalidation_cnt;
-       bool cached : 1;  /**< whether it has been stashed to cache already */
+       bool cached : 1;  /**< Set to true if the entry was written into cache */
        bool yielded : 1;
        bool to_wire : 1; /**< whether to be put into the answer */
        bool expiring : 1; /**< low remaining TTL; see is_expiring; only used in cache ATM */