diff --git a/src/fdb_kvdb.c b/src/fdb_kvdb.c index 6c04534..4089c79 100644 --- a/src/fdb_kvdb.c +++ b/src/fdb_kvdb.c @@ -1531,6 +1531,8 @@ void fdb_kvdb_control(fdb_kvdb_t db, int cmd, void *arg) switch (cmd) { case FDB_KVDB_CTRL_SET_SEC_SIZE: + /* the sector size change MUST before database initialization */ + FDB_ASSERT(db->parent.init_ok == false); db->parent.sec_size = *(uint32_t *)arg; break; case FDB_KVDB_CTRL_GET_SEC_SIZE: diff --git a/src/fdb_tsdb.c b/src/fdb_tsdb.c index 8cd5ea8..8d99678 100644 --- a/src/fdb_tsdb.c +++ b/src/fdb_tsdb.c @@ -675,6 +675,8 @@ void fdb_tsdb_control(fdb_tsdb_t db, int cmd, void *arg) *(bool *)arg = db->rollover; break; case FDB_TSDB_CTRL_SET_SEC_SIZE: + /* the sector size change MUST before database initialization */ + FDB_ASSERT(db->parent.init_ok == false); db->parent.sec_size = *(uint32_t *)arg; break; case FDB_TSDB_CTRL_GET_SEC_SIZE: