commit
e161803ea6
|
@ -106,9 +106,28 @@ typedef void *SDataRow;
|
||||||
SDataRow tdNewDataRowFromSchema(STSchema *pSchema);
|
SDataRow tdNewDataRowFromSchema(STSchema *pSchema);
|
||||||
void tdFreeDataRow(SDataRow row);
|
void tdFreeDataRow(SDataRow row);
|
||||||
void tdInitDataRow(SDataRow row, STSchema *pSchema);
|
void tdInitDataRow(SDataRow row, STSchema *pSchema);
|
||||||
int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_t offset);
|
|
||||||
SDataRow tdDataRowDup(SDataRow row);
|
SDataRow tdDataRowDup(SDataRow row);
|
||||||
|
|
||||||
|
static FORCE_INLINE int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_t offset) {
|
||||||
|
ASSERT(value != NULL);
|
||||||
|
int32_t toffset = offset + TD_DATA_ROW_HEAD_SIZE;
|
||||||
|
char * ptr = (char *)POINTER_SHIFT(row, dataRowLen(row));
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
|
case TSDB_DATA_TYPE_NCHAR:
|
||||||
|
*(VarDataOffsetT *)POINTER_SHIFT(row, toffset) = dataRowLen(row);
|
||||||
|
memcpy(ptr, value, varDataTLen(value));
|
||||||
|
dataRowLen(row) += varDataTLen(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
memcpy(POINTER_SHIFT(row, toffset), value, TYPE_BYTES[type]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: offset here including the header size
|
// NOTE: offset here including the header size
|
||||||
static FORCE_INLINE void *tdGetRowDataOfCol(SDataRow row, int8_t type, int32_t offset) {
|
static FORCE_INLINE void *tdGetRowDataOfCol(SDataRow row, int8_t type, int32_t offset) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -158,32 +158,6 @@ void tdFreeDataRow(SDataRow row) {
|
||||||
if (row) free(row);
|
if (row) free(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Append a column value to the data row
|
|
||||||
* @param type: column type
|
|
||||||
* @param bytes: column bytes
|
|
||||||
* @param offset: offset in the data row tuple, not including the data row header
|
|
||||||
*/
|
|
||||||
int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_t offset) {
|
|
||||||
ASSERT(value != NULL);
|
|
||||||
int32_t toffset = offset + TD_DATA_ROW_HEAD_SIZE;
|
|
||||||
char * ptr = POINTER_SHIFT(row, dataRowLen(row));
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
|
||||||
case TSDB_DATA_TYPE_NCHAR:
|
|
||||||
*(VarDataOffsetT *)POINTER_SHIFT(row, toffset) = dataRowLen(row);
|
|
||||||
memcpy(ptr, value, varDataTLen(value));
|
|
||||||
dataRowLen(row) += varDataTLen(value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
memcpy(POINTER_SHIFT(row, toffset), value, TYPE_BYTES[type]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDataRow tdDataRowDup(SDataRow row) {
|
SDataRow tdDataRowDup(SDataRow row) {
|
||||||
SDataRow trow = malloc(dataRowLen(row));
|
SDataRow trow = malloc(dataRowLen(row));
|
||||||
if (trow == NULL) return NULL;
|
if (trow == NULL) return NULL;
|
||||||
|
|
|
@ -141,7 +141,7 @@ int32_t rpcDebugFlag = 135;
|
||||||
int32_t uDebugFlag = 131;
|
int32_t uDebugFlag = 131;
|
||||||
int32_t debugFlag = 131;
|
int32_t debugFlag = 131;
|
||||||
int32_t sDebugFlag = 135;
|
int32_t sDebugFlag = 135;
|
||||||
int32_t tsdbDebugFlag = 135;
|
int32_t tsdbDebugFlag = 131;
|
||||||
|
|
||||||
// the maximum number of results for projection query on super table that are returned from
|
// the maximum number of results for projection query on super table that are returned from
|
||||||
// one virtual node, to order according to timestamp
|
// one virtual node, to order according to timestamp
|
||||||
|
|
|
@ -16,7 +16,7 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx)
|
||||||
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
|
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
|
||||||
static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable);
|
static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable);
|
||||||
static int tsdbEstimateTableEncodeSize(STable *pTable);
|
static int tsdbEstimateTableEncodeSize(STable *pTable);
|
||||||
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable);
|
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFromIdx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a TSDB table object as a binary content
|
* Encode a TSDB table object as a binary content
|
||||||
|
@ -411,7 +411,7 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
|
||||||
|
|
||||||
tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name),
|
tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name),
|
||||||
tableId.tid, tableId.uid);
|
tableId.tid, tableId.uid);
|
||||||
if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1;
|
if (tsdbRemoveTableFromMeta(pMeta, pTable, true) < 0) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
|
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFromIdx) {
|
||||||
if (pTable->type == TSDB_SUPER_TABLE) {
|
if (pTable->type == TSDB_SUPER_TABLE) {
|
||||||
SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex);
|
SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex);
|
||||||
while (tSkipListIterNext(pIter)) {
|
while (tSkipListIterNext(pIter)) {
|
||||||
|
@ -509,7 +509,7 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
|
||||||
|
|
||||||
ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE);
|
ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE);
|
||||||
|
|
||||||
tsdbRemoveTableFromMeta(pMeta, tTable);
|
tsdbRemoveTableFromMeta(pMeta, tTable, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
tSkipListDestroyIter(pIter);
|
tSkipListDestroyIter(pIter);
|
||||||
|
@ -525,7 +525,7 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pMeta->tables[pTable->tableId.tid] = NULL;
|
pMeta->tables[pTable->tableId.tid] = NULL;
|
||||||
if (pTable->type == TSDB_CHILD_TABLE) {
|
if (pTable->type == TSDB_CHILD_TABLE && rmFromIdx) {
|
||||||
tsdbRemoveTableFromIndex(pMeta, pTable);
|
tsdbRemoveTableFromIndex(pMeta, pTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue