TD-34
This commit is contained in:
parent
5808cc499c
commit
c0578258b3
|
@ -72,34 +72,36 @@ TEST(TsdbTest, createRepo) {
|
||||||
tsdbCreateTable(pRepo, &tCfg);
|
tsdbCreateTable(pRepo, &tCfg);
|
||||||
|
|
||||||
// // 3. Loop to write some simple data
|
// // 3. Loop to write some simple data
|
||||||
int nRows = 10;
|
int nRows = 100;
|
||||||
SSubmitMsg *pMsg = (SSubmitMsg *)malloc(sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + tdMaxRowBytesFromSchema(schema) * nRows);
|
int rowsPerSubmit = 10;
|
||||||
|
|
||||||
SSubmitBlk *pBlock = pMsg->blocks;
|
|
||||||
pBlock->tableId = {.uid = 987607499877672L, .tid = 0};
|
|
||||||
pBlock->sversion = 0;
|
|
||||||
pBlock->len = 0;
|
|
||||||
int64_t start_time = 1584081000000;
|
int64_t start_time = 1584081000000;
|
||||||
for (int i = 0; i < nRows; i++) {
|
|
||||||
int64_t ttime = start_time + 1000 * i;
|
|
||||||
SDataRow row = (SDataRow)(pBlock->data + pBlock->len);
|
|
||||||
tdInitDataRow(row, schema);
|
|
||||||
|
|
||||||
for (int j = 0; j < schemaNCols(schema); j++) {
|
SSubmitMsg *pMsg = (SSubmitMsg *)malloc(sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + tdMaxRowBytesFromSchema(schema) * rowsPerSubmit);
|
||||||
if (j == 0) { // Just for timestamp
|
|
||||||
tdAppendColVal(row, (void *)(&ttime), schemaColAt(schema, j));
|
for (int k = 0; k < nRows/rowsPerSubmit; k++) {
|
||||||
} else { // For int
|
SSubmitBlk *pBlock = pMsg->blocks;
|
||||||
int val = 10;
|
pBlock->tableId = {.uid = 987607499877672L, .tid = 0};
|
||||||
tdAppendColVal(row, (void *)(&val), schemaColAt(schema, j));
|
pBlock->sversion = 0;
|
||||||
|
pBlock->len = 0;
|
||||||
|
for (int i = 0; i < rowsPerSubmit; i++) {
|
||||||
|
start_time += 1000;
|
||||||
|
SDataRow row = (SDataRow)(pBlock->data + pBlock->len);
|
||||||
|
tdInitDataRow(row, schema);
|
||||||
|
|
||||||
|
for (int j = 0; j < schemaNCols(schema); j++) {
|
||||||
|
if (j == 0) { // Just for timestamp
|
||||||
|
tdAppendColVal(row, (void *)(&start_time), schemaColAt(schema, j));
|
||||||
|
} else { // For int
|
||||||
|
int val = 10;
|
||||||
|
tdAppendColVal(row, (void *)(&val), schemaColAt(schema, j));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
pBlock->len += dataRowLen(row);
|
||||||
}
|
}
|
||||||
pBlock->len += dataRowLen(row);
|
pMsg->length = pMsg->length + sizeof(SSubmitBlk) + pBlock->len;
|
||||||
|
|
||||||
|
tsdbInsertData(pRepo, pMsg);
|
||||||
}
|
}
|
||||||
pMsg->length = pMsg->length + sizeof(SSubmitBlk) + pBlock->len;
|
|
||||||
|
|
||||||
tsdbInsertData(pRepo, pMsg);
|
|
||||||
|
|
||||||
tsdbTriggerCommit(pRepo);
|
tsdbTriggerCommit(pRepo);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue