add more code
This commit is contained in:
parent
df6eb27b75
commit
2a20347210
|
@ -75,6 +75,7 @@ typedef struct SStreamStateWriter SStreamStateWriter;
|
|||
typedef struct SRSmaSnapReader SRSmaSnapReader;
|
||||
typedef struct SRSmaSnapWriter SRSmaSnapWriter;
|
||||
typedef struct SSnapDataHdr SSnapDataHdr;
|
||||
typedef struct SCommitInfo SCommitInfo;
|
||||
|
||||
#define VNODE_META_DIR "meta"
|
||||
#define VNODE_TSDB_DIR "tsdb"
|
||||
|
@ -147,7 +148,7 @@ int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg*
|
|||
int tsdbClose(STsdb** pTsdb);
|
||||
int32_t tsdbBegin(STsdb* pTsdb);
|
||||
int32_t tsdbPrepareCommit(STsdb* pTsdb);
|
||||
int32_t tsdbCommit(STsdb* pTsdb);
|
||||
int32_t tsdbCommit(STsdb* pTsdb, SCommitInfo* pInfo);
|
||||
int32_t tsdbFinishCommit(STsdb* pTsdb);
|
||||
int32_t tsdbRollbackCommit(STsdb* pTsdb);
|
||||
int32_t tsdbDoRetention(STsdb* pTsdb, int64_t now);
|
||||
|
@ -205,7 +206,7 @@ int32_t smaSyncPreCommit(SSma* pSma);
|
|||
int32_t smaSyncCommit(SSma* pSma);
|
||||
int32_t smaSyncPostCommit(SSma* pSma);
|
||||
int32_t smaPreCommit(SSma* pSma);
|
||||
int32_t smaCommit(SSma* pSma);
|
||||
int32_t smaCommit(SSma* pSma, SCommitInfo* pInfo);
|
||||
int32_t smaFinishCommit(SSma* pSma);
|
||||
int32_t smaPostCommit(SSma* pSma);
|
||||
int32_t smaDoRetention(SSma* pSma, int64_t now);
|
||||
|
@ -407,6 +408,11 @@ struct SSnapDataHdr {
|
|||
uint8_t data[];
|
||||
};
|
||||
|
||||
struct SCommitInfo {
|
||||
SVnodeInfo info;
|
||||
SVnode* pVnode;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@ static int32_t tdProcessRSmaSyncCommitImpl(SSma *pSma);
|
|||
static int32_t tdProcessRSmaSyncPostCommitImpl(SSma *pSma);
|
||||
#endif
|
||||
static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma);
|
||||
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma);
|
||||
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma, SCommitInfo *pInfo);
|
||||
static int32_t tdProcessRSmaAsyncPostCommitImpl(SSma *pSma);
|
||||
static int32_t tdUpdateQTaskInfoFiles(SSma *pSma, SRSmaStat *pRSmaStat);
|
||||
|
||||
|
@ -67,7 +67,7 @@ int32_t smaPreCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma);
|
|||
* @param pSma
|
||||
* @return int32_t
|
||||
*/
|
||||
int32_t smaCommit(SSma *pSma) { return tdProcessRSmaAsyncCommitImpl(pSma); }
|
||||
int32_t smaCommit(SSma *pSma, SCommitInfo *pInfo) { return tdProcessRSmaAsyncCommitImpl(pSma, pInfo); }
|
||||
|
||||
/**
|
||||
* @brief async commit, only applicable to Rollup SMA
|
||||
|
@ -127,8 +127,8 @@ _exit:
|
|||
}
|
||||
|
||||
int32_t smaFinishCommit(SSma *pSma) {
|
||||
int32_t code = 0;
|
||||
SVnode *pVnode = pSma->pVnode;
|
||||
int32_t code = 0;
|
||||
SVnode *pVnode = pSma->pVnode;
|
||||
|
||||
if (VND_RSMA1(pVnode) && (code = tsdbFinishCommit(VND_RSMA1(pVnode))) < 0) {
|
||||
smaError("vgId:%d, failed to finish commit tsdb rsma1 since %s", TD_VID(pVnode), tstrerror(code));
|
||||
|
@ -387,9 +387,9 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
|
|||
* @param pSma
|
||||
* @return int32_t
|
||||
*/
|
||||
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma) {
|
||||
int32_t code = 0;
|
||||
SVnode *pVnode = pSma->pVnode;
|
||||
static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma, SCommitInfo *pInfo) {
|
||||
int32_t code = 0;
|
||||
SVnode *pVnode = pSma->pVnode;
|
||||
#if 0
|
||||
SRSmaStat *pRSmaStat = (SRSmaStat *)SMA_ENV_STAT(pSmaEnv);
|
||||
|
||||
|
@ -399,11 +399,11 @@ static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if ((code = tsdbCommit(VND_RSMA1(pVnode))) < 0) {
|
||||
if ((code = tsdbCommit(VND_RSMA1(pVnode), pInfo)) < 0) {
|
||||
smaError("vgId:%d, failed to commit tsdb rsma1 since %s", TD_VID(pVnode), tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
if ((code = tsdbCommit(VND_RSMA2(pVnode))) < 0) {
|
||||
if ((code = tsdbCommit(VND_RSMA2(pVnode), pInfo)) < 0) {
|
||||
smaError("vgId:%d, failed to commit tsdb rsma2 since %s", TD_VID(pVnode), tstrerror(code));
|
||||
goto _exit;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ typedef struct {
|
|||
SArray *aDelData; // SArray<SDelData>
|
||||
} SCommitter;
|
||||
|
||||
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter);
|
||||
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter, SCommitInfo *pInfo);
|
||||
static int32_t tsdbCommitData(SCommitter *pCommitter);
|
||||
static int32_t tsdbCommitDel(SCommitter *pCommitter);
|
||||
static int32_t tsdbCommitCache(SCommitter *pCommitter);
|
||||
|
@ -160,7 +160,7 @@ int32_t tsdbPrepareCommit(STsdb *pTsdb) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbCommit(STsdb *pTsdb) {
|
||||
int32_t tsdbCommit(STsdb *pTsdb, SCommitInfo *pInfo) {
|
||||
if (!pTsdb) return 0;
|
||||
|
||||
int32_t code = 0;
|
||||
|
@ -179,7 +179,7 @@ int32_t tsdbCommit(STsdb *pTsdb) {
|
|||
}
|
||||
|
||||
// start commit
|
||||
code = tsdbStartCommit(pTsdb, &commith);
|
||||
code = tsdbStartCommit(pTsdb, &commith, pInfo);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
// commit impl
|
||||
|
@ -816,7 +816,7 @@ _exit:
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
|
||||
static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter, SCommitInfo *pInfo) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
|
@ -824,13 +824,13 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
|
|||
ASSERT(pTsdb->imem && "last tsdb commit incomplete");
|
||||
|
||||
pCommitter->pTsdb = pTsdb;
|
||||
pCommitter->commitID = pTsdb->pVnode->state.commitID;
|
||||
pCommitter->commitID = pInfo->info.state.commitID;
|
||||
pCommitter->minutes = pTsdb->keepCfg.days;
|
||||
pCommitter->precision = pTsdb->keepCfg.precision;
|
||||
pCommitter->minRow = pTsdb->pVnode->config.tsdbCfg.minRows;
|
||||
pCommitter->maxRow = pTsdb->pVnode->config.tsdbCfg.maxRows;
|
||||
pCommitter->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression;
|
||||
pCommitter->sttTrigger = pTsdb->pVnode->config.sttTrigger;
|
||||
pCommitter->minRow = pInfo->info.config.tsdbCfg.minRows;
|
||||
pCommitter->maxRow = pInfo->info.config.tsdbCfg.maxRows;
|
||||
pCommitter->cmprAlg = pInfo->info.config.tsdbCfg.compression;
|
||||
pCommitter->sttTrigger = pInfo->info.config.sttTrigger;
|
||||
pCommitter->aTbDataP = tsdbMemTableGetTbDataArray(pTsdb->imem);
|
||||
if (pCommitter->aTbDataP == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
|
|
@ -14,11 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "vnd.h"
|
||||
|
||||
typedef struct {
|
||||
SVnodeInfo info;
|
||||
SVnode *pVnode;
|
||||
} SCommitInfo;
|
||||
#include "vnodeInt.h"
|
||||
|
||||
#define VND_INFO_FNAME "vnode.json"
|
||||
#define VND_INFO_FNAME_TMP "vnode_tmp.json"
|
||||
|
@ -291,11 +287,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
|||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
code = tsdbCommit(pVnode->pTsdb);
|
||||
code = tsdbCommit(pVnode->pTsdb, pInfo);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if (VND_IS_RSMA(pVnode)) {
|
||||
code = smaCommit(pVnode->pSma);
|
||||
code = smaCommit(pVnode->pSma, pInfo);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue