change uid from int64_t to uint64_t in tsdb
This commit is contained in:
parent
4ff1ca4b78
commit
1c0cb588ca
|
@ -77,8 +77,8 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg);
|
||||||
|
|
||||||
// --------- TSDB TABLE DEFINITION
|
// --------- TSDB TABLE DEFINITION
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t uid; // the unique table ID
|
uint64_t uid; // the unique table ID
|
||||||
int32_t tid; // the table ID in the repository.
|
int32_t tid; // the table ID in the repository.
|
||||||
} STableId;
|
} STableId;
|
||||||
|
|
||||||
// --------- TSDB TABLE configuration
|
// --------- TSDB TABLE configuration
|
||||||
|
@ -88,14 +88,14 @@ typedef struct {
|
||||||
STableId tableId;
|
STableId tableId;
|
||||||
int32_t sversion;
|
int32_t sversion;
|
||||||
char * sname; // super table name
|
char * sname; // super table name
|
||||||
int64_t superUid;
|
uint64_t superUid;
|
||||||
STSchema * schema;
|
STSchema * schema;
|
||||||
STSchema * tagSchema;
|
STSchema * tagSchema;
|
||||||
SDataRow tagValues;
|
SDataRow tagValues;
|
||||||
} STableCfg;
|
} STableCfg;
|
||||||
|
|
||||||
int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t tid);
|
int tsdbInitTableCfg(STableCfg *config, ETableType type, uint64_t uid, int32_t tid);
|
||||||
int tsdbTableSetSuperUid(STableCfg *config, int64_t uid);
|
int tsdbTableSetSuperUid(STableCfg *config, uint64_t uid);
|
||||||
int tsdbTableSetSchema(STableCfg *config, STSchema *pSchema, bool dup);
|
int tsdbTableSetSchema(STableCfg *config, STSchema *pSchema, bool dup);
|
||||||
int tsdbTableSetTagSchema(STableCfg *config, STSchema *pSchema, bool dup);
|
int tsdbTableSetTagSchema(STableCfg *config, STSchema *pSchema, bool dup);
|
||||||
int tsdbTableSetTagValue(STableCfg *config, SDataRow row, bool dup);
|
int tsdbTableSetTagValue(STableCfg *config, SDataRow row, bool dup);
|
||||||
|
@ -109,7 +109,7 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes);
|
||||||
int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg);
|
int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg);
|
||||||
int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);
|
int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);
|
||||||
int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg);
|
int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg);
|
||||||
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid);
|
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, uint64_t uid);
|
||||||
|
|
||||||
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size);
|
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size);
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,9 @@ typedef struct {
|
||||||
} SMetaFile;
|
} SMetaFile;
|
||||||
|
|
||||||
SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables, iterFunc iFunc, afterFunc aFunc, void *appH);
|
SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables, iterFunc iFunc, afterFunc aFunc, void *appH);
|
||||||
int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen);
|
int32_t tsdbInsertMetaRecord(SMetaFile *mfh, uint64_t uid, void *cont, int32_t contLen);
|
||||||
int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid);
|
int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, uint64_t uid);
|
||||||
int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen);
|
int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, uint64_t uid, void *cont, int32_t contLen);
|
||||||
void tsdbCloseMetaFile(SMetaFile *mfh);
|
void tsdbCloseMetaFile(SMetaFile *mfh);
|
||||||
|
|
||||||
// ------------------------------ TSDB META INTERFACES ------------------------------
|
// ------------------------------ TSDB META INTERFACES ------------------------------
|
||||||
|
@ -82,7 +82,7 @@ typedef struct {
|
||||||
typedef struct STable {
|
typedef struct STable {
|
||||||
int8_t type;
|
int8_t type;
|
||||||
STableId tableId;
|
STableId tableId;
|
||||||
int64_t superUid; // Super table UID
|
uint64_t superUid; // Super table UID
|
||||||
int32_t sversion;
|
int32_t sversion;
|
||||||
STSchema * schema;
|
STSchema * schema;
|
||||||
STSchema * tagSchema;
|
STSchema * tagSchema;
|
||||||
|
@ -153,7 +153,7 @@ STsdbMeta *tsdbGetMeta(TsdbRepoT *pRepo);
|
||||||
|
|
||||||
STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId);
|
STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId);
|
||||||
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
|
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
|
||||||
STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid);
|
STable *tsdbGetTableByUid(STsdbMeta *pMeta, uint64_t uid);
|
||||||
char *getTSTupleKey(const void * data);
|
char *getTSTupleKey(const void * data);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -275,8 +275,8 @@ typedef struct {
|
||||||
uint32_t padding; // For padding purpose
|
uint32_t padding; // For padding purpose
|
||||||
uint32_t hasLast : 2;
|
uint32_t hasLast : 2;
|
||||||
uint32_t numOfBlocks : 30;
|
uint32_t numOfBlocks : 30;
|
||||||
int64_t uid;
|
uint64_t uid;
|
||||||
TSKEY maxKey;
|
TSKEY maxKey;
|
||||||
} SCompIdx; /* sizeof(SCompIdx) = 28 */
|
} SCompIdx; /* sizeof(SCompIdx) = 28 */
|
||||||
|
|
||||||
void *tsdbEncodeSCompIdx(void *buf, SCompIdx *pIdx);
|
void *tsdbEncodeSCompIdx(void *buf, SCompIdx *pIdx);
|
||||||
|
@ -311,7 +311,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t delimiter; // For recovery usage
|
int32_t delimiter; // For recovery usage
|
||||||
int32_t checksum; // TODO: decide if checksum logic in this file or make it one API
|
int32_t checksum; // TODO: decide if checksum logic in this file or make it one API
|
||||||
int64_t uid;
|
uint64_t uid;
|
||||||
SCompBlock blocks[];
|
SCompBlock blocks[];
|
||||||
} SCompInfo;
|
} SCompInfo;
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t delimiter; // For recovery usage
|
int32_t delimiter; // For recovery usage
|
||||||
int32_t numOfCols; // For recovery usage
|
int32_t numOfCols; // For recovery usage
|
||||||
int64_t uid; // For recovery usage
|
uint64_t uid; // For recovery usage
|
||||||
SCompCol cols[];
|
SCompCol cols[];
|
||||||
} SCompData;
|
} SCompData;
|
||||||
|
|
||||||
|
@ -441,9 +441,9 @@ typedef struct {
|
||||||
} SHelperFile;
|
} SHelperFile;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t uid;
|
uint64_t uid;
|
||||||
int32_t tid;
|
int32_t tid;
|
||||||
int32_t sversion;
|
int32_t sversion;
|
||||||
} SHelperTable;
|
} SHelperTable;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -392,7 +392,7 @@ int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid) {
|
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, uint64_t uid) {
|
||||||
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
STsdbRepo *pRepo = (STsdbRepo *)repo;
|
||||||
|
|
||||||
STable *pTable = tsdbGetTableByUid(pRepo->tsdbMeta, uid);
|
STable *pTable = tsdbGetTableByUid(pRepo->tsdbMeta, uid);
|
||||||
|
@ -430,7 +430,7 @@ int32_t tsdbInsertData(TsdbRepoT *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg * p
|
||||||
/**
|
/**
|
||||||
* Initialize a table configuration
|
* Initialize a table configuration
|
||||||
*/
|
*/
|
||||||
int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t tid) {
|
int tsdbInitTableCfg(STableCfg *config, ETableType type, uint64_t uid, int32_t tid) {
|
||||||
if (config == NULL) return -1;
|
if (config == NULL) return -1;
|
||||||
if (type != TSDB_NORMAL_TABLE && type != TSDB_CHILD_TABLE) return -1;
|
if (type != TSDB_NORMAL_TABLE && type != TSDB_CHILD_TABLE) return -1;
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t ti
|
||||||
/**
|
/**
|
||||||
* Set the super table UID of the created table
|
* Set the super table UID of the created table
|
||||||
*/
|
*/
|
||||||
int tsdbTableSetSuperUid(STableCfg *config, int64_t uid) {
|
int tsdbTableSetSuperUid(STableCfg *config, uint64_t uid) {
|
||||||
if (config->type != TSDB_CHILD_TABLE) return -1;
|
if (config->type != TSDB_CHILD_TABLE) return -1;
|
||||||
if (uid == TSDB_INVALID_SUPER_TABLE_ID) return -1;
|
if (uid == TSDB_INVALID_SUPER_TABLE_ID) return -1;
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,9 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
|
||||||
memcpy(pTable->name->data, ptr, len);
|
memcpy(pTable->name->data, ptr, len);
|
||||||
|
|
||||||
ptr = (char *)ptr + len;
|
ptr = (char *)ptr + len;
|
||||||
T_READ_MEMBER(ptr, int64_t, pTable->tableId.uid);
|
T_READ_MEMBER(ptr, uint64_t, pTable->tableId.uid);
|
||||||
T_READ_MEMBER(ptr, int32_t, pTable->tableId.tid);
|
T_READ_MEMBER(ptr, int32_t, pTable->tableId.tid);
|
||||||
T_READ_MEMBER(ptr, int64_t, pTable->superUid);
|
T_READ_MEMBER(ptr, uint64_t, pTable->superUid);
|
||||||
T_READ_MEMBER(ptr, int32_t, pTable->sversion);
|
T_READ_MEMBER(ptr, int32_t, pTable->sversion);
|
||||||
|
|
||||||
if (pTable->type == TSDB_SUPER_TABLE) {
|
if (pTable->type == TSDB_SUPER_TABLE) {
|
||||||
|
@ -455,7 +455,7 @@ static int32_t tsdbCheckTableCfg(STableCfg *pCfg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid) {
|
STable *tsdbGetTableByUid(STsdbMeta *pMeta, uint64_t uid) {
|
||||||
void *ptr = taosHashGet(pMeta->map, (char *)(&uid), sizeof(uid));
|
void *ptr = taosHashGet(pMeta->map, (char *)(&uid), sizeof(uid));
|
||||||
|
|
||||||
if (ptr == NULL) return NULL;
|
if (ptr == NULL) return NULL;
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
#define TSDB_META_FILE_HEADER_SIZE 512
|
#define TSDB_META_FILE_HEADER_SIZE 512
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t offset;
|
int32_t offset;
|
||||||
int32_t size;
|
int32_t size;
|
||||||
int64_t uid;
|
uint64_t uid;
|
||||||
} SRecordInfo;
|
} SRecordInfo;
|
||||||
|
|
||||||
// static int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
|
// static int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
|
||||||
|
@ -76,7 +76,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables, iterFunc iFunc, af
|
||||||
return mfh;
|
return mfh;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen) {
|
int32_t tsdbInsertMetaRecord(SMetaFile *mfh, uint64_t uid, void *cont, int32_t contLen) {
|
||||||
if (taosHashGet(mfh->map, (char *)(&uid), sizeof(uid)) != NULL) {
|
if (taosHashGet(mfh->map, (char *)(&uid), sizeof(uid)) != NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
|
int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, uint64_t uid) {
|
||||||
char *ptr = taosHashGet(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;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t contLen) {
|
int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, uint64_t uid, void *cont, int32_t contLen) {
|
||||||
char *ptr = taosHashGet(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;
|
||||||
|
|
||||||
|
|
|
@ -1516,8 +1516,9 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbQuerySTableByTagCond(TsdbRepoT *tsdb, int64_t uid, const char *pTagCond, size_t len, int16_t tagNameRelType,
|
int32_t tsdbQuerySTableByTagCond(TsdbRepoT* tsdb, uint64_t uid, const char* pTagCond, size_t len,
|
||||||
const char* tbnameCond, STableGroupInfo *pGroupInfo, SColIndex *pColIndex, int32_t numOfCols) {
|
int16_t tagNameRelType, const char* tbnameCond, STableGroupInfo* pGroupInfo,
|
||||||
|
SColIndex* pColIndex, int32_t numOfCols) {
|
||||||
STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), uid);
|
STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), uid);
|
||||||
if (pTable == NULL) {
|
if (pTable == NULL) {
|
||||||
uError("%p failed to get stable, uid:%" PRIu64, tsdb, uid);
|
uError("%p failed to get stable, uid:%" PRIu64, tsdb, uid);
|
||||||
|
@ -1589,7 +1590,7 @@ int32_t tsdbQuerySTableByTagCond(TsdbRepoT *tsdb, int64_t uid, const char *pTagC
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbGetOneTableGroup(TsdbRepoT* tsdb, int64_t uid, STableGroupInfo* pGroupInfo) {
|
int32_t tsdbGetOneTableGroup(TsdbRepoT* tsdb, uint64_t uid, STableGroupInfo* pGroupInfo) {
|
||||||
STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), uid);
|
STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), uid);
|
||||||
if (pTable == NULL) {
|
if (pTable == NULL) {
|
||||||
return TSDB_CODE_INVALID_TABLE_ID;
|
return TSDB_CODE_INVALID_TABLE_ID;
|
||||||
|
|
|
@ -16,7 +16,7 @@ typedef struct {
|
||||||
TsdbRepoT *pRepo;
|
TsdbRepoT *pRepo;
|
||||||
bool isAscend;
|
bool isAscend;
|
||||||
int tid;
|
int tid;
|
||||||
int64_t uid;
|
uint64_t uid;
|
||||||
int sversion;
|
int sversion;
|
||||||
TSKEY startTime;
|
TSKEY startTime;
|
||||||
TSKEY interval;
|
TSKEY interval;
|
||||||
|
|
Loading…
Reference in New Issue