add eindex in getFileInfo
This commit is contained in:
parent
2d146684b1
commit
095d5f8ddf
|
@ -111,7 +111,7 @@ int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);
|
||||||
int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg);
|
int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg);
|
||||||
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, uint64_t uid);
|
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, uint64_t uid);
|
||||||
|
|
||||||
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size);
|
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, uint32_t eindex, int32_t *size);
|
||||||
|
|
||||||
// the TSDB repository info
|
// the TSDB repository info
|
||||||
typedef struct STsdbRepoInfo {
|
typedef struct STsdbRepoInfo {
|
||||||
|
|
|
@ -21,6 +21,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TAOS_SYNC_MAX_REPLICA 5
|
#define TAOS_SYNC_MAX_REPLICA 5
|
||||||
|
#define TAOS_SYNC_MAX_INDEX 0x7FFFFFFF
|
||||||
|
|
||||||
typedef enum _TAOS_SYNC_ROLE {
|
typedef enum _TAOS_SYNC_ROLE {
|
||||||
TAOS_SYNC_ROLE_OFFLINE,
|
TAOS_SYNC_ROLE_OFFLINE,
|
||||||
|
@ -54,10 +55,15 @@ typedef struct {
|
||||||
int role[TAOS_SYNC_MAX_REPLICA];
|
int role[TAOS_SYNC_MAX_REPLICA];
|
||||||
} SNodesRole;
|
} SNodesRole;
|
||||||
|
|
||||||
// if name is empty(name[0] is zero), get the file from index or after, used by master
|
/*
|
||||||
// if name is provided(name[0] is not zero), get the named file at the specified index, used by unsynced node
|
if name is empty(name[0] is zero), get the file from index or after, but not larger than eindex. If a file
|
||||||
// it returns the file magic number and size, if file not there, magic shall be 0.
|
is found between index and eindex, index shall be updated, name shall be set, size shall be set to
|
||||||
typedef uint32_t (*FGetFileInfo)(void *ahandle, char *name, uint32_t *index, int32_t *size, uint64_t *fversion);
|
file size, and file magic number shall be returned.
|
||||||
|
|
||||||
|
if name is provided(name[0] is not zero), get the named file at the specified index. If not there, return
|
||||||
|
zero. If it is there, set the size to file size, and return file magic number. Index shall not be updated.
|
||||||
|
*/
|
||||||
|
typedef uint32_t (*FGetFileInfo)(void *ahandle, char *name, uint32_t *index, uint32_t eindex, int32_t *size, uint64_t *fversion);
|
||||||
|
|
||||||
// get the wal file from index or after
|
// get the wal file from index or after
|
||||||
// return value, -1: error, 1:more wal files, 0:last WAL. if name[0]==0, no WAL file
|
// return value, -1: error, 1:more wal files, 0:last WAL. if name[0]==0, no WAL file
|
||||||
|
|
|
@ -201,7 +201,7 @@ void sdbUpdateMnodeRoles() {
|
||||||
mgmtUpdateMnodeIpSet();
|
mgmtUpdateMnodeIpSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t sdbGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size, uint64_t *fversion) {
|
static uint32_t sdbGetFileInfo(void *ahandle, char *name, uint32_t *index, uint32_t eindex, int32_t *size, uint64_t *fversion) {
|
||||||
sdbUpdateMnodeRoles();
|
sdbUpdateMnodeRoles();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) {
|
||||||
tsdbTrace("vgId:%d, tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables);
|
tsdbTrace("vgId:%d, tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size) {
|
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, uint32_t eindex, int32_t *size) {
|
||||||
// TODO: need to refactor this function
|
// TODO: need to refactor this function
|
||||||
|
|
||||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||||
|
|
|
@ -37,7 +37,7 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode);
|
||||||
static int32_t vnodeSaveVersion(SVnodeObj *pVnode);
|
static int32_t vnodeSaveVersion(SVnodeObj *pVnode);
|
||||||
static int32_t vnodeReadVersion(SVnodeObj *pVnode);
|
static int32_t vnodeReadVersion(SVnodeObj *pVnode);
|
||||||
static int vnodeProcessTsdbStatus(void *arg, int status);
|
static int vnodeProcessTsdbStatus(void *arg, int status);
|
||||||
static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size, uint64_t *fversion);
|
static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, uint32_t eindex, int32_t *size, uint64_t *fversion);
|
||||||
static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index);
|
static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index);
|
||||||
static void vnodeNotifyRole(void *ahandle, int8_t role);
|
static void vnodeNotifyRole(void *ahandle, int8_t role);
|
||||||
static void vnodeNotifyFileSynced(void *ahandle, uint64_t fversion);
|
static void vnodeNotifyFileSynced(void *ahandle, uint64_t fversion);
|
||||||
|
@ -429,10 +429,10 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size, uint64_t *fversion) {
|
static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, uint32_t eindex, int32_t *size, uint64_t *fversion) {
|
||||||
SVnodeObj *pVnode = ahandle;
|
SVnodeObj *pVnode = ahandle;
|
||||||
*fversion = pVnode->fversion;
|
*fversion = pVnode->fversion;
|
||||||
return tsdbGetFileInfo(pVnode->tsdb, name, index, size);
|
return tsdbGetFileInfo(pVnode->tsdb, name, index, eindex, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index) {
|
static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index) {
|
||||||
|
|
Loading…
Reference in New Issue