refactor backend
This commit is contained in:
parent
0baef335d7
commit
722d72659b
|
@ -140,6 +140,7 @@ TdFilePtr streamOpenFile(char* path, char* name, int32_t opt) {
|
||||||
int32_t streamBackendGetSnapInfo(void* arg, char* path, int64_t chkpId) { return taskBackendBuildSnap(arg, chkpId); }
|
int32_t streamBackendGetSnapInfo(void* arg, char* path, int64_t chkpId) { return taskBackendBuildSnap(arg, chkpId); }
|
||||||
|
|
||||||
void snapFileDebugInfo(SBackendSnapFile2* pSnapFile) {
|
void snapFileDebugInfo(SBackendSnapFile2* pSnapFile) {
|
||||||
|
if (qDebugFlag & DEBUG_DEBUG) {
|
||||||
char* buf = taosMemoryCalloc(1, 512);
|
char* buf = taosMemoryCalloc(1, 512);
|
||||||
sprintf(buf, "[current: %s,", pSnapFile->pCurrent);
|
sprintf(buf, "[current: %s,", pSnapFile->pCurrent);
|
||||||
sprintf(buf + strlen(buf), "MANIFEST: %s,", pSnapFile->pMainfest);
|
sprintf(buf + strlen(buf), "MANIFEST: %s,", pSnapFile->pMainfest);
|
||||||
|
@ -154,6 +155,7 @@ void snapFileDebugInfo(SBackendSnapFile2* pSnapFile) {
|
||||||
qInfo("%s get file list: %s", STREAM_STATE_TRANSFER, buf);
|
qInfo("%s get file list: %s", STREAM_STATE_TRANSFER, buf);
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t snapFileCvtMeta(SBackendSnapFile2* pSnapFile) {
|
int32_t snapFileCvtMeta(SBackendSnapFile2* pSnapFile) {
|
||||||
SBackendFileItem item;
|
SBackendFileItem item;
|
||||||
|
@ -308,6 +310,7 @@ void streamSnapHandleDestroy(SStreamSnapHandle* handle) {
|
||||||
if (handle->pBackendSnapSet) {
|
if (handle->pBackendSnapSet) {
|
||||||
for (int i = 0; i < taosArrayGetSize(handle->pBackendSnapSet); i++) {
|
for (int i = 0; i < taosArrayGetSize(handle->pBackendSnapSet); i++) {
|
||||||
SBackendSnapFile2* pSnapFile = taosArrayGet(handle->pBackendSnapSet, i);
|
SBackendSnapFile2* pSnapFile = taosArrayGet(handle->pBackendSnapSet, i);
|
||||||
|
snapFileDebugInfo(pSnapFile);
|
||||||
snapFileDestroy(pSnapFile);
|
snapFileDestroy(pSnapFile);
|
||||||
}
|
}
|
||||||
taosArrayDestroy(handle->pBackendSnapSet);
|
taosArrayDestroy(handle->pBackendSnapSet);
|
||||||
|
@ -581,25 +584,20 @@ int32_t streamSnapWrite(SStreamSnapWriter* pWriter, uint8_t* pData, uint32_t nDa
|
||||||
}
|
}
|
||||||
int32_t streamSnapWriterClose(SStreamSnapWriter* pWriter, int8_t rollback) {
|
int32_t streamSnapWriterClose(SStreamSnapWriter* pWriter, int8_t rollback) {
|
||||||
SStreamSnapHandle* handle = &pWriter->handle;
|
SStreamSnapHandle* handle = &pWriter->handle;
|
||||||
if (qDebugFlag & DEBUG_DEBUG) {
|
// if (qDebugFlag & DEBUG_DEBUG) {
|
||||||
char* buf = (char*)taosMemoryMalloc(1024);
|
// char* buf = (char*)taosMemoryMalloc(1024);
|
||||||
int n = sprintf(buf, "[");
|
// int n = sprintf(buf, "[");
|
||||||
for (int i = 0; i < taosArrayGetSize(handle->pFileList); i++) {
|
// for (int i = 0; i < taosArrayGetSize(handle->pFileList); i++) {
|
||||||
SBackendFileItem* item = taosArrayGet(handle->pFileList, i);
|
// SBackendFileItem* item = taosArrayGet(handle->pFileList, i);
|
||||||
if (i != taosArrayGetSize(handle->pFileList) - 1) {
|
// if (i != taosArrayGetSize(handle->pFileList) - 1) {
|
||||||
n += sprintf(buf + n, "%s %" PRId64 ",", item->name, item->size);
|
// n += sprintf(buf + n, "%s %" PRId64 ",", item->name, item->size);
|
||||||
} else {
|
// } else {
|
||||||
n += sprintf(buf + n, "%s %" PRId64 "]", item->name, item->size);
|
// n += sprintf(buf + n, "%s %" PRId64 "]", item->name, item->size);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
qDebug("%s snap get file list, %s", STREAM_STATE_TRANSFER, buf);
|
// qDebug("%s snap get file list, %s", STREAM_STATE_TRANSFER, buf);
|
||||||
taosMemoryFree(buf);
|
// taosMemoryFree(buf);
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(handle->pFileList); i++) {
|
|
||||||
SBackendFileItem* item = taosArrayGet(handle->pFileList, i);
|
|
||||||
taosMemoryFree(item->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
streamSnapHandleDestroy(handle);
|
streamSnapHandleDestroy(handle);
|
||||||
taosMemoryFree(pWriter);
|
taosMemoryFree(pWriter);
|
||||||
|
|
Loading…
Reference in New Issue