提交 84c7b7ad 编写于 作者: C Cary Xu

extend fset version

上级 8a15545e
...@@ -300,7 +300,7 @@ static FORCE_INLINE int tsdbCopyDFile(SDFile* pSrc, SDFile* pDest) { ...@@ -300,7 +300,7 @@ static FORCE_INLINE int tsdbCopyDFile(SDFile* pSrc, SDFile* pDest) {
typedef struct { typedef struct {
int fid; int fid;
int state; int state;
uint8_t ver; // fset version uint16_t ver; // fset version
SDFile files[TSDB_FILE_MAX]; SDFile files[TSDB_FILE_MAX];
} SDFileSet; } SDFileSet;
...@@ -312,7 +312,7 @@ typedef enum { ...@@ -312,7 +312,7 @@ typedef enum {
#define TSDB_LATEST_FSET_VER TSDB_FSET_VER_1 #define TSDB_LATEST_FSET_VER TSDB_FSET_VER_1
// get nDFiles in SDFileSet // get nDFiles in SDFileSet
static FORCE_INLINE uint8_t tsdbGetNFiles(SDFileSet* pSet) { static FORCE_INLINE uint16_t tsdbGetNFiles(SDFileSet* pSet) {
switch (pSet->ver) { switch (pSet->ver) {
case TSDB_FSET_VER_0: case TSDB_FSET_VER_0:
return TSDB_FILE_MIN; return TSDB_FILE_MIN;
...@@ -338,7 +338,7 @@ static FORCE_INLINE uint8_t tsdbGetNFiles(SDFileSet* pSet) { ...@@ -338,7 +338,7 @@ static FORCE_INLINE uint8_t tsdbGetNFiles(SDFileSet* pSet) {
} \ } \
} while (0); } while (0);
void tsdbInitDFileSet(SDFileSet* pSet, SDiskID did, int vid, int fid, uint32_t ver, uint8_t fsetVer); void tsdbInitDFileSet(SDFileSet* pSet, SDiskID did, int vid, int fid, uint32_t ver, uint16_t fsetVer);
void tsdbInitDFileSetEx(SDFileSet* pSet, SDFileSet* pOSet); void tsdbInitDFileSetEx(SDFileSet* pSet, SDFileSet* pOSet);
int tsdbEncodeDFileSet(void** buf, SDFileSet* pSet); int tsdbEncodeDFileSet(void** buf, SDFileSet* pSet);
void* tsdbDecodeDFileSet(void* buf, SDFileSet* pSet, uint32_t sfver); void* tsdbDecodeDFileSet(void* buf, SDFileSet* pSet, uint32_t sfver);
......
...@@ -563,7 +563,7 @@ static int tsdbRollBackDFile(SDFile *pDFile) { ...@@ -563,7 +563,7 @@ static int tsdbRollBackDFile(SDFile *pDFile) {
} }
// ============== Operations on SDFileSet // ============== Operations on SDFileSet
void tsdbInitDFileSet(SDFileSet *pSet, SDiskID did, int vid, int fid, uint32_t ver, uint8_t fsetVer) { void tsdbInitDFileSet(SDFileSet *pSet, SDiskID did, int vid, int fid, uint32_t ver, uint16_t fsetVer) {
pSet->fid = fid; pSet->fid = fid;
pSet->state = 0; pSet->state = 0;
pSet->ver = fsetVer; pSet->ver = fsetVer;
...@@ -587,7 +587,7 @@ int tsdbEncodeDFileSet(void **buf, SDFileSet *pSet) { ...@@ -587,7 +587,7 @@ int tsdbEncodeDFileSet(void **buf, SDFileSet *pSet) {
int tlen = 0; int tlen = 0;
tlen += taosEncodeFixedI32(buf, pSet->fid); tlen += taosEncodeFixedI32(buf, pSet->fid);
tlen += taosEncodeFixedU8(buf, pSet->ver); tlen += taosEncodeFixedU16(buf, pSet->ver);
for (TSDB_FILE_T ftype = 0; ftype < tsdbGetNFiles(pSet); ftype++) { for (TSDB_FILE_T ftype = 0; ftype < tsdbGetNFiles(pSet); ftype++) {
tlen += tsdbEncodeSDFile(buf, TSDB_DFILE_IN_SET(pSet, ftype)); tlen += tsdbEncodeSDFile(buf, TSDB_DFILE_IN_SET(pSet, ftype));
} }
...@@ -603,7 +603,7 @@ void *tsdbDecodeDFileSet(void *buf, SDFileSet *pSet, uint32_t sfver) { ...@@ -603,7 +603,7 @@ void *tsdbDecodeDFileSet(void *buf, SDFileSet *pSet, uint32_t sfver) {
pSet->fid = fid; pSet->fid = fid;
if (sfver > TSDB_FS_VER_0) { if (sfver > TSDB_FS_VER_0) {
buf = taosDecodeFixedU8(buf, &(pSet->ver)); buf = taosDecodeFixedU16(buf, &(pSet->ver));
} }
ASSERT_TSDB_FSET_NFILES_VALID(pSet); ASSERT_TSDB_FSET_NFILES_VALID(pSet);
...@@ -617,7 +617,7 @@ int tsdbEncodeDFileSetEx(void **buf, SDFileSet *pSet) { ...@@ -617,7 +617,7 @@ int tsdbEncodeDFileSetEx(void **buf, SDFileSet *pSet) {
int tlen = 0; int tlen = 0;
tlen += taosEncodeFixedI32(buf, pSet->fid); tlen += taosEncodeFixedI32(buf, pSet->fid);
tlen += taosEncodeFixedU8(buf, pSet->ver); tlen += taosEncodeFixedU16(buf, pSet->ver);
for (TSDB_FILE_T ftype = 0; ftype < tsdbGetNFiles(pSet); ftype++) { for (TSDB_FILE_T ftype = 0; ftype < tsdbGetNFiles(pSet); ftype++) {
tlen += tsdbEncodeSDFileEx(buf, TSDB_DFILE_IN_SET(pSet, ftype)); tlen += tsdbEncodeSDFileEx(buf, TSDB_DFILE_IN_SET(pSet, ftype));
} }
...@@ -629,7 +629,7 @@ void *tsdbDecodeDFileSetEx(void *buf, SDFileSet *pSet) { ...@@ -629,7 +629,7 @@ void *tsdbDecodeDFileSetEx(void *buf, SDFileSet *pSet) {
int32_t fid; int32_t fid;
buf = taosDecodeFixedI32(buf, &(fid)); buf = taosDecodeFixedI32(buf, &(fid));
buf = taosDecodeFixedU8(buf, &(pSet->ver)); buf = taosDecodeFixedU16(buf, &(pSet->ver));
pSet->fid = fid; pSet->fid = fid;
for (TSDB_FILE_T ftype = 0; ftype < tsdbGetNFiles(pSet); ftype++) { for (TSDB_FILE_T ftype = 0; ftype < tsdbGetNFiles(pSet); ftype++) {
buf = tsdbDecodeSDFileEx(buf, TSDB_DFILE_IN_SET(pSet, ftype)); buf = tsdbDecodeSDFileEx(buf, TSDB_DFILE_IN_SET(pSet, ftype));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册