提交 b6d3e1e0 编写于 作者: H Hongze Cheng

refactor

上级 16a8556b
...@@ -151,6 +151,8 @@ static int tsdbCommitTimeSeriesData(SCommitHandle *pCommitH) { ...@@ -151,6 +151,8 @@ static int tsdbCommitTimeSeriesData(SCommitHandle *pCommitH) {
STsdbRepo *pRepo = pCommitH->pRepo; STsdbRepo *pRepo = pCommitH->pRepo;
SMemTable *pMem = pRepo->imem; SMemTable *pMem = pRepo->imem;
STsdbCfg * pCfg = &(pRepo->config); STsdbCfg * pCfg = &(pRepo->config);
TSKEY minKey = 0;
TSKEY maxKey = 0;
int mfid = tsdbGetCurrMinFid(pCfg->precision, pCfg->keep, pCfg->daysPerFile); int mfid = tsdbGetCurrMinFid(pCfg->precision, pCfg->keep, pCfg->daysPerFile);
if (tsdbLogRetentionChange(pCommitH, mfid) < 0) return -1; if (tsdbLogRetentionChange(pCommitH, mfid) < 0) return -1;
...@@ -161,19 +163,16 @@ static int tsdbCommitTimeSeriesData(SCommitHandle *pCommitH) { ...@@ -161,19 +163,16 @@ static int tsdbCommitTimeSeriesData(SCommitHandle *pCommitH) {
STSCommitHandle *pTSCh = tsdbNewTSCommitHandle(pRepo); STSCommitHandle *pTSCh = tsdbNewTSCommitHandle(pRepo);
if (pTSCh == NULL) return -1; if (pTSCh == NULL) return -1;
// Seek skip over data beyond retention
tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, fid, &minKey, &maxKey);
tsdbSeekTSCommitHandle(pTSCh, maxKey);
// Commit Time-Series data file by file // Commit Time-Series data file by file
int sfid = (int)(TSDB_KEY_FILEID(pMem->keyFirst, pCfg->daysPerFile, pCfg->precision)); int sfid = (int)(TSDB_KEY_FILEID(pMem->keyFirst, pCfg->daysPerFile, pCfg->precision));
int efid = (int)(TSDB_KEY_FILEID(pMem->keyLast, pCfg->daysPerFile, pCfg->precision)); int efid = (int)(TSDB_KEY_FILEID(pMem->keyLast, pCfg->daysPerFile, pCfg->precision));
for (int fid = sfid; fid <= efid; fid++) { for (int fid = sfid; fid <= efid; fid++) {
TSKEY minKey = 0, maxKey = 0; if (fid < mfid) continue;
tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, fid, &minKey, &maxKey);
if (fid < mfid) {
// Skip data in files beyond retention
tsdbSeekTSCommitHandle(&tsCommitH, maxKey);
continue;
}
if (!tsdbHasDataToCommit(tsCommitH.pIters, pMem->maxTables, minKey, maxKey)) continue; if (!tsdbHasDataToCommit(tsCommitH.pIters, pMem->maxTables, minKey, maxKey)) continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册