提交 d1b149a9 编写于 作者: C Cary Xu

fix: adjust the initial array size of fs

上级 afbb72da
...@@ -110,6 +110,8 @@ int32_t tsdbBegin(STsdb *pTsdb) { ...@@ -110,6 +110,8 @@ int32_t tsdbBegin(STsdb *pTsdb) {
} }
int32_t tsdbCommit(STsdb *pTsdb) { int32_t tsdbCommit(STsdb *pTsdb) {
if (!pTsdb) return 0;
int32_t code = 0; int32_t code = 0;
SCommitH commith = {0}; SCommitH commith = {0};
SDFileSet *pSet = NULL; SDFileSet *pSet = NULL;
......
...@@ -20,6 +20,7 @@ extern const char *TSDB_LEVEL_DNAME[]; ...@@ -20,6 +20,7 @@ extern const char *TSDB_LEVEL_DNAME[];
typedef enum { TSDB_TXN_TEMP_FILE = 0, TSDB_TXN_CURR_FILE } TSDB_TXN_FILE_T; typedef enum { TSDB_TXN_TEMP_FILE = 0, TSDB_TXN_CURR_FILE } TSDB_TXN_FILE_T;
static const char *tsdbTxnFname[] = {"current.t", "current"}; static const char *tsdbTxnFname[] = {"current.t", "current"};
#define TSDB_MAX_FSETS(keep, days) ((keep) / (days) + 3) #define TSDB_MAX_FSETS(keep, days) ((keep) / (days) + 3)
#define TSDB_MAX_INIT_FSETS (365000)
static int tsdbComparFidFSet(const void *arg1, const void *arg2); static int tsdbComparFidFSet(const void *arg1, const void *arg2);
static void tsdbResetFSStatus(SFSStatus *pStatus); static void tsdbResetFSStatus(SFSStatus *pStatus);
...@@ -210,6 +211,10 @@ STsdbFS *tsdbNewFS(const STsdbKeepCfg *pCfg) { ...@@ -210,6 +211,10 @@ STsdbFS *tsdbNewFS(const STsdbKeepCfg *pCfg) {
return NULL; return NULL;
} }
if (maxFSet > TSDB_MAX_INIT_FSETS) {
maxFSet = TSDB_MAX_INIT_FSETS;
}
pfs->cstatus = tsdbNewFSStatus(maxFSet); pfs->cstatus = tsdbNewFSStatus(maxFSet);
if (pfs->cstatus == NULL) { if (pfs->cstatus == NULL) {
tsdbFreeFS(pfs); tsdbFreeFS(pfs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册