add compress

This commit is contained in:
Yihao Deng 2024-04-17 09:37:23 +00:00
parent 07008747ed
commit a461b24ac9
1 changed files with 8 additions and 15 deletions

View File

@ -1610,13 +1610,9 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
code = 0; code = 0;
goto _EXCEPT; goto _EXCEPT;
} }
if (vlen == (sizeof(key.unixTimestamp) + sizeof(key.len) + key.len)) { if (vlen == (sizeof(key.unixTimestamp) + sizeof(key.len) + key.len)) {
// compatiable with previous data // compatiable with previous data
if (dest != NULL) { p = taosDecodeBinary(p, (void**)&pOutput, key.len);
p = taosDecodeBinary(p, (void**)dest, key.len);
}
} else { } else {
p = taosDecodeFixedI32(p, &key.rawLen); p = taosDecodeFixedI32(p, &key.rawLen);
p = taosDecodeFixedI8(p, &key.compress); p = taosDecodeFixedI8(p, &key.compress);
@ -1633,23 +1629,20 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
goto _EXCEPT; goto _EXCEPT;
} }
key.len = rawLen; key.len = rawLen;
if (dest) {
*dest = pOutput;
pOutput = NULL;
}
} else { } else {
if (dest != NULL) { p = taosDecodeBinary(p, (void**)&pOutput, key.len);
p = taosDecodeBinary(p, (void**)dest, key.len);
}
} }
} }
if (ttl != NULL) *ttl = key.unixTimestamp == 0 ? 0 : key.unixTimestamp - taosGetTimestampMs(); if (ttl != NULL) *ttl = key.unixTimestamp == 0 ? 0 : key.unixTimestamp - taosGetTimestampMs();
code = 0;
taosMemoryFree(pOutput); code = 0;
if (dest) {
*dest = pOutput;
pOutput = NULL;
}
taosMemoryFree(pCompressData); taosMemoryFree(pCompressData);
taosMemoryFree(pOutput);
return key.len; return key.len;
_EXCEPT: _EXCEPT: