TD-1847 Modify the file names of wal module
This commit is contained in:
parent
18eb9e237b
commit
43edc0378f
|
@ -22,22 +22,22 @@ extern "C" {
|
||||||
#define TAOS_WAL_NOLOG 0
|
#define TAOS_WAL_NOLOG 0
|
||||||
#define TAOS_WAL_WRITE 1
|
#define TAOS_WAL_WRITE 1
|
||||||
#define TAOS_WAL_FSYNC 2
|
#define TAOS_WAL_FSYNC 2
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t msgType;
|
int8_t msgType;
|
||||||
int8_t reserved[3];
|
int8_t reserved[3];
|
||||||
int32_t len;
|
int32_t len;
|
||||||
uint64_t version;
|
uint64_t version;
|
||||||
uint32_t signature;
|
uint32_t signature;
|
||||||
uint32_t cksum;
|
uint32_t cksum;
|
||||||
char cont[];
|
char cont[];
|
||||||
} SWalHead;
|
} SWalHead;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t walLevel; // wal level
|
int8_t walLevel; // wal level
|
||||||
int32_t fsyncPeriod; // millisecond
|
int32_t fsyncPeriod; // millisecond
|
||||||
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
|
||||||
} SWalCfg;
|
} SWalCfg;
|
||||||
|
|
||||||
typedef void* twalh; // WAL HANDLE
|
typedef void* twalh; // WAL HANDLE
|
||||||
|
@ -53,9 +53,6 @@ int walRestore(twalh, void *pVnode, FWalWrite writeFp);
|
||||||
int walGetWalFile(twalh, char *name, uint32_t *index);
|
int walGetWalFile(twalh, char *name, uint32_t *index);
|
||||||
int64_t walGetVersion(twalh);
|
int64_t walGetVersion(twalh);
|
||||||
|
|
||||||
extern int wDebugFlag;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TDENGINE_WAL_INT_H
|
||||||
|
#define TDENGINE_WAL_INT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tlog.h"
|
||||||
|
|
||||||
|
extern int32_t wDebugFlag;
|
||||||
|
|
||||||
|
#define wFatal(...) { if (wDebugFlag & DEBUG_FATAL) { taosPrintLog("WAL FATAL ", 255, __VA_ARGS__); }}
|
||||||
|
#define wError(...) { if (wDebugFlag & DEBUG_ERROR) { taosPrintLog("WAL ERROR ", 255, __VA_ARGS__); }}
|
||||||
|
#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", 255, __VA_ARGS__); }}
|
||||||
|
#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL ", 255, __VA_ARGS__); }}
|
||||||
|
#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); }}
|
||||||
|
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
||||||
|
#define walPrefix "wal"
|
||||||
|
#define walSignature (uint32_t)(0xFAFBFDFE)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TDENGINE_WAL_MGMT_H
|
||||||
|
#define TDENGINE_WAL_MGMT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _DEFAULT_SOURCE
|
||||||
|
#include "os.h"
|
||||||
|
#include "taoserror.h"
|
||||||
|
#include "twal.h"
|
||||||
|
#include "walInt.h"
|
||||||
|
#include "walMgmt.h"
|
|
@ -14,11 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
|
|
||||||
#define TAOS_RANDOM_FILE_FAIL_TEST
|
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "tlog.h"
|
#include "twal.h"
|
||||||
|
#include "walInt.h"
|
||||||
|
#include "walMgmt.h"
|
||||||
#include "tchecksum.h"
|
#include "tchecksum.h"
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
#include "ttimer.h"
|
#include "ttimer.h"
|
||||||
|
@ -26,14 +25,6 @@
|
||||||
#include "twal.h"
|
#include "twal.h"
|
||||||
#include "tqueue.h"
|
#include "tqueue.h"
|
||||||
|
|
||||||
#define walPrefix "wal"
|
|
||||||
|
|
||||||
#define wFatal(...) { if (wDebugFlag & DEBUG_FATAL) { taosPrintLog("WAL FATAL ", 255, __VA_ARGS__); }}
|
|
||||||
#define wError(...) { if (wDebugFlag & DEBUG_ERROR) { taosPrintLog("WAL ERROR ", 255, __VA_ARGS__); }}
|
|
||||||
#define wWarn(...) { if (wDebugFlag & DEBUG_WARN) { taosPrintLog("WAL WARN ", 255, __VA_ARGS__); }}
|
|
||||||
#define wInfo(...) { if (wDebugFlag & DEBUG_INFO) { taosPrintLog("WAL ", 255, __VA_ARGS__); }}
|
|
||||||
#define wDebug(...) { if (wDebugFlag & DEBUG_DEBUG) { taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); }}
|
|
||||||
#define wTrace(...) { if (wDebugFlag & DEBUG_TRACE) { taosPrintLog("WAL ", wDebugFlag, __VA_ARGS__); }}
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t version;
|
uint64_t version;
|
||||||
|
@ -54,7 +45,6 @@ typedef struct {
|
||||||
static void *walTmrCtrl = NULL;
|
static void *walTmrCtrl = NULL;
|
||||||
static int tsWalNum = 0;
|
static int tsWalNum = 0;
|
||||||
static pthread_once_t walModuleInit = PTHREAD_ONCE_INIT;
|
static pthread_once_t walModuleInit = PTHREAD_ONCE_INIT;
|
||||||
static uint32_t walSignature = 0xFAFBFDFE;
|
|
||||||
static int walHandleExistingFiles(const char *path);
|
static int walHandleExistingFiles(const char *path);
|
||||||
static int walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp);
|
static int walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp);
|
||||||
static int walRemoveWalFiles(const char *path);
|
static int walRemoveWalFiles(const char *path);
|
Loading…
Reference in New Issue