Don't log an error when MDP fetch fails due to missing bundle

This commit is contained in:
Jeremy Lakeman 2014-07-07 11:31:09 +09:30
parent 096c9670ca
commit 63226143ac
2 changed files with 13 additions and 4 deletions

View File

@ -1169,11 +1169,16 @@ int rhizome_database_filehash_from_id(const rhizome_bid_t *bidp, uint64_t versio
{
IN();
strbuf hash_sb = strbuf_alloca(RHIZOME_FILEHASH_STRLEN + 1);
if ( sqlite_exec_strbuf(hash_sb, "SELECT filehash FROM MANIFESTS WHERE version = ? AND id = ?;",
INT64, version, RHIZOME_BID_T, bidp, END) == -1)
int r = sqlite_exec_strbuf(hash_sb, "SELECT filehash FROM MANIFESTS WHERE version = ? AND id = ?;",
INT64, version, RHIZOME_BID_T, bidp, END);
if (r == -1)
RETURN(-1);
// this bundle / version was not found
if (r != 1)
RETURN(1);
if (strbuf_overrun(hash_sb) || str_to_rhizome_filehash_t(hashp, strbuf_str(hash_sb)) == -1)
RETURN(WHYF("malformed file hash for bid=%s version=%"PRIu64, alloca_tohex_rhizome_bid_t(*bidp), version));
RETURN(WHYF("malformed file hash (%s) for bid=%s version=%"PRIu64,
strbuf_str(hash_sb), alloca_tohex_rhizome_bid_t(*bidp), version));
RETURN(0);
OUT();
}

View File

@ -1358,8 +1358,12 @@ ssize_t rhizome_read_cached(const rhizome_bid_t *bidp, uint64_t version, time_ms
// if we don't have one yet, create one and open it
if (!entry){
rhizome_filehash_t filehash;
if (rhizome_database_filehash_from_id(bidp, version, &filehash) == -1)
if (rhizome_database_filehash_from_id(bidp, version, &filehash) != 0){
if (config.debug.rhizome_store)
DEBUGF("Payload not found for bundle bid=%s version=%"PRIu64,
alloca_tohex_rhizome_bid_t(*bidp), version);
return -1;
}
entry = emalloc_zero(sizeof(struct cache_entry));
if (entry == NULL)
return -1;