fix: set field length properly in tsdbGetSnapDetails
This commit is contained in:
parent
83013e0fe5
commit
f2bd43c07e
|
@ -52,9 +52,9 @@ typedef enum {
|
|||
|
||||
int32_t grantCheck(EGrantType grant);
|
||||
#ifndef TD_GRANT_OPTIMIZE
|
||||
int32_t grantAlterActiveCode(const char* old, const char* new, char* out, int8_t type);
|
||||
int32_t grantAlterActiveCode(const char* old, const char* newer, char* out, int8_t type);
|
||||
#else
|
||||
int32_t grantAlterActiveCode(int32_t did, const char* old, const char* new, char* out, int8_t type);
|
||||
int32_t grantAlterActiveCode(int32_t did, const char* old, const char* newer, char* out, int8_t type);
|
||||
#endif
|
||||
|
||||
#ifndef GRANTS_CFG
|
||||
|
|
|
@ -1562,6 +1562,7 @@ int32_t tsdbSnapGetDetails(SVnode* pVnode, SSnapshot* pSnap) {
|
|||
head->len = 0;
|
||||
head->typ = pSnap->type;
|
||||
int32_t offset = sizeof(SSyncTLV);
|
||||
int32_t tlen = 0;
|
||||
|
||||
// fill snapshot info
|
||||
for (int32_t j = 0; j < tsdbMaxCnt; ++j) {
|
||||
|
@ -1573,7 +1574,6 @@ int32_t tsdbSnapGetDetails(SVnode* pVnode, SSnapshot* pSnap) {
|
|||
subHead->typ = subTyps[j];
|
||||
ASSERT(subHead->val == (char*)data + offset + sizeof(SSyncTLV));
|
||||
|
||||
int32_t tlen = 0;
|
||||
if ((tlen = tSerializeTsdbSnapPartList(subHead->val, bufLen - offset - sizeof(SSyncTLV), pLists[j])) < 0) {
|
||||
tsdbError("vgId:%d, failed to serialize snap partition list of tsdb %d since %s", TD_VID(pVnode), j, terrstr());
|
||||
goto _out;
|
||||
|
@ -1582,7 +1582,8 @@ int32_t tsdbSnapGetDetails(SVnode* pVnode, SSnapshot* pSnap) {
|
|||
offset += sizeof(SSyncTLV) + tlen;
|
||||
}
|
||||
|
||||
head->len = offset;
|
||||
head->len = offset - sizeof(SSyncTLV);
|
||||
ASSERT(offset <= bufLen);
|
||||
code = 0;
|
||||
|
||||
_out:
|
||||
|
|
Loading…
Reference in New Issue