Skip to content

Commit 19f5521

Browse files
authored
feat: support data cache generation (#24)
* feat: memory pool supports cache function * feat: cache data initialization * test: test cases for data memory cache * feat: data generator supports data cache model * feat: add validity checks for cache-related parameters * build: support sanitizer * feat: enable mimalloc memory allocator by default * feat: remove the force keyword from the database deletion statement * test: fix test cases * feat: use cache data by default
1 parent 30dc251 commit 19f5521

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1512
-557
lines changed

CMakeLists.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/conan)
77
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
88

99
# Options
10-
option(CMAKE_ENABLE_TEST "Enable testing" ON)
11-
option(CMAKE_ENABLE_COVERAGE "Enable code coverage" OFF)
12-
option(CMAKE_ENABLE_SANITIZER "Enable sanitizers" OFF)
13-
option(BUNDLE_JEMALLOC "Use jemalloc as allocator" ON)
14-
option(BUNDLE_MIMALLOC "Use mimalloc as allocator" OFF)
10+
option(TSGEN_ENABLE_TEST "Enable testing" ON)
11+
option(TSGEN_ENABLE_COVERAGE "Enable code coverage" OFF)
12+
option(TSGEN_ENABLE_SANITIZER "Enable sanitizers" OFF)
13+
option(TSGEN_BUNDLE_JEMALLOC "Use jemalloc as allocator" OFF)
14+
option(TSGEN_BUNDLE_MIMALLOC "Use mimalloc as allocator" ON)
1515

1616
# Global settings
1717
set(CMAKE_CXX_STANDARD 17)
@@ -52,20 +52,33 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UPPER)
5252
string(TIMESTAMP TSGEN_BUILD_DATE "%Y-%m-%d %H:%M:%S %z")
5353
message(STATUS "Sys Info: ${TSGEN_BUILD_TARGET_OSTYPE}-${TSGEN_BUILD_TARGET_CPUTYPE} ${TSGEN_BUILD_DATE}")
5454

