Merge pull request #76 from enkiller/0425

There can be no default kv
This commit is contained in:
朱天龙 (Armink) 2021-04-25 16:42:31 +08:00 committed by GitHub
commit 980b355d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -1601,7 +1601,6 @@ fdb_err_t fdb_kvdb_init(fdb_kvdb_t db, const char *name, const char *part_name,
size_t i; size_t i;
#endif #endif
FDB_ASSERT(default_kv);
/* must be aligned with write granularity */ /* must be aligned with write granularity */
FDB_ASSERT((FDB_STR_KV_VALUE_MAX_SIZE * 8) % FDB_WRITE_GRAN == 0); FDB_ASSERT((FDB_STR_KV_VALUE_MAX_SIZE * 8) % FDB_WRITE_GRAN == 0);
@ -1612,7 +1611,13 @@ fdb_err_t fdb_kvdb_init(fdb_kvdb_t db, const char *name, const char *part_name,
db->gc_request = false; db->gc_request = false;
db->in_recovery_check = false; db->in_recovery_check = false;
db->default_kvs = *default_kv; if (default_kv) {
db->default_kvs = *default_kv;
}
else {
db->default_kvs.num = 0;
db->default_kvs.kvs = NULL;
}
/* there is at least one empty sector for GC. */ /* there is at least one empty sector for GC. */
FDB_ASSERT((FDB_GC_EMPTY_SEC_THRESHOLD > 0 && FDB_GC_EMPTY_SEC_THRESHOLD < SECTOR_NUM)) FDB_ASSERT((FDB_GC_EMPTY_SEC_THRESHOLD > 0 && FDB_GC_EMPTY_SEC_THRESHOLD < SECTOR_NUM))