fix(cos/multi-writing): use lasted version of data
This commit is contained in:
parent
3986f392b5
commit
a9094d7602
|
@ -14,8 +14,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cos.h"
|
#include "cos.h"
|
||||||
#include "tsdb.h"
|
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
|
#include "tsdb.h"
|
||||||
#include "vnd.h"
|
#include "vnd.h"
|
||||||
|
|
||||||
static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
||||||
|
@ -61,6 +61,7 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
||||||
// taosMemoryFree(pFD);
|
// taosMemoryFree(pFD);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
pFD->s3File = 1;
|
||||||
/*
|
/*
|
||||||
const char *object_name = taosDirEntryBaseName((char *)path);
|
const char *object_name = taosDirEntryBaseName((char *)path);
|
||||||
long s3_size = 0;
|
long s3_size = 0;
|
||||||
|
@ -86,7 +87,6 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pFD->s3File = 1;
|
|
||||||
pFD->pFD = (TdFilePtr)&pFD->s3File;
|
pFD->pFD = (TdFilePtr)&pFD->s3File;
|
||||||
int32_t vid = 0;
|
int32_t vid = 0;
|
||||||
sscanf(object_name, "v%df%dver%" PRId64 ".data", &vid, &pFD->fid, &pFD->cid);
|
sscanf(object_name, "v%df%dver%" PRId64 ".data", &vid, &pFD->fid, &pFD->cid);
|
||||||
|
@ -303,8 +303,7 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno, int32_t encryptAlgor
|
||||||
int NewLen;
|
int NewLen;
|
||||||
|
|
||||||
int32_t count = 0;
|
int32_t count = 0;
|
||||||
while(count < pFD->szPage)
|
while (count < pFD->szPage) {
|
||||||
{
|
|
||||||
SCryptOpts opts = {0};
|
SCryptOpts opts = {0};
|
||||||
opts.len = 128;
|
opts.len = 128;
|
||||||
opts.source = pFD->pBuf + count;
|
opts.source = pFD->pBuf + count;
|
||||||
|
@ -582,7 +581,7 @@ int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFD->lcn > 1 /*pFD->s3File && tsS3BlockSize < 0*/) {
|
if (pFD->s3File && pFD->lcn > 1 /* && tsS3BlockSize < 0*/) {
|
||||||
return tsdbReadFileS3(pFD, offset, pBuf, size, szHint);
|
return tsdbReadFileS3(pFD, offset, pBuf, size, szHint);
|
||||||
} else {
|
} else {
|
||||||
return tsdbReadFileImp(pFD, offset, pBuf, size, encryptAlgorithm, encryptKey);
|
return tsdbReadFileImp(pFD, offset, pBuf, size, encryptAlgorithm, encryptKey);
|
||||||
|
@ -598,8 +597,7 @@ int32_t tsdbReadFileToBuffer(STsdbFD *pFD, int64_t offset, int64_t size, SBuffer
|
||||||
|
|
||||||
code = tBufferEnsureCapacity(buffer, buffer->size + size);
|
code = tBufferEnsureCapacity(buffer, buffer->size + size);
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
code = tsdbReadFile(pFD, offset, (uint8_t *)tBufferGetDataEnd(buffer), size, szHint,
|
code = tsdbReadFile(pFD, offset, (uint8_t *)tBufferGetDataEnd(buffer), size, szHint, encryptAlgorithm, encryptKey);
|
||||||
encryptAlgorithm, encryptKey);
|
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
buffer->size += size;
|
buffer->size += size;
|
||||||
|
|
||||||
|
|
|
@ -671,7 +671,7 @@ static int32_t tsdbDoS3MigrateOnFileSet(SRTNer *rtner, STFileSet *fset) {
|
||||||
int64_t chunksize = (int64_t)pCfg->tsdbPageSize * pCfg->s3ChunkSize;
|
int64_t chunksize = (int64_t)pCfg->tsdbPageSize * pCfg->s3ChunkSize;
|
||||||
int32_t lcn = fobj->f->lcn;
|
int32_t lcn = fobj->f->lcn;
|
||||||
|
|
||||||
if (lcn < 1 && taosCheckExistFile(fobj->fname)) {
|
if (/*lcn < 1 && */ taosCheckExistFile(fobj->fname)) {
|
||||||
int32_t mtime = 0;
|
int32_t mtime = 0;
|
||||||
int64_t size = 0;
|
int64_t size = 0;
|
||||||
taosStatFile(fobj->fname, &size, &mtime, NULL);
|
taosStatFile(fobj->fname, &size, &mtime, NULL);
|
||||||
|
|
Loading…
Reference in New Issue