diff --git a/src/inc/tsync.h b/src/inc/tsync.h index 11b81f9379..671adefab8 100644 --- a/src/inc/tsync.h +++ b/src/inc/tsync.h @@ -68,7 +68,7 @@ typedef uint32_t (*FGetFileInfo)(void *ahandle, char *name, uint32_t *index, uin // 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 -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 typedef int (*FWriteToCache)(void *ahandle, void *pHead, int type); diff --git a/src/inc/twal.h b/src/inc/twal.h index b87831381d..94bdcacfce 100644 --- a/src/inc/twal.h +++ b/src/inc/twal.h @@ -41,7 +41,6 @@ typedef struct { int8_t walLevel; // wal level int8_t wals; // number of WAL files; int8_t keep; // keep the wal file when closed - int8_t reserved[5]; } SWalCfg; typedef void* twalh; // WAL HANDLE diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index a04c161599..e3c13505e4 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -237,8 +237,8 @@ static uint32_t sdbGetFileInfo(void *ahandle, char *name, uint32_t *index, uint3 return 0; } -static int sdbGetWalInfo(void *ahandle, char *name, int64_t *index) { - return walGetWalFile(tsSdbObj.wal, name, index); +static int32_t sdbGetWalInfo(void *ahandle, char *fileName, int64_t *fileId) { + return walGetWalFile(tsSdbObj.wal, fileName, fileId); } static void sdbNotifyRole(void *ahandle, int8_t role) { diff --git a/src/sync/test/syncServer.c b/src/sync/test/syncServer.c index 9ae45b25e3..0cf752da97 100644 --- a/src/sync/test/syncServer.c +++ b/src/sync/test/syncServer.c @@ -254,7 +254,7 @@ uint32_t getFileInfo(void *ahandle, char *name, uint32_t *index, uint32_t eindex return magic; } -int getWalInfo(void *ahandle, char *name, uint64_t *index) { +int getWalInfo(void *ahandle, char *name, int64_t *index) { struct stat fstat; char aname[280]; diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 2d5ec98a80..40eeeb4ed7 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -42,7 +42,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode); static int32_t vnodeReadVersion(SVnodeObj *pVnode); 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 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 vnodeCtrlFlow(void *handle, int32_t mseconds); 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); } -static int vnodeGetWalInfo(void *ahandle, char *name, int64_t *index) { +static int vnodeGetWalInfo(void *ahandle, char *fileName, int64_t *fileId) { SVnodeObj *pVnode = ahandle; - return walGetWalFile(pVnode->wal, name, index); + return walGetWalFile(pVnode->wal, fileName, fileId); } static void vnodeNotifyRole(void *ahandle, int8_t role) { diff --git a/src/wal/src/walWrite.c b/src/wal/src/walWrite.c index 45f00def06..70bcc49593 100644 --- a/src/wal/src/walWrite.c +++ b/src/wal/src/walWrite.c @@ -58,7 +58,7 @@ int32_t walRenew(void *handle) { if (!pWal->keep && lastId != -1) { // 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); if (remove(name) < 0) { wError("vgId:%d, file:%s, failed to remove since %s", pWal->vgId, name, strerror(errno)); diff --git a/src/wal/test/waltest.c b/src/wal/test/waltest.c index ba0011af29..186f2ef5ff 100644 --- a/src/wal/test/waltest.c +++ b/src/wal/test/waltest.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) { printf("%d wal files are written\n", total); int64_t index = 0; - char name[256]; + char name[256]; while (1) { int code = walGetWalFile(pWal, name, &index);