未验证 提交 793502c6 编写于 作者: S slguan 提交者: GitHub

Merge pull request #1676 from taosdata/feature/2.0tsdb

Feature/2.0tsdb
......@@ -282,6 +282,8 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg) {
int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
STsdbRepo *pRepo = (STsdbRepo *)repo;
if (pRepo->appH.walCallBack) pRepo->appH.walCallBack(pRepo->appH.appH);
tsdbLockRepo(repo);
if (pRepo->commit) {
......@@ -387,7 +389,7 @@ int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t ti
config->superUid = TSDB_INVALID_SUPER_TABLE_ID;
config->tableId.uid = uid;
config->tableId.tid = tid;
config->name = strdup("test1");
config->name = NULL;
return 0;
}
......@@ -854,8 +856,6 @@ static void *tsdbCommitData(void *arg) {
SRWHelper whelper = {0};
if (pCache->imem == NULL) return NULL;
if (pRepo->appH.walCallBack) pRepo->appH.walCallBack(pRepo->appH.appH);
// Create the iterator to read from cache
SSkipListIterator **iters = tsdbCreateTableIters(pMeta, pCfg->maxTables);
if (iters == NULL) {
......@@ -880,6 +880,7 @@ static void *tsdbCommitData(void *arg) {
_exit:
tdFreeDataCols(pDataCols);
tsdbDestroyTableIters(iters, pCfg->maxTables);
tsdbDestroyHelper(&whelper);
tsdbLockRepo(arg);
tdListMove(pCache->imem->list, pCache->pool.memPool);
......
......@@ -403,6 +403,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
} else {
pHelper->pCompInfo->delimiter = TSDB_FILE_DELIMITER;
pHelper->pCompInfo->uid = pHelper->tableInfo.uid;
pHelper->pCompInfo->checksum = 0;
ASSERT((pIdx->len - sizeof(SCompInfo) - sizeof(TSCKSUM)) % sizeof(SCompBlock) == 0);
taosCalcChecksumAppend(0, (uint8_t *)pHelper->pCompInfo, pIdx->len);
pIdx->offset = lseek(pHelper->files.nHeadF.fd, 0, SEEK_END);
......
......@@ -4,6 +4,7 @@
#include "tdataformat.h"
#include "tsdbMain.h"
#include "tskiplist.h"
static double getCurTime() {
struct timeval tv;
......@@ -141,6 +142,7 @@ TEST(TsdbTest, createRepo) {
STableCfg tCfg;
ASSERT_EQ(tsdbInitTableCfg(&tCfg, TSDB_SUPER_TABLE, 987607499877672L, 0), -1);
ASSERT_EQ(tsdbInitTableCfg(&tCfg, TSDB_NORMAL_TABLE, 987607499877672L, 0), 0);
tsdbTableSetName(&tCfg, "test", false);
int nCols = 5;
STSchema *schema = tdNewSchema(nCols);
......@@ -167,7 +169,7 @@ TEST(TsdbTest, createRepo) {
.sversion = tCfg.sversion,
.startTime = 1584081000000,
.interval = 1000,
.totalRows = 5000000,
.totalRows = 10000000,
.rowsPerSubmit = 1,
.pSchema = schema
};
......@@ -262,4 +264,47 @@ TEST(TsdbTest, DISABLED_createFileGroup) {
// ASSERT_EQ(tsdbCreateFileGroup("/home/ubuntu/work/ttest/vnode0/data", 1820, &fGroup, 1000), 0);
int k = 0;
}
static char *getTKey(const void *data) {
return (char *)data;
}
static void insertSkipList(bool isAscend) {
TSKEY start_time = 1587393453000;
TSKEY interval = 1000;
SSkipList *pList = tSkipListCreate(5, TSDB_DATA_TYPE_TIMESTAMP, sizeof(TSKEY), 0, 0, 1, getTKey);
ASSERT_NE(pList, nullptr);
for (size_t i = 0; i < 20000000; i++)
{
TSKEY time = isAscend ? (start_time + i * interval) : (start_time - i * interval);
int32_t level = 0;
int32_t headSize = 0;
tSkipListNewNodeInfo(pList, &level, &headSize);
SSkipListNode *pNode = (SSkipListNode *)malloc(headSize + sizeof(TSKEY));
ASSERT_NE(pNode, nullptr);
pNode->level = level;
*(TSKEY *)((char *)pNode + headSize) = time;
tSkipListPut(pList, pNode);
}
tSkipListDestroy(pList);
}
TEST(TsdbTest, DISABLED_testSkipList) {
// TEST(TsdbTest, testSkipList) {
double stime = getCurTime();
insertSkipList(true);
double etime = getCurTime();
printf("Time used to insert 100000000 records takes %f seconds\n", etime-stime);
stime = getCurTime();
insertSkipList(false);
etime = getCurTime();
printf("Time used to insert 100000000 records takes %f seconds\n", etime-stime);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册