-
Notifications
You must be signed in to change notification settings - Fork 93
Write with parallel #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Write with parallel #772
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,12 +54,15 @@ void init_config_value() { | |
| g_config_value_.int64_encoding_type_ = TS_2DIFF; | ||
| g_config_value_.float_encoding_type_ = GORILLA; | ||
| g_config_value_.double_encoding_type_ = GORILLA; | ||
| g_config_value_.string_encoding_type_ = PLAIN; | ||
| // Default compression type is LZ4 | ||
| #ifdef ENABLE_LZ4 | ||
| g_config_value_.default_compression_type_ = LZ4; | ||
| #else | ||
| g_config_value_.default_compression_type_ = UNCOMPRESSED; | ||
| #endif | ||
| g_config_value_.parallel_write_enabled_ = true; | ||
| g_config_value_.write_thread_count_ = 6; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to sense the number of cores? |
||
| // Enforce aligned page size limits strictly by default. | ||
| g_config_value_.strict_page_size_ = true; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,6 +163,20 @@ FORCE_INLINE uint8_t get_global_compression() { | |
| return static_cast<uint8_t>(g_config_value_.default_compression_type_); | ||
| } | ||
|
|
||
| FORCE_INLINE void set_parallel_write_enabled(bool enabled) { | ||
| g_config_value_.parallel_write_enabled_ = enabled; | ||
| } | ||
|
|
||
| FORCE_INLINE bool get_parallel_write_enabled() { | ||
| return g_config_value_.parallel_write_enabled_; | ||
| } | ||
|
Comment on lines
+170
to
+172
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. && g_config_value_.write_thread_count_ != 1? |
||
|
|
||
| FORCE_INLINE int set_write_thread_count(int32_t count) { | ||
| if (count < 1 || count > 64) return E_INVALID_ARG; | ||
| g_config_value_.write_thread_count_ = count; | ||
| return E_OK; | ||
| } | ||
|
Comment on lines
+174
to
+178
|
||
|
|
||
| extern int init_common(); | ||
| extern bool is_timestamp_column_name(const char* time_col_name); | ||
| extern void cols_to_json(ByteStream* byte_stream, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,122 @@ | ||||||||
| /* | ||||||||
| * Licensed to the Apache Software Foundation (ASF) under one | ||||||||
| * or more contributor license agreements. See the NOTICE file | ||||||||
| * distributed with this work for additional information | ||||||||
| * regarding copyright ownership. The ASF licenses this file | ||||||||
| * to you under the Apache License, Version 2.0 (the | ||||||||
| * License); you may not use this file except in compliance | ||||||||
| * with the License. You may obtain a copy of the License at | ||||||||
| * | ||||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||||
| * | ||||||||
| * Unless required by applicable law or agreed to in writing, | ||||||||
| * software distributed under the License is distributed on an | ||||||||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||||
| * KIND, either express or implied. See the License for the | ||||||||
| * specific language governing permissions and limitations | ||||||||
| * under the License. | ||||||||
| */ | ||||||||
| #ifndef COMMON_THREAD_POOL_H | ||||||||
| #define COMMON_THREAD_POOL_H | ||||||||
|
|
||||||||
| #ifdef ENABLE_THREADS | ||||||||
|
|
||||||||
| #include <condition_variable> | ||||||||
| #include <functional> | ||||||||
| #include <future> | ||||||||
| #include <mutex> | ||||||||
| #include <queue> | ||||||||
| #include <thread> | ||||||||
|
||||||||
| #include <thread> | |
| #include <thread> | |
| #include <type_traits> |
Copilot
AI
Apr 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worker_loop() executes task() without any exception handling. If a task throws, the worker thread will terminate and active_ will never be decremented, causing wait_all() (and any code waiting on futures) to potentially block forever. Wrap task execution in a try/catch that ensures active_ is decremented and optionally stores/logs the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENABLE_THREADSadds a compile definition, but the build does not link against the platform thread library (e.g.,-pthread/Threads::Threads). On many toolchains this will cause unresolved symbols when usingstd::thread. WhenENABLE_THREADSis ON,find_package(Threads REQUIRED)and linkThreads::Threadsto the relevant targets (at leasttsfileand any object libs that end up in it).