Update the fdb initialization
This commit is contained in:
parent
85c7539833
commit
dc7fd4f641
|
@ -94,7 +94,7 @@ void _fdb_init_finish(fdb_db_t db, fdb_err_t result)
|
|||
log_is_show = true;
|
||||
}
|
||||
} else {
|
||||
FDB_INFO("Error: %s(%s) at partition %s is initialize fail(%d).\n", db->type == FDB_DB_TYPE_KV ? "KV" : "TS",
|
||||
db->name, db->part->name, result);
|
||||
FDB_INFO("Error: %s (%s) is initialize fail (%d).\n", db->type == FDB_DB_TYPE_KV ? "KVDB" : "TSDB",
|
||||
db->name, result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1543,6 +1543,9 @@ fdb_err_t fdb_kvdb_init(fdb_kvdb_t db, const char *name, const char *part_name,
|
|||
FDB_ASSERT((FDB_STR_KV_VALUE_MAX_SIZE * 8) % FDB_WRITE_GRAN == 0);
|
||||
|
||||
result = _fdb_init_ex((fdb_db_t)db, name, part_name, FDB_DB_TYPE_KV, user_data);
|
||||
if (result != FDB_NO_ERR) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
db->gc_request = false;
|
||||
db->in_recovery_check = false;
|
||||
|
@ -1563,8 +1566,7 @@ fdb_err_t fdb_kvdb_init(fdb_kvdb_t db, const char *name, const char *part_name,
|
|||
}
|
||||
#endif /* FDB_KV_USING_CACHE */
|
||||
|
||||
|
||||
FDB_DEBUG("KV in partition %s, size is %u bytes.\n", ((fdb_db_t)db)->part->name, db_part_size(db));
|
||||
FDB_DEBUG("KVDB in partition %s, size is %u bytes.\n", ((fdb_db_t)db)->part->name, db_part_size(db));
|
||||
|
||||
result = _fdb_kv_load(db);
|
||||
|
||||
|
@ -1574,6 +1576,8 @@ fdb_err_t fdb_kvdb_init(fdb_kvdb_t db, const char *name, const char *part_name,
|
|||
}
|
||||
#endif
|
||||
|
||||
__exit:
|
||||
|
||||
_fdb_init_finish((fdb_db_t)db, result);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -666,6 +666,9 @@ fdb_err_t fdb_tsdb_init(fdb_tsdb_t db, const char *name, const char *part_name,
|
|||
FDB_ASSERT(get_time);
|
||||
|
||||
result = _fdb_init_ex((fdb_db_t)db, name, part_name, FDB_DB_TYPE_TS, user_data);
|
||||
if (result != FDB_NO_ERR) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
db->get_time = get_time;
|
||||
db->max_len = max_len;
|
||||
|
@ -699,11 +702,13 @@ fdb_err_t fdb_tsdb_init(fdb_tsdb_t db, const char *name, const char *part_name,
|
|||
db->oldest_addr = latest_addr + db_sec_size(db);
|
||||
}
|
||||
}
|
||||
FDB_DEBUG("tsdb (%s) oldest sectors is 0x%08lX, current using sector is 0x%08lX.\n", db_name(db), db->oldest_addr,
|
||||
FDB_DEBUG("TSDB (%s) oldest sectors is 0x%08lX, current using sector is 0x%08lX.\n", db_name(db), db->oldest_addr,
|
||||
db->cur_sec.addr);
|
||||
/* read the current using sector info */
|
||||
read_sector_info(db, db->cur_sec.addr, &db->cur_sec, true);
|
||||
|
||||
__exit:
|
||||
|
||||
_fdb_init_finish((fdb_db_t)db, result);
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue