TD-1856
This commit is contained in:
parent
8e1ddeeaf2
commit
30c7c2c0f6
|
@ -68,7 +68,7 @@ typedef uint32_t (*FGetFileInfo)(void *ahandle, char *name, uint32_t *index, uin
|
||||||
|
|
||||||
// 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
|
||||||
typedef int (*FGetWalInfo)(void *ahandle, char *name, int64_t *index);
|
typedef int32_t (*FGetWalInfo)(void *ahandle, char *fileName, int64_t *fileId);
|
||||||
|
|
||||||
// when a forward pkt is received, call this to handle data
|
// when a forward pkt is received, call this to handle data
|
||||||
typedef int (*FWriteToCache)(void *ahandle, void *pHead, int type);
|
typedef int (*FWriteToCache)(void *ahandle, void *pHead, int type);
|
||||||
|
|
|
@ -41,7 +41,6 @@ typedef struct {
|
||||||
int8_t walLevel; // wal level
|
int8_t walLevel; // wal level
|
||||||
int8_t wals; // number of WAL files;
|
int8_t wals; // number of WAL files;
|
||||||
int8_t keep; // keep the wal file when closed
|
int8_t keep; // keep the wal file when closed
|
||||||
int8_t reserved[5];
|
|
||||||
} SWalCfg;
|
} SWalCfg;
|
||||||
|
|
||||||
typedef void* twalh; // WAL HANDLE
|
typedef void* twalh; // WAL HANDLE
|
||||||
|
|
|
@ -237,8 +237,8 @@ static uint32_t sdbGetFileInfo(void *ahandle, char *name, uint32_t *index, uint3
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sdbGetWalInfo(void *ahandle, char *name, int64_t *index) {
|
static int32_t sdbGetWalInfo(void *ahandle, char *fileName, int64_t *fileId) {
|
||||||
return walGetWalFile(tsSdbObj.wal, name, index);
|
return walGetWalFile(tsSdbObj.wal, fileName, fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sdbNotifyRole(void *ahandle, int8_t role) {
|
static void sdbNotifyRole(void *ahandle, int8_t role) {
|
||||||
|
|
|
@ -254,7 +254,7 @@ uint32_t getFileInfo(void *ahandle, char *name, uint32_t *index, uint32_t eindex
|
||||||
return magic;
|
return magic;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getWalInfo(void *ahandle, char *name, uint64_t *index) {
|
int getWalInfo(void *ahandle, char *name, int64_t *index) {
|
||||||
struct stat fstat;
|
struct stat fstat;
|
||||||
char aname[280];
|
char aname[280];
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ 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, uint32_t eindex, int64_t *size, uint64_t *fversion);
|
static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, uint32_t eindex, int64_t *size, uint64_t *fversion);
|
||||||
static int vnodeGetWalInfo(void *ahandle, char *name, int64_t *index);
|
static int vnodeGetWalInfo(void *ahandle, char *fileName, int64_t *fileId);
|
||||||
static void vnodeNotifyRole(void *ahandle, int8_t role);
|
static void vnodeNotifyRole(void *ahandle, int8_t role);
|
||||||
static void vnodeCtrlFlow(void *handle, int32_t mseconds);
|
static void vnodeCtrlFlow(void *handle, int32_t mseconds);
|
||||||
static int vnodeNotifyFileSynced(void *ahandle, uint64_t fversion);
|
static int vnodeNotifyFileSynced(void *ahandle, uint64_t fversion);
|
||||||
|
@ -622,9 +622,9 @@ static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, uin
|
||||||
return tsdbGetFileInfo(pVnode->tsdb, name, index, eindex, size);
|
return tsdbGetFileInfo(pVnode->tsdb, name, index, eindex, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vnodeGetWalInfo(void *ahandle, char *name, int64_t *index) {
|
static int vnodeGetWalInfo(void *ahandle, char *fileName, int64_t *fileId) {
|
||||||
SVnodeObj *pVnode = ahandle;
|
SVnodeObj *pVnode = ahandle;
|
||||||
return walGetWalFile(pVnode->wal, name, index);
|
return walGetWalFile(pVnode->wal, fileName, fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vnodeNotifyRole(void *ahandle, int8_t role) {
|
static void vnodeNotifyRole(void *ahandle, int8_t role) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ int32_t walRenew(void *handle) {
|
||||||
|
|
||||||
if (!pWal->keep && lastId != -1) {
|
if (!pWal->keep && lastId != -1) {
|
||||||
// remove last wal file
|
// remove last wal file
|
||||||
char name[TSDB_FILENAME_LEN + 20];
|
char name[WAL_FILE_LEN];
|
||||||
snprintf(name, sizeof(name), "%s/%s%" PRId64, pWal->path, WAL_PREFIX, lastId);
|
snprintf(name, sizeof(name), "%s/%s%" PRId64, pWal->path, WAL_PREFIX, lastId);
|
||||||
if (remove(name) < 0) {
|
if (remove(name) < 0) {
|
||||||
wError("vgId:%d, file:%s, failed to remove since %s", pWal->vgId, name, strerror(errno));
|
wError("vgId:%d, file:%s, failed to remove since %s", pWal->vgId, name, strerror(errno));
|
||||||
|
|
|
@ -116,7 +116,7 @@ int main(int argc, char *argv[]) {
|
||||||
printf("%d wal files are written\n", total);
|
printf("%d wal files are written\n", total);
|
||||||
|
|
||||||
int64_t index = 0;
|
int64_t index = 0;
|
||||||
char name[256];
|
char name[256];
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int code = walGetWalFile(pWal, name, &index);
|
int code = walGetWalFile(pWal, name, &index);
|
||||||
|
|
Loading…
Reference in New Issue