more code
This commit is contained in:
		
							parent
							
								
									8f84e88616
								
							
						
					
					
						commit
						23e78dd908
					
				| 
						 | 
				
			
			@ -40,9 +40,20 @@ static int32_t tsdbCommitOpenWriter(SCommitter *pCommitter) {
 | 
			
		|||
  int32_t code;
 | 
			
		||||
  int32_t lino;
 | 
			
		||||
 | 
			
		||||
  SSttFile sttFile = {0};  // TODO
 | 
			
		||||
  struct SSttFWriterConf conf = {
 | 
			
		||||
      .pTsdb = pCommitter->pTsdb,
 | 
			
		||||
      .file = {0},
 | 
			
		||||
      .pSkmTb = NULL,
 | 
			
		||||
      .pSkmRow = NULL,
 | 
			
		||||
      .maxRow = pCommitter->maxRow,
 | 
			
		||||
      .szPage = pCommitter->pTsdb->pVnode->config.tsdbPageSize,
 | 
			
		||||
      .cmprAlg = pCommitter->cmprAlg,
 | 
			
		||||
      .aBuf = NULL,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  code = tsdbSttFWriterOpen(NULL /*TODO*/, &pCommitter->pWriter);
 | 
			
		||||
  // taosArraySearch(pCommitter->pTsdb);
 | 
			
		||||
 | 
			
		||||
  code = tsdbSttFWriterOpen(&conf, &pCommitter->pWriter);
 | 
			
		||||
  TSDB_CHECK_CODE(code, lino, _exit);
 | 
			
		||||
 | 
			
		||||
_exit:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ static int32_t destroy_file_system(struct STFileSystem **ppFS) {
 | 
			
		|||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t open_file_system(struct STFileSystem *pFS) {
 | 
			
		||||
static int32_t open_file_system(struct STFileSystem *pFS, int8_t rollback) {
 | 
			
		||||
  // TODO
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -47,14 +47,14 @@ static int32_t close_file_system(struct STFileSystem *pFS) {
 | 
			
		|||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS) {
 | 
			
		||||
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS, int8_t rollback) {
 | 
			
		||||
  int32_t code;
 | 
			
		||||
  int32_t lino;
 | 
			
		||||
 | 
			
		||||
  code = create_file_system(pTsdb, ppFS);
 | 
			
		||||
  TSDB_CHECK_CODE(code, lino, _exit);
 | 
			
		||||
 | 
			
		||||
  code = open_file_system(ppFS[0]);
 | 
			
		||||
  code = open_file_system(ppFS[0], rollback);
 | 
			
		||||
  TSDB_CHECK_CODE(code, lino, _exit);
 | 
			
		||||
 | 
			
		||||
_exit:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,7 @@ extern "C" {
 | 
			
		|||
struct STFileSystem;
 | 
			
		||||
 | 
			
		||||
/* Exposed APIs */
 | 
			
		||||
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS);
 | 
			
		||||
int32_t tsdbOpenFileSystem(STsdb *pTsdb, struct STFileSystem **ppFS, int8_t rollback);
 | 
			
		||||
int32_t tsdbCloseFileSystem(struct STFileSystem **ppFS);
 | 
			
		||||
 | 
			
		||||
/* Exposed Structs */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can use, redistribute, and/or modify
 | 
			
		||||
 * it under the terms of the GNU Affero General Public License, version 3
 | 
			
		||||
 * or later ("AGPL"), as published by the Free Software Foundation.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful, but WITHOUT
 | 
			
		||||
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Affero General Public License
 | 
			
		||||
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can use, redistribute, and/or modify
 | 
			
		||||
 * it under the terms of the GNU Affero General Public License, version 3
 | 
			
		||||
 * or later ("AGPL"), as published by the Free Software Foundation.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful, but WITHOUT
 | 
			
		||||
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Affero General Public License
 | 
			
		||||
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _TD_TSDB_STT_FILE_READER_H
 | 
			
		||||
#define _TD_TSDB_STT_FILE_READER_H
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Exposed Handle */
 | 
			
		||||
 | 
			
		||||
/* Exposed APIs */
 | 
			
		||||
 | 
			
		||||
/* Exposed Structs */
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /*_TD_TSDB_STT_FILE_READER_H*/
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +14,9 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
#include "tsdb.h"
 | 
			
		||||
#ifdef USE_DEV_CODE
 | 
			
		||||
#include "dev/dev.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int32_t tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) {
 | 
			
		||||
  STsdbKeepCfg *pKeepCfg = &pTsdb->keepCfg;
 | 
			
		||||
| 
						 | 
				
			
			@ -66,9 +69,15 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
// open tsdb
 | 
			
		||||
#ifdef USE_DEV_CODE
 | 
			
		||||
  if (tsdbOpenFileSystem(pTsdb, &pTsdb->pFS, rollback) < 0) {
 | 
			
		||||
    goto _err;
 | 
			
		||||
  }
 | 
			
		||||
#else
 | 
			
		||||
  if (tsdbFSOpen(pTsdb, rollback) < 0) {
 | 
			
		||||
    goto _err;
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  if (tsdbOpenCache(pTsdb) < 0) {
 | 
			
		||||
    goto _err;
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +103,11 @@ int tsdbClose(STsdb **pTsdb) {
 | 
			
		|||
 | 
			
		||||
    taosThreadRwlockDestroy(&(*pTsdb)->rwLock);
 | 
			
		||||
 | 
			
		||||
#ifndef USE_DEV_CODE
 | 
			
		||||
    tsdbFSClose(*pTsdb);
 | 
			
		||||
#else
 | 
			
		||||
    tsdbCloseFileSystem(&(*pTsdb)->pFS);
 | 
			
		||||
#endif
 | 
			
		||||
    tsdbCloseCache(*pTsdb);
 | 
			
		||||
    taosMemoryFreeClear(*pTsdb);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue