提交 30c7c2c0 编写于 作者: S Shengliang Guan

TD-1856

上级 8e1ddeea
......@@ -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);
......
......@@ -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
......
......@@ -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) {
......
......@@ -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];
......
......@@ -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) {
......
......@@ -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));
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册