Merge pull request #25391 from taosdata/enh/TD-28945-pk

cos/multi-writing: init fid & cid for s3 page cache
This commit is contained in:
Hongze Cheng 2024-04-18 14:05:28 +08:00 committed by GitHub
commit a4edab720c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 19 deletions

View File

@ -417,7 +417,7 @@ typedef enum ELogicConditionType {
#define TSDB_MAX_HASH_SUFFIX (TSDB_TABLE_NAME_LEN - 2) #define TSDB_MAX_HASH_SUFFIX (TSDB_TABLE_NAME_LEN - 2)
#define TSDB_DEFAULT_HASH_SUFFIX 0 #define TSDB_DEFAULT_HASH_SUFFIX 0
#define TSDB_MIN_S3_CHUNK_SIZE (32 * 1024) #define TSDB_MIN_S3_CHUNK_SIZE (128 * 1024)
#define TSDB_MAX_S3_CHUNK_SIZE (1024 * 1024) #define TSDB_MAX_S3_CHUNK_SIZE (1024 * 1024)
#define TSDB_DEFAULT_S3_CHUNK_SIZE (256 * 1024) #define TSDB_DEFAULT_S3_CHUNK_SIZE (256 * 1024)
#define TSDB_MIN_S3_KEEP_LOCAL (1 * 1440) // unit minute #define TSDB_MIN_S3_KEEP_LOCAL (1 * 1440) // unit minute

View File

@ -267,16 +267,12 @@ int32_t tsdbTFileObjUnref(STFileObj *fobj) {
} }
static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) { static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
if (fobj->f->type != TSDB_FTYPE_DATA) { if (fobj->f->type != TSDB_FTYPE_DATA || fobj->f->lcn < 1) {
remove_file(fobj->fname); remove_file(fobj->fname);
return; return;
} }
if (!remove_all) { if (!remove_all) {
if (fobj->f->lcn < 1) {
remove_file(fobj->fname);
return;
} else {
// remove local last chunk file // remove local last chunk file
char lc_path[TSDB_FILENAME_LEN]; char lc_path[TSDB_FILENAME_LEN];
tstrncpy(lc_path, fobj->fname, TSDB_FQDN_LEN); tstrncpy(lc_path, fobj->fname, TSDB_FQDN_LEN);
@ -289,7 +285,7 @@ static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
snprintf(dot + 1, TSDB_FQDN_LEN - (dot + 1 - lc_path), "%d.data", fobj->f->lcn); snprintf(dot + 1, TSDB_FQDN_LEN - (dot + 1 - lc_path), "%d.data", fobj->f->lcn);
remove_file(lc_path); remove_file(lc_path);
}
} else { } else {
// delete by data file prefix // delete by data file prefix
char lc_path[TSDB_FILENAME_LEN]; char lc_path[TSDB_FILENAME_LEN];

View File

@ -30,6 +30,10 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
char lc_path[TSDB_FILENAME_LEN]; char lc_path[TSDB_FILENAME_LEN];
tstrncpy(lc_path, path, TSDB_FQDN_LEN); tstrncpy(lc_path, path, TSDB_FQDN_LEN);
int32_t vid = 0;
const char *object_name = taosDirEntryBaseName((char *)path);
sscanf(object_name, "v%df%dver%" PRId64 ".data", &vid, &pFD->fid, &pFD->cid);
char *dot = strrchr(lc_path, '.'); char *dot = strrchr(lc_path, '.');
if (!dot) { if (!dot) {
tsdbError("unexpected path: %s", lc_path); tsdbError("unexpected path: %s", lc_path);