55+
# Sanitizer
56+
if(TSGEN_ENABLE_SANITIZER AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
57+
add_compile_options(-fsanitize=address)
58+
59+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.13")
60+
add_link_options(-fsanitize=address)
61+
else()
62+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
63+
endif()
64+
65+
message(STATUS "AddressSanitizer enabled")
66+
endif()
67+
5568
# Memory allocator settings
56-
if(BUNDLE_JEMALLOC AND BUNDLE_MIMALLOC)
69+
if(TSGEN_BUNDLE_JEMALLOC AND TSGEN_BUNDLE_MIMALLOC)
5770
message(FATAL_ERROR "Cannot use both jemalloc and mimalloc at the same time")
5871
endif()
5972

6073
# Set link indicators
6174
set(ALLOCATOR_LINK_FLAGS "")
6275
set(ALLOCATOR_LIB "")
6376

64-
if(BUNDLE_JEMALLOC)
77+
if(TSGEN_BUNDLE_JEMALLOC)
6578
message(STATUS "Using jemalloc memory allocator")
6679
find_package(jemalloc REQUIRED)
6780
set(ALLOCATOR_LIB jemalloc::jemalloc)
68-
elseif(BUNDLE_MIMALLOC)
81+
elseif(TSGEN_BUNDLE_MIMALLOC)
6982
message(STATUS "Using mimalloc memory allocator")
7083
find_package(mimalloc REQUIRED)
7184
set(ALLOCATOR_LIB mimalloc-static)
@@ -126,12 +139,12 @@ endif()
126139
message(STATUS "Git Info: ${TSGEN_BUILD_GIT}")
127140

128141
# Test support
129-
if(CMAKE_ENABLE_TEST)
142+
if(TSGEN_ENABLE_TEST)
130143
enable_testing()
131144
endif()
132145

133146
# Add main program and test directories
134147
add_subdirectory(src)
135-
# if(CMAKE_ENABLE_TEST)
148+
# if(TSGEN_ENABLE_TEST)
136149
# add_subdirectory(test)
137150
# endif()

conf/mqtt-csv.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ schema:
3636
type: binary(24)
3737
generation:
3838
interlace: 1
39-
per_table_rows: 100
40-
per_batch_rows: 10000
39+
rows_per_table: 100
40+
rows_per_batch: 10000
4141

4242
jobs:
4343
# MQTT publish job

conf/mqtt-gen-ev-history.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ schema:
7575
expr: ({"京AD12345", "京AF67890", "京AD98765", "京AF43210", "京AD56789", "京AF01234", "京AD23456", "京AF78901", "京AD34567", "京AF89012", "京AD45678", "京AD67890", "京AD78901", "京AD89012", "京AD90123", "京AD01234", "京AD13579", "京AD24680", "京AD35791", "京AD46802", "京AD57913", "京AF12345", "京AF23456", "京AF56789", "京AF90123", "京AF13579", "京AF24680", "京AF35791"})[tonumber(string.match(_table, "%d+"))]
7676
generation:
7777
interlace: 0
78-
per_table_rows: 43200
79-
per_batch_rows: 1000
78+
rows_per_table: 43200
79+
rows_per_batch: 1000
8080

8181
jobs:
8282
# MQTT publish job

conf/mqtt-gen-ev-realtime.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ schema:
7575
expr: ({"京AD12345", "京AF67890", "京AD98765", "京AF43210", "京AD56789", "京AF01234", "京AD23456", "京AF78901", "京AD34567", "京AF89012", "京AD45678", "京AD67890", "京AD78901", "京AD89012", "京AD90123", "京AD01234", "京AD13579", "京AD24680", "京AD35791", "京AD46802", "京AD57913", "京AF12345", "京AF23456", "京AF56789", "京AF90123", "京AF13579", "京AF24680", "京AF35791"})[tonumber(string.match(_table, "%d+"))]
7676
generation:
7777
interlace: 1
78-
per_table_rows: -1
79-
per_batch_rows: 10000
78+
rows_per_table: -1
79+
rows_per_batch: 10000
8080

8181
jobs:
8282
# MQTT publish job

conf/mqtt-gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ schema:
4848
- Austin
4949
generation:
5050
interlace: 1
51-
per_table_rows: 100
52-
per_batch_rows: 10000
51+
rows_per_table: 100
52+
rows_per_batch: 10000
5353

5454
jobs:
5555
# MQTT publish job

conf/tdengine-csv.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ schema:
3838
type: binary(24)
3939
generation:
4040
interlace: 1
41-
per_table_rows: 100
42-
per_batch_rows: 10000
41+
rows_per_table: 100
42+
rows_per_batch: 10000
4343

4444
jobs:
4545
# TDengine insert job

conf/tdengine-gen-2stb.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ schema:
4646
- Austin
4747
generation:
4848
interlace: 1
49-
per_table_rows: 100
50-
per_batch_rows: 10000
49+
rows_per_table: 100
50+
rows_per_batch: 10000
5151

5252
ev_schema: &ev_schema
5353
name: ev
@@ -104,8 +104,8 @@ ev_schema: &ev_schema
104104
- Chengdu
105105
generation:
106106
interlace: 2
107-
per_table_rows: 500
108-
per_batch_rows: 5000
107+
rows_per_table: 500
108+
rows_per_batch: 5000
109109

110110
concurrency: 2
111111
jobs:

conf/tdengine-gen-checkpoint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ schema:
4646
- Austin
4747
generation:
4848
interlace: 1
49-
per_table_rows: 100
50-
per_batch_rows: 10000
49+
rows_per_table: 100
50+
rows_per_batch: 10000
5151

5252
jobs:
5353
# TDengine insert job

conf/tdengine-gen-literal.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ schema:
4646
- Austin
4747
generation:
4848
interlace: 1
49-
per_table_rows: 100
50-
per_batch_rows: 10000
49+
rows_per_table: 100
50+
rows_per_batch: 10000
5151

5252
jobs:
5353
# TDengine insert job

conf/tdengine-gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ schema:
4646
- Austin
4747
generation:
4848
interlace: 1
49-
per_table_rows: 100
50-
per_batch_rows: 10000
49+
rows_per_table: 100
50+
rows_per_batch: 10000
5151

5252
jobs:
5353
# TDengine insert job

0 commit comments

Comments
 (0)