resolve interface change conflict
This commit is contained in:
parent
8855a6ac6c
commit
c8ed7d1569
|
@ -86,7 +86,7 @@ STsdbMeta *tsdbInitMeta(const char *rootDir, int32_t maxTables) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMeta->map = taosInitHashTable(maxTables * TSDB_META_HASH_FRACTION, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false);
|
pMeta->map = taosHashInit(maxTables * TSDB_META_HASH_FRACTION, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false);
|
||||||
if (pMeta->map == NULL) {
|
if (pMeta->map == NULL) {
|
||||||
free(pMeta->tables);
|
free(pMeta->tables);
|
||||||
free(pMeta);
|
free(pMeta);
|
||||||
|
@ -95,7 +95,7 @@ STsdbMeta *tsdbInitMeta(const char *rootDir, int32_t maxTables) {
|
||||||
|
|
||||||
pMeta->mfh = tsdbInitMetaFile(rootDir, maxTables);
|
pMeta->mfh = tsdbInitMetaFile(rootDir, maxTables);
|
||||||
if (pMeta->mfh == NULL) {
|
if (pMeta->mfh == NULL) {
|
||||||
taosCleanUpHashTable(pMeta->map);
|
taosHashCleanup(pMeta->map);
|
||||||
free(pMeta->tables);
|
free(pMeta->tables);
|
||||||
free(pMeta);
|
free(pMeta);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -260,7 +260,7 @@ static int32_t tsdbCheckTableCfg(STableCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid) {
|
STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid) {
|
||||||
void *ptr = taosHashGet(pMeta->tableMap, (char *)(&uid), sizeof(uid));
|
void *ptr = taosHashGet(pMeta->map, (char *)(&uid), sizeof(uid));
|
||||||
|
|
||||||
if (ptr == NULL) return NULL;
|
if (ptr == NULL) return NULL;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables) {
|
||||||
|
|
||||||
// OPEN MAP
|
// OPEN MAP
|
||||||
mfh->map =
|
mfh->map =
|
||||||
taosInitHashTable(maxTables * TSDB_META_HASH_FRACTION, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false);
|
taosHashInit(maxTables * TSDB_META_HASH_FRACTION, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false);
|
||||||
if (mfh->map == NULL) {
|
if (mfh->map == NULL) {
|
||||||
free(mfh);
|
free(mfh);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -52,13 +52,13 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables) {
|
||||||
if (access(fname, F_OK) < 0) { // file not exists
|
if (access(fname, F_OK) < 0) { // file not exists
|
||||||
mfh->fd = tsdbCreateMetaFile(fname);
|
mfh->fd = tsdbCreateMetaFile(fname);
|
||||||
if (mfh->fd < 0) {
|
if (mfh->fd < 0) {
|
||||||
taosCleanUpHashTable(mfh->map);
|
taosHashCleanup(mfh->map);
|
||||||
free(mfh);
|
free(mfh);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else { // file exists, recover from file
|
} else { // file exists, recover from file
|
||||||
if (tsdbRestoreFromMetaFile(fname, mfh) < 0) {
|
if (tsdbRestoreFromMetaFile(fname, mfh) < 0) {
|
||||||
taosCleanUpHashTable(mfh->map);
|
taosHashCleanup(mfh->map);
|
||||||
free(mfh);
|
free(mfh);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen) {
|
int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen) {
|
||||||
if (taosGetDataFromHashTable(mfh->map, (char *)(&uid), sizeof(uid)) != NULL) {
|
if (taosHashGet(mfh->map, (char *)(&uid), sizeof(uid)) != NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
|
||||||
|
|
||||||
mfh->size += (contLen + sizeof(SRecordInfo));
|
mfh->size += (contLen + sizeof(SRecordInfo));
|
||||||
|
|
||||||
if (taosAddToHashTable(mfh->map, (char *)(&uid), sizeof(uid), (void *)(&info), sizeof(SRecordInfo)) < 0) {
|
if (taosHashPut(mfh->map, (char *)(&uid), sizeof(uid), (void *)(&info), sizeof(SRecordInfo)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,13 +103,13 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
|
int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
|
||||||
char *ptr = taosGetDataFromHashTable(mfh->map, (char *)(&uid), sizeof(uid));
|
char *ptr = taosHashGet(mfh->map, (char *)(&uid), sizeof(uid));
|
||||||
if (ptr == NULL) return -1;
|
if (ptr == NULL) return -1;
|
||||||
|
|
||||||
SRecordInfo info = *(SRecordInfo *)ptr;
|
SRecordInfo info = *(SRecordInfo *)ptr;
|
||||||
|
|
||||||
// Remove record from hash table
|
// Remove record from hash table
|
||||||
taosDeleteFromHashTable(mfh->map, (char *)(&uid), sizeof(uid));
|
taosHashRemove(mfh->map, (char *)(&uid), sizeof(uid));
|
||||||
|
|
||||||
// Remove record from file
|
// Remove record from file
|
||||||
|
|
||||||
|
@ -130,12 +130,12 @@ int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen) {
|
int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen) {
|
||||||
char *ptr = taosGetDataFromHashTable(mfh->map, (char *)(&uid), sizeof(uid));
|
char *ptr = taosHashGet(mfh->map, (char *)(&uid), sizeof(uid));
|
||||||
if (ptr == NULL) return -1;
|
if (ptr == NULL) return -1;
|
||||||
|
|
||||||
SRecordInfo info = *(SRecordInfo *)ptr;
|
SRecordInfo info = *(SRecordInfo *)ptr;
|
||||||
// Update the hash table
|
// Update the hash table
|
||||||
if (taosAddToHashTable(mfh->map, (char *)(&uid), sizeof(uid), (void *)(&info), sizeof(SRecordInfo)) < 0) {
|
if (taosHashPut(mfh->map, (char *)(&uid), sizeof(uid), (void *)(&info), sizeof(SRecordInfo)) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh) {
|
||||||
if (mfh == NULL) return;
|
if (mfh == NULL) return;
|
||||||
close(mfh);
|
close(mfh);
|
||||||
|
|
||||||
taosCleanUpHashTable(mfh->map);
|
taosHashCleanup(mfh->map);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t tsdbGetMetaFileName(char *rootDir, char *fname) {
|
static int32_t tsdbGetMetaFileName(char *rootDir, char *fname) {
|
||||||
|
|
Loading…
Reference in New Issue