Ensure sql lock failures are returned.

This commit is contained in:
Jeremy Lakeman 2014-09-08 17:14:55 +09:30
parent dac67c7059
commit 2c72875508
12 changed files with 142 additions and 126 deletions

View File

@ -178,7 +178,7 @@ static enum meshms_status get_database_conversations(const sid_t *my_sid, const
p->size = size;
}
sqlite3_finalize(statement);
if (r==-1)
if (!sqlite_code_ok(r))
return MESHMS_STATUS_ERROR;
return MESHMS_STATUS_OK;
}
@ -238,12 +238,14 @@ static enum meshms_status ply_read_open(struct meshms_ply_read *ply, const rhizo
if (config.debug.meshms)
DEBUGF("Opening ply %s", alloca_tohex_rhizome_bid_t(*bid));
switch (rhizome_retrieve_manifest(bid, m)) {
case 0:
case RHIZOME_BUNDLE_STATUS_SAME:
break;
case -1:
return MESHMS_STATUS_ERROR;
default: // bundle not found
case RHIZOME_BUNDLE_STATUS_NEW: // bundle not found
return MESHMS_STATUS_PROTOCOL_FAULT;
case RHIZOME_BUNDLE_STATUS_BUSY:
// TODO
default:
return MESHMS_STATUS_ERROR;
}
enum rhizome_payload_status pstatus = rhizome_open_decrypt_read(m, &ply->read);
if (config.debug.meshms)
@ -346,13 +348,16 @@ static enum meshms_status append_meshms_buffer(const sid_t *my_sid, struct meshm
goto end;
if (conv->found_my_ply){
switch (rhizome_retrieve_manifest(&conv->my_ply.bundle_id, m)) {
case 0:
case RHIZOME_BUNDLE_STATUS_SAME:
break;
case -1:
goto end;
default:
case RHIZOME_BUNDLE_STATUS_NEW: // bundle not found
status = MESHMS_STATUS_PROTOCOL_FAULT;
goto end;
case RHIZOME_BUNDLE_STATUS_BUSY:
// TODO
default:
status = MESHMS_STATUS_ERROR;
goto end;
}
rhizome_authenticate_author(m);
if (!m->haveSecret || m->authorship != AUTHOR_AUTHENTIC) {

View File

@ -367,7 +367,7 @@ static int overlay_mdp_service_manifest_requests(struct internal_mdp_header *hea
rhizome_manifest *m = rhizome_new_manifest();
if (!m)
return WHY("Unable to allocate manifest");
if (!rhizome_retrieve_manifest_by_prefix(&bar[RHIZOME_BAR_PREFIX_OFFSET], RHIZOME_BAR_PREFIX_BYTES, m)){
if (rhizome_retrieve_manifest_by_prefix(&bar[RHIZOME_BAR_PREFIX_OFFSET], RHIZOME_BAR_PREFIX_BYTES, m)==RHIZOME_BUNDLE_STATUS_SAME){
rhizome_advertise_manifest(header->source, m);
// pre-emptively send the payload if it will fit in a single packet
if (m->filesize > 0 && m->filesize <= 1024)

View File

@ -283,39 +283,30 @@ enum rhizome_bundle_status rhizome_manifest_check_stored(rhizome_manifest *m, rh
rhizome_manifest *stored_m = rhizome_new_manifest();
if (stored_m == NULL)
return -1;
int n = rhizome_retrieve_manifest(&m->cryptoSignPublic, stored_m);
switch (n) {
case -1:
enum rhizome_bundle_status result = rhizome_retrieve_manifest(&m->cryptoSignPublic, stored_m);
if (result==RHIZOME_BUNDLE_STATUS_SAME){
const char *what = "same as";
if (m->version < stored_m->version) {
result = RHIZOME_BUNDLE_STATUS_OLD;
what = "older than";
}
if (m->version > stored_m->version) {
what = "newer than";
result = RHIZOME_BUNDLE_STATUS_NEW;
}
if (config.debug.rhizome)
DEBUGF("Bundle %s:%"PRIu64" is %s stored version %"PRIu64, alloca_tohex_rhizome_bid_t(m->cryptoSignPublic), m->version, what, stored_m->version);
if (mout)
*mout = stored_m;
else
rhizome_manifest_free(stored_m);
return -1;
case 1:
if (config.debug.rhizome)
DEBUGF("No stored manifest with id=%s", alloca_tohex_rhizome_bid_t(m->cryptoSignPublic));
rhizome_manifest_free(stored_m);
if (mout)
*mout = m;
return RHIZOME_BUNDLE_STATUS_NEW;
case 0:
break;
default:
FATALF("rhizome_retrieve_manifest() returned %d", n);
}
if (mout)
*mout = stored_m;
else
}else{
rhizome_manifest_free(stored_m);
enum rhizome_bundle_status result = RHIZOME_BUNDLE_STATUS_NEW;
const char *what = "newer than";
if (m->version < stored_m->version) {
result = RHIZOME_BUNDLE_STATUS_OLD;
what = "older than";
if (config.debug.rhizome)
DEBUGF("No stored manifest with id=%s", alloca_tohex_rhizome_bid_t(m->cryptoSignPublic));
if (mout)
*mout = m;
}
if (m->version == stored_m->version) {
return RHIZOME_BUNDLE_STATUS_SAME;
what = "same as";
}
if (config.debug.rhizome)
DEBUGF("Bundle %s:%"PRIu64" is %s stored version %"PRIu64, alloca_tohex_rhizome_bid_t(m->cryptoSignPublic), m->version, what, stored_m->version);
return result;
}
@ -364,6 +355,7 @@ const char *rhizome_bundle_status_message(enum rhizome_bundle_status status)
case RHIZOME_BUNDLE_STATUS_INCONSISTENT: return "Manifest inconsistent with supplied payload";
case RHIZOME_BUNDLE_STATUS_NO_ROOM: return "No room in store for bundle";
case RHIZOME_BUNDLE_STATUS_READONLY: return "Bundle is read-only";
case RHIZOME_BUNDLE_STATUS_BUSY: return "Internal error";
case RHIZOME_BUNDLE_STATUS_ERROR: return "Internal error";
}
return NULL;

View File

@ -364,6 +364,7 @@ enum rhizome_bundle_status {
RHIZOME_BUNDLE_STATUS_INCONSISTENT = 6, // manifest filesize/filehash does not match supplied payload
RHIZOME_BUNDLE_STATUS_NO_ROOM = 7, // doesn't fit; store may contain more important bundles
RHIZOME_BUNDLE_STATUS_READONLY = 8, // cannot modify manifest; secret unknown
RHIZOME_BUNDLE_STATUS_BUSY = 9, // the database is currently busy
};
#define INVALID_RHIZOME_BUNDLE_STATUS ((enum rhizome_bundle_status)-2)
@ -425,7 +426,7 @@ int rhizome_sign_hash(rhizome_manifest *m, rhizome_signature *out);
__RHIZOME_INLINE int sqlite_code_ok(int code)
{
return code == SQLITE_OK || code == SQLITE_DONE;
return code == SQLITE_OK || code == SQLITE_DONE || code == SQLITE_ROW;
}
__RHIZOME_INLINE int sqlite_code_busy(int code)
@ -537,8 +538,8 @@ enum rhizome_bundle_status rhizome_find_duplicate(const rhizome_manifest *m, rhi
int rhizome_manifest_to_bar(rhizome_manifest *m, rhizome_bar_t *bar);
int rhizome_is_bar_interesting(const rhizome_bar_t *bar);
int rhizome_is_manifest_interesting(rhizome_manifest *m);
int rhizome_retrieve_manifest(const rhizome_bid_t *bid, rhizome_manifest *m);
int rhizome_retrieve_manifest_by_prefix(const unsigned char *prefix, unsigned prefix_len, rhizome_manifest *m);
enum rhizome_bundle_status rhizome_retrieve_manifest(const rhizome_bid_t *bid, rhizome_manifest *m);
enum rhizome_bundle_status rhizome_retrieve_manifest_by_prefix(const unsigned char *prefix, unsigned prefix_len, rhizome_manifest *m);
int rhizome_advertise_manifest(struct subscriber *dest, rhizome_manifest *m);
int rhizome_delete_bundle(const rhizome_bid_t *bidp);
int rhizome_delete_manifest(const rhizome_bid_t *bidp);

View File

@ -180,7 +180,7 @@ static int app_rhizome_add_file(const struct cli_parsed *parsed, struct cli_cont
keyring = NULL;
return WHYF("Invalid bundle ID: %s", alloca_str_toprint(manifestid));
}
if (rhizome_retrieve_manifest(&bid, m)){
if (rhizome_retrieve_manifest(&bid, m) != RHIZOME_BUNDLE_STATUS_SAME){
rhizome_manifest_free(m);
keyring_free(keyring);
keyring = NULL;
@ -290,6 +290,7 @@ static int app_rhizome_add_file(const struct cli_parsed *parsed, struct cli_cont
case RHIZOME_BUNDLE_STATUS_INVALID:
case RHIZOME_BUNDLE_STATUS_FAKE:
case RHIZOME_BUNDLE_STATUS_NO_ROOM:
case RHIZOME_BUNDLE_STATUS_BUSY:
status_valid = 1;
break;
// Do not use a default: label! With no default, if a new value is added to the enum, then the
@ -529,7 +530,13 @@ static int app_rhizome_extract(const struct cli_parsed *parsed, struct cli_conte
keyring = NULL;
return WHY("Out of manifests");
}
ret = rhizome_retrieve_manifest(&bid, m);
switch(rhizome_retrieve_manifest(&bid, m)){
case RHIZOME_BUNDLE_STATUS_NEW: ret=1; break;
case RHIZOME_BUNDLE_STATUS_SAME: ret=0; break;
default: ret=-1; break;
}
if (ret==0){
assert(m->finalised);
if (bskhex)

View File

@ -71,21 +71,25 @@ int rhizome_get_bundle_from_seed(rhizome_manifest *m, const char *seed)
struct signing_key key;
if (generate_keypair(seed, &key))
return -1;
int ret = rhizome_retrieve_manifest(&key.Public, m);
if (ret == -1)
return -1;
if (ret == 1) {
// manifest not retrieved
rhizome_manifest_set_id(m, &key.Public); // zerofills m->cryptoSignSecret
m->haveSecret = NEW_BUNDLE_ID;
} else {
m->haveSecret = EXISTING_BUNDLE_ID;
switch(rhizome_retrieve_manifest(&key.Public, m)){
case RHIZOME_BUNDLE_STATUS_NEW:
// manifest not retrieved
rhizome_manifest_set_id(m, &key.Public); // zerofills m->cryptoSignSecret
m->haveSecret = NEW_BUNDLE_ID;
break;
case RHIZOME_BUNDLE_STATUS_SAME:
m->haveSecret = EXISTING_BUNDLE_ID;
break;
default:
return -1;
}
bcopy(key.Private, m->cryptoSignSecret, sizeof m->cryptoSignSecret);
// Disabled for performance, these asserts should nevertheless always hold.
//assert(cmp_rhizome_bid_t(&m->cryptoSignPublic, &key.Public) == 0);
//assert(memcmp(m->cryptoSignPublic.binary, m->cryptoSignSecret + RHIZOME_BUNDLE_KEY_BYTES, sizeof m->cryptoSignPublic.binary) == 0);
return ret;
return 0;
}
/* Given a Rhizome Secret (RS) and bundle ID (BID), XOR a bundle key 'bkin' (private or public) with

View File

@ -876,10 +876,10 @@ int _sqlite_step(struct __sourceloc __whence, int log_level, sqlite_retry_state
sqlite3_reset(statement);
break; // back to sqlite3_step()
}
ret = stepcode;
// fall through...
default:
LOGF(log_level, "query failed (%d), %s: %s", stepcode, sqlite3_errmsg(rhizome_db), sqlite3_sql(statement));
ret = -1;
statement = NULL;
break;
}
@ -1339,7 +1339,7 @@ int rhizome_store_manifest(rhizome_manifest *m)
)
) == NULL)
goto rollback;
if (sqlite_step_retry(&retry, stmt) == -1)
if (!sqlite_code_ok(sqlite_step_retry(&retry, stmt)))
goto rollback;
sqlite3_finalize(stmt);
stmt = NULL;
@ -1455,13 +1455,14 @@ int rhizome_list_next(struct rhizome_list_cursor *c)
IN();
if (c->_statement == NULL && rhizome_list_open(c) == -1)
RETURN(-1);
int r=0;
while (1) {
if (c->manifest) {
rhizome_manifest_free(c->manifest);
c->_rowid_current = 0;
c->manifest = NULL;
}
if (sqlite_step_retry(&c->_retry, c->_statement) != SQLITE_ROW)
if ((r=sqlite_step_retry(&c->_retry, c->_statement)) != SQLITE_ROW)
break;
assert(sqlite3_column_count(c->_statement) == 6);
assert(sqlite3_column_type(c->_statement, 0) == SQLITE_TEXT);
@ -1526,7 +1527,7 @@ int rhizome_list_next(struct rhizome_list_cursor *c)
RETURN(1);
}
assert(c->_rowid_current == 0);
RETURN(0);
RETURN(sqlite_code_ok(r)?0:-1);
OUT();
}
@ -1601,7 +1602,8 @@ enum rhizome_bundle_status rhizome_find_duplicate(const rhizome_manifest *m, rhi
sqlite_bind(&retry, statement, INDEX|SID_T, ++field, &m->recipient, END);
int rows = 0;
while (sqlite_step_retry(&retry, statement) == SQLITE_ROW) {
int r=0;
while ((r=sqlite_step_retry(&retry, statement)) == SQLITE_ROW) {
++rows;
if (config.debug.rhizome)
DEBUGF("Row %d", rows);
@ -1647,11 +1649,21 @@ next:
rhizome_manifest_free(blob_m);
}
sqlite3_finalize(statement);
if (!sqlite_code_ok(r))
ret=-1;
return ret;
}
static int unpack_manifest_row(rhizome_manifest *m, sqlite3_stmt *statement)
static enum rhizome_bundle_status unpack_manifest_row(sqlite_retry_state *retry, rhizome_manifest *m, sqlite3_stmt *statement)
{
int r=sqlite_step_retry(retry, statement);
if (sqlite_code_busy(r))
return RHIZOME_BUNDLE_STATUS_BUSY;
if (!sqlite_code_ok(r))
return RHIZOME_BUNDLE_STATUS_ERROR;
if (r!=SQLITE_ROW)
return RHIZOME_BUNDLE_STATUS_NEW;
const char *q_id = (const char *) sqlite3_column_text(statement, 0);
const char *q_blob = (char *) sqlite3_column_blob(statement, 1);
uint64_t q_version = sqlite3_column_int64(statement, 2);
@ -1674,17 +1686,18 @@ static int unpack_manifest_row(rhizome_manifest *m, sqlite3_stmt *statement)
WARNF("Version mismatch, manifest is %"PRIu64", database is %"PRIu64, m->version, q_version);
rhizome_manifest_set_rowid(m, q_rowid);
rhizome_manifest_set_inserttime(m, q_inserttime);
return 0;
return RHIZOME_BUNDLE_STATUS_SAME;
}
/* Retrieve a manifest from the database, given its Bundle ID.
*
* Returns 0 if manifest is found
* Returns 1 if manifest is not found
* Returns -1 on error
* Returns RHIZOME_BUNDLE_STATUS_SAME if manifest is found
* Returns RHIZOME_BUNDLE_STATUS_NEW if manifest is not found
* Returns RHIZOME_BUNDLE_STATUS_ERROR on error
* Returns RHIZOME_BUNDLE_STATUS_BUSY if the database is locked
* Caller is responsible for allocating and freeing rhizome_manifest
*/
int rhizome_retrieve_manifest(const rhizome_bid_t *bidp, rhizome_manifest *m)
enum rhizome_bundle_status rhizome_retrieve_manifest(const rhizome_bid_t *bidp, rhizome_manifest *m)
{
sqlite_retry_state retry = SQLITE_RETRY_STATE_DEFAULT;
sqlite3_stmt *statement = sqlite_prepare_bind(&retry,
@ -1692,33 +1705,21 @@ int rhizome_retrieve_manifest(const rhizome_bid_t *bidp, rhizome_manifest *m)
RHIZOME_BID_T, bidp,
END);
if (!statement)
return -1;
int ret;
switch(sqlite_step_retry(&retry, statement)){
case SQLITE_ROW:
ret = unpack_manifest_row(m, statement);
break;
case -1:
ret = -1;
break;
default:
ret = 1;
if (config.debug.rhizome)
DEBUGF("Manifest id=%s not found", alloca_tohex_rhizome_bid_t(*bidp));
}
return RHIZOME_BUNDLE_STATUS_ERROR;
enum rhizome_bundle_status ret = unpack_manifest_row(&retry, m, statement);
sqlite3_finalize(statement);
return ret;
}
/* Retrieve any manifest from the database whose Bundle ID starts with the given prefix.
*
* Returns 0 if a manifest is found
* Returns 1 if no manifest is found
* Returns -1 on error
* Returns RHIZOME_BUNDLE_STATUS_SAME if manifest is found
* Returns RHIZOME_BUNDLE_STATUS_NEW if manifest is not found
* Returns RHIZOME_BUNDLE_STATUS_ERROR on error
* Returns RHIZOME_BUNDLE_STATUS_BUSY if the database is locked
* Caller is responsible for allocating and freeing rhizome_manifest
*/
int rhizome_retrieve_manifest_by_prefix(const unsigned char *prefix, unsigned prefix_len, rhizome_manifest *m)
enum rhizome_bundle_status rhizome_retrieve_manifest_by_prefix(const unsigned char *prefix, unsigned prefix_len, rhizome_manifest *m)
{
sqlite_retry_state retry = SQLITE_RETRY_STATE_DEFAULT;
const unsigned prefix_strlen = prefix_len * 2;
@ -1731,12 +1732,8 @@ int rhizome_retrieve_manifest_by_prefix(const unsigned char *prefix, unsigned pr
TEXT, like,
END);
if (!statement)
return -1;
int ret = 1;
if (sqlite_step_retry(&retry, statement) == SQLITE_ROW)
ret = unpack_manifest_row(m, statement);
else
INFOF("Manifest with id prefix=`%s` not found", like);
return RHIZOME_BUNDLE_STATUS_ERROR;
enum rhizome_bundle_status ret = unpack_manifest_row(&retry, m, statement);
sqlite3_finalize(statement);
return ret;
}
@ -1789,7 +1786,6 @@ int rhizome_delete_manifest(const rhizome_bid_t *bidp)
static int is_interesting(const char *id_hex, uint64_t version)
{
IN();
int ret=1;
// do we have this bundle [or later]?
sqlite_retry_state retry = SQLITE_RETRY_STATE_DEFAULT;
@ -1800,7 +1796,9 @@ static int is_interesting(const char *id_hex, uint64_t version)
END);
if (!statement)
RETURN(-1);
if (sqlite_step_retry(&retry, statement) == SQLITE_ROW){
int ret=1;
int r = sqlite_step_retry(&retry, statement);
if (r == SQLITE_ROW){
const char *q_filehash = (const char *) sqlite3_column_text(statement, 0);
if (q_filehash && *q_filehash) {
rhizome_filehash_t hash;
@ -1810,7 +1808,10 @@ static int is_interesting(const char *id_hex, uint64_t version)
ret=0;
}else
ret=0;
}
}else if(sqlite_code_ok(r))
ret=1;
else
ret=-1;
sqlite3_finalize(statement);
RETURN(ret);
OUT();

View File

@ -125,6 +125,7 @@ static int rhizome_direct_import_end(struct http_request *hr)
case RHIZOME_BUNDLE_STATUS_READONLY:
case RHIZOME_BUNDLE_STATUS_DUPLICATE:
case RHIZOME_BUNDLE_STATUS_ERROR:
case RHIZOME_BUNDLE_STATUS_BUSY:
break;
}
http_request_simple_response(&r->http, 500, "Internal Error: Rhizome import failed");

View File

@ -520,7 +520,7 @@ schedule_fetch(struct rhizome_fetch_slot *slot)
// if we're fetching a journal bundle, work out how many bytes we have of a previous version
// and therefore what range of bytes we should ask for
slot->previous = rhizome_new_manifest();
if (rhizome_retrieve_manifest(&slot->manifest->cryptoSignPublic, slot->previous)){
if (rhizome_retrieve_manifest(&slot->manifest->cryptoSignPublic, slot->previous)!=RHIZOME_BUNDLE_STATUS_SAME){
rhizome_manifest_free(slot->previous);
slot->previous=NULL;
// check that the new journal is valid and has some overlapping bytes

View File

@ -59,14 +59,15 @@ int manifest_by_prefix_page(httpd_request *r, const char *remainder)
return 404; // not found
if ((r->manifest = rhizome_new_manifest()) == NULL)
return 500;
int ret = rhizome_retrieve_manifest_by_prefix(prefix.binary, prefix_len, r->manifest);
if (ret == -1)
return 500;
if (ret == 0) {
http_request_response_static(&r->http, 200, CONTENT_TYPE_BLOB, (const char *)r->manifest->manifestdata, r->manifest->manifest_all_bytes);
return 1;
switch(rhizome_retrieve_manifest_by_prefix(prefix.binary, prefix_len, r->manifest)){
case RHIZOME_BUNDLE_STATUS_SAME:
http_request_response_static(&r->http, 200, CONTENT_TYPE_BLOB, (const char *)r->manifest->manifestdata, r->manifest->manifest_all_bytes);
return 1;
case RHIZOME_BUNDLE_STATUS_NEW:
return 404;
default:
return 500;
}
return 404;
}
int rhizome_status_page(httpd_request *r, const char *remainder)

View File

@ -83,6 +83,7 @@ static int http_request_rhizome_response(struct httpd_request *r, uint16_t resul
rhizome_result = 403;
break;
case RHIZOME_BUNDLE_STATUS_ERROR:
case RHIZOME_BUNDLE_STATUS_BUSY:
rhizome_result = 500;
break;
}
@ -661,6 +662,7 @@ static int restful_rhizome_insert_end(struct http_request *hr)
case RHIZOME_BUNDLE_STATUS_NO_ROOM:
case RHIZOME_BUNDLE_STATUS_READONLY:
case RHIZOME_BUNDLE_STATUS_ERROR:
case RHIZOME_BUNDLE_STATUS_BUSY:
if (mout && mout != r->manifest)
rhizome_manifest_free(mout);
rhizome_manifest_free(r->manifest);
@ -710,23 +712,21 @@ int restful_rhizome_(httpd_request *r, const char *remainder)
return 405;
if ((r->manifest = rhizome_new_manifest()) == NULL)
return 500;
ret = rhizome_retrieve_manifest(&bid, r->manifest);
if (ret == -1) {
rhizome_manifest_free(r->manifest);
r->manifest = NULL;
r->bundle_status = RHIZOME_BUNDLE_STATUS_ERROR;
return 500;
r->bundle_status = rhizome_retrieve_manifest(&bid, r->manifest);
switch(r->bundle_status){
case RHIZOME_BUNDLE_STATUS_SAME:
rhizome_authenticate_author(r->manifest);
break;
case RHIZOME_BUNDLE_STATUS_NEW:
rhizome_manifest_free(r->manifest);
r->manifest = NULL;
break;
default:
rhizome_manifest_free(r->manifest);
r->manifest = NULL;
return 500;
}
if (ret == 0) {
rhizome_authenticate_author(r->manifest);
r->bundle_status = RHIZOME_BUNDLE_STATUS_SAME;
} else {
r->bundle_status = RHIZOME_BUNDLE_STATUS_NEW;
rhizome_manifest_free(r->manifest);
r->manifest = NULL;
}
ret = handler(r, remainder);
return ret;
return handler(r, remainder);
}
static int restful_rhizome_bid_rhm(httpd_request *r, const char *remainder)

View File

@ -253,8 +253,9 @@ static enum rhizome_payload_status store_make_space(uint64_t bytes, struct rhizo
END);
if (!statement)
return RHIZOME_PAYLOAD_STATUS_ERROR;
while (db_used + bytes > limit && sqlite_step_retry(&retry, statement) == SQLITE_ROW) {
int r=0;
while (db_used + bytes > limit && (r=sqlite_step_retry(&retry, statement)) == SQLITE_ROW) {
const char *id=(const char *) sqlite3_column_text(statement, 0);
uint64_t length = sqlite3_column_int(statement, 1);
time_ms_t inserttime = sqlite3_column_int64(statement, 2);
@ -291,12 +292,15 @@ static enum rhizome_payload_status store_make_space(uint64_t bytes, struct rhizo
if (db_used + bytes <= limit)
return RHIZOME_PAYLOAD_STATUS_NEW;
if (config.debug.rhizome)
DEBUGF("Not enough space for %"PRIu64". Used; %"PRIu64" = %"PRIu64" + %"PRIu64" * (%"PRIu64" - %"PRIu64"), Limit; %"PRIu64,
bytes, db_used, external_bytes, db_page_size, db_page_count, db_free_page_count, limit);
return RHIZOME_PAYLOAD_STATUS_EVICTED;
if (sqlite_code_ok(r)){
if (config.debug.rhizome)
DEBUGF("Not enough space for %"PRIu64". Used; %"PRIu64" = %"PRIu64" + %"PRIu64" * (%"PRIu64" - %"PRIu64"), Limit; %"PRIu64,
bytes, db_used, external_bytes, db_page_size, db_page_count, db_free_page_count, limit);
return RHIZOME_PAYLOAD_STATUS_EVICTED;
}
return RHIZOME_PAYLOAD_STATUS_ERROR;
}
int rhizome_store_cleanup(struct rhizome_cleanup_report *report)