diff --git a/src/vnode/wal/src/walMain.c b/src/vnode/wal/src/walMain.c index 9708b0d9dc31429412aff292567175983cd20f32..99be05cbe4fba60a4946fffcaeedca9f562e4814 100644 --- a/src/vnode/wal/src/walMain.c +++ b/src/vnode/wal/src/walMain.c @@ -125,7 +125,7 @@ int walRenew(twal_h handle) { if (pWal->num > pWal->max) { // remove the oldest wal file - char name[TSDB_FILENAME_LEN]; + char name[TSDB_FILENAME_LEN * 3]; sprintf(name, "%s/%s%d", pWal->path, walPrefix, pWal->id - pWal->max); if (remove(name) <0) { wError("wal:%s, failed to remove(%s)", name, strerror(errno)); @@ -177,7 +177,7 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, SWalHead *, in uint32_t maxId = 0, minId = -1, index =0; int plen = strlen(walPrefix); - char opath[TSDB_FILENAME_LEN]; + char opath[TSDB_FILENAME_LEN+5]; sprintf(opath, "%s/old", pWal->path); // is there old directory? @@ -294,8 +294,8 @@ static int walRestoreWalFile(char *name, void *pVnode, int (*writeFp)(void *, SW int walHandleExistingFiles(char *path) { int code = 0; - char oname[TSDB_FILENAME_LEN]; - char nname[TSDB_FILENAME_LEN]; + char oname[TSDB_FILENAME_LEN * 3]; + char nname[TSDB_FILENAME_LEN * 3]; char opath[TSDB_FILENAME_LEN]; sprintf(opath, "%s/old", path); @@ -336,7 +336,7 @@ int walHandleExistingFiles(char *path) { static int walRemoveWalFiles(char *path) { int plen = strlen(walPrefix); - char name[TSDB_FILENAME_LEN]; + char name[TSDB_FILENAME_LEN * 3]; int code = 0; if (access(path, F_OK) != 0) return 0;