duckdb 0.7.2-dev2867.0 → 0.7.2-dev2995.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +1 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-datepart.cpp +5 -1
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +18 -7
- package/src/duckdb/src/catalog/default/default_functions.cpp +2 -0
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +3 -3
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +2 -2
- package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
- package/src/duckdb/src/common/string_util.cpp +6 -1
- package/src/duckdb/src/core_functions/function_list.cpp +2 -0
- package/src/duckdb/src/core_functions/scalar/string/format_bytes.cpp +29 -0
- package/src/duckdb/src/execution/index/art/art.cpp +5 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +62 -43
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +17 -11
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +32 -39
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +10 -9
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +6 -21
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +13 -13
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +15 -14
- package/src/duckdb/src/execution/operator/helper/physical_load.cpp +3 -2
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_pragma.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_prepare.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +10 -8
- package/src/duckdb/src/execution/operator/helper/physical_reset.cpp +4 -3
- package/src/duckdb/src/execution/operator/helper/physical_set.cpp +7 -6
- package/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +4 -2
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +8 -8
- package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +17 -16
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +10 -8
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -4
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +5 -5
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +16 -15
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +13 -12
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +12 -10
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +13 -11
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +8 -6
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +13 -13
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +8 -8
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +160 -145
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +10 -25
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +14 -19
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +7 -6
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +18 -30
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +14 -18
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +6 -4
- package/src/duckdb/src/execution/operator/scan/physical_dummy_scan.cpp +4 -19
- package/src/duckdb/src/execution/operator/scan/physical_empty_result.cpp +3 -2
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +14 -5
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +6 -4
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +3 -19
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +4 -18
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -9
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +9 -26
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +4 -19
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +3 -19
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +9 -8
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +1 -1
- package/src/duckdb/src/execution/physical_operator.cpp +11 -5
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +16 -16
- package/src/duckdb/src/function/table/arrow_conversion.cpp +3 -3
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +7 -1
- package/src/duckdb/src/include/duckdb/common/enums/operator_result_type.hpp +16 -4
- package/src/duckdb/src/include/duckdb/common/optional_idx.hpp +45 -0
- package/src/duckdb/src/include/duckdb/common/set.hpp +2 -1
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +15 -0
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +10 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +5 -8
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -7
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_batch_collector.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_materialized_collector.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reservoir_sample.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_asof_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +2 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +1 -3
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +2 -4
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +7 -4
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +26 -6
- package/src/duckdb/src/include/duckdb/execution/radix_partitioned_hashtable.hpp +5 -5
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +2 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +0 -1
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parallel/event.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parallel/interrupt.hpp +63 -0
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +16 -3
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +51 -7
- package/src/duckdb/src/include/duckdb/parallel/task.hpp +21 -2
- package/src/duckdb/src/include/duckdb/parallel/task_counter.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parallel/task_scheduler.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/column_binding.hpp +6 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/optimistic_data_writer.hpp +46 -0
- package/src/duckdb/src/include/duckdb/storage/partial_block_manager.hpp +24 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_checkpoint_state.hpp +46 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +9 -10
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +22 -0
- package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -2
- package/src/duckdb/src/include/duckdb/storage/table/validity_column_data.hpp +1 -2
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +9 -34
- package/src/duckdb/src/include/duckdb/verification/no_operator_caching_verifier.hpp +25 -0
- package/src/duckdb/src/include/duckdb/verification/statement_verifier.hpp +5 -0
- package/src/duckdb/src/main/client_verify.cpp +4 -0
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/main/database.cpp +11 -11
- package/src/duckdb/src/main/extension/extension_load.cpp +19 -15
- package/src/duckdb/src/parallel/event.cpp +1 -1
- package/src/duckdb/src/parallel/executor.cpp +39 -3
- package/src/duckdb/src/parallel/executor_task.cpp +11 -0
- package/src/duckdb/src/parallel/interrupt.cpp +57 -0
- package/src/duckdb/src/parallel/pipeline.cpp +49 -6
- package/src/duckdb/src/parallel/pipeline_executor.cpp +248 -69
- package/src/duckdb/src/parallel/pipeline_initialize_event.cpp +1 -1
- package/src/duckdb/src/parallel/task_scheduler.cpp +57 -22
- package/src/duckdb/src/parser/base_expression.cpp +6 -0
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +17 -3
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +8 -2
- package/src/duckdb/src/planner/operator/logical_aggregate.cpp +13 -1
- package/src/duckdb/src/planner/operator/logical_column_data_get.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_cteref.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_delete.cpp +10 -0
- package/src/duckdb/src/planner/operator/logical_delim_get.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_dummy_scan.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_expression_get.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_get.cpp +10 -4
- package/src/duckdb/src/planner/operator/logical_insert.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_projection.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_set_operation.cpp +11 -0
- package/src/duckdb/src/planner/operator/logical_unnest.cpp +12 -1
- package/src/duckdb/src/planner/operator/logical_update.cpp +10 -0
- package/src/duckdb/src/planner/operator/logical_window.cpp +11 -0
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
- package/src/duckdb/src/storage/data_table.cpp +5 -0
- package/src/duckdb/src/storage/local_storage.cpp +40 -110
- package/src/duckdb/src/storage/optimistic_data_writer.cpp +96 -0
- package/src/duckdb/src/storage/partial_block_manager.cpp +73 -9
- package/src/duckdb/src/storage/single_file_block_manager.cpp +3 -1
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +17 -12
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +3 -0
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +90 -82
- package/src/duckdb/src/storage/table/column_data.cpp +19 -45
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +7 -7
- package/src/duckdb/src/storage/table/column_segment.cpp +1 -1
- package/src/duckdb/src/storage/table/list_column_data.cpp +6 -11
- package/src/duckdb/src/storage/table/row_group.cpp +13 -14
- package/src/duckdb/src/storage/table/row_group_collection.cpp +10 -4
- package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -10
- package/src/duckdb/src/storage/table/struct_column_data.cpp +7 -13
- package/src/duckdb/src/storage/table/update_segment.cpp +0 -25
- package/src/duckdb/src/storage/table/validity_column_data.cpp +2 -6
- package/src/duckdb/src/transaction/commit_state.cpp +4 -4
- package/src/duckdb/src/verification/no_operator_caching_verifier.cpp +13 -0
- package/src/duckdb/src/verification/statement_verifier.cpp +4 -0
- package/src/duckdb/ub_src_core_functions_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_parallel.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
@@ -20,6 +20,7 @@ enum class VerificationType : uint8_t {
|
|
20
20
|
DESERIALIZED,
|
21
21
|
PARSED,
|
22
22
|
UNOPTIMIZED,
|
23
|
+
NO_OPERATOR_CACHING,
|
23
24
|
PREPARED,
|
24
25
|
EXTERNAL,
|
25
26
|
|
@@ -59,6 +60,10 @@ public:
|
|
59
60
|
return false;
|
60
61
|
}
|
61
62
|
|
63
|
+
virtual bool DisableOperatorCaching() const {
|
64
|
+
return false;
|
65
|
+
}
|
66
|
+
|
62
67
|
virtual bool ForceExternal() const {
|
63
68
|
return false;
|
64
69
|
}
|
@@ -28,6 +28,10 @@ PreservedError ClientContext::VerifyQuery(ClientContextLock &lock, const string
|
|
28
28
|
statement_verifiers.emplace_back(StatementVerifier::Create(VerificationType::DESERIALIZED, stmt));
|
29
29
|
statement_verifiers.emplace_back(StatementVerifier::Create(VerificationType::UNOPTIMIZED, stmt));
|
30
30
|
prepared_statement_verifier = StatementVerifier::Create(VerificationType::PREPARED, stmt);
|
31
|
+
#ifdef DUCKDB_DEBUG_ASYNC_SINK_SOURCE
|
32
|
+
// This verification is quite slow, so we only run it for the async sink/source debug mode
|
33
|
+
statement_verifiers.emplace_back(StatementVerifier::Create(VerificationType::NO_OPERATOR_CACHING, stmt));
|
34
|
+
#endif
|
31
35
|
}
|
32
36
|
if (config.verify_external) {
|
33
37
|
statement_verifiers.emplace_back(StatementVerifier::Create(VerificationType::EXTERNAL, stmt));
|
@@ -14,6 +14,10 @@
|
|
14
14
|
|
15
15
|
namespace duckdb {
|
16
16
|
|
17
|
+
#ifdef DEBUG
|
18
|
+
bool DBConfigOptions::debug_print_bindings = false;
|
19
|
+
#endif
|
20
|
+
|
17
21
|
#define DUCKDB_GLOBAL(_PARAM) \
|
18
22
|
{ \
|
19
23
|
_PARAM::Name, _PARAM::Description, _PARAM::InputType, _PARAM::SetGlobal, nullptr, _PARAM::ResetGlobal, \
|
@@ -1,24 +1,24 @@
|
|
1
1
|
#include "duckdb/main/database.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/catalog/catalog.hpp"
|
4
|
-
#include "duckdb/main/database_manager.hpp"
|
5
4
|
#include "duckdb/common/virtual_file_system.hpp"
|
5
|
+
#include "duckdb/execution/operator/helper/physical_set.hpp"
|
6
|
+
#include "duckdb/function/cast/cast_function_set.hpp"
|
7
|
+
#include "duckdb/function/compression_function.hpp"
|
8
|
+
#include "duckdb/main/attached_database.hpp"
|
6
9
|
#include "duckdb/main/client_context.hpp"
|
7
|
-
#include "duckdb/parallel/task_scheduler.hpp"
|
8
|
-
#include "duckdb/storage/storage_manager.hpp"
|
9
|
-
#include "duckdb/storage/object_cache.hpp"
|
10
|
-
#include "duckdb/transaction/transaction_manager.hpp"
|
11
10
|
#include "duckdb/main/connection_manager.hpp"
|
12
|
-
#include "duckdb/
|
13
|
-
#include "duckdb/main/extension_helper.hpp"
|
14
|
-
#include "duckdb/function/cast/cast_function_set.hpp"
|
11
|
+
#include "duckdb/main/database_manager.hpp"
|
15
12
|
#include "duckdb/main/error_manager.hpp"
|
16
|
-
#include "duckdb/main/
|
13
|
+
#include "duckdb/main/extension_helper.hpp"
|
14
|
+
#include "duckdb/parallel/task_scheduler.hpp"
|
17
15
|
#include "duckdb/parser/parsed_data/attach_info.hpp"
|
18
16
|
#include "duckdb/storage/magic_bytes.hpp"
|
19
|
-
#include "duckdb/storage/
|
20
|
-
#include "duckdb/execution/operator/helper/physical_set.hpp"
|
17
|
+
#include "duckdb/storage/object_cache.hpp"
|
21
18
|
#include "duckdb/storage/standard_buffer_manager.hpp"
|
19
|
+
#include "duckdb/storage/storage_extension.hpp"
|
20
|
+
#include "duckdb/storage/storage_manager.hpp"
|
21
|
+
#include "duckdb/transaction/transaction_manager.hpp"
|
22
22
|
|
23
23
|
#ifndef DUCKDB_NO_THREADS
|
24
24
|
#include "duckdb/common/thread.hpp"
|
@@ -30,14 +30,18 @@ static T LoadFunctionFromDLL(void *dll, const string &function_name, const strin
|
|
30
30
|
return (T)function;
|
31
31
|
}
|
32
32
|
|
33
|
-
void
|
33
|
+
static void ComputeSHA256String(const std::string &to_hash, std::string *res) {
|
34
|
+
// Invoke MbedTls function to actually compute sha256
|
35
|
+
*res = duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(to_hash);
|
36
|
+
}
|
37
|
+
|
38
|
+
static void ComputeSHA256FileSegment(FileHandle *handle, const idx_t start, const idx_t end, std::string *res) {
|
34
39
|
const idx_t len = end - start;
|
35
40
|
string file_content;
|
36
41
|
file_content.resize(len);
|
37
42
|
handle->Read((void *)file_content.data(), len, start);
|
38
43
|
|
39
|
-
|
40
|
-
*res = duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(file_content);
|
44
|
+
ComputeSHA256String(file_content, res);
|
41
45
|
}
|
42
46
|
|
43
47
|
bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileOpener *opener, const string &extension,
|
@@ -86,19 +90,19 @@ bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileOpener *opener, const
|
|
86
90
|
|
87
91
|
const idx_t maxLenChunks = 1024 * 1024;
|
88
92
|
const idx_t numChunks = (signature_offset + maxLenChunks - 1) / maxLenChunks;
|
89
|
-
std::vector<std::string>
|
93
|
+
std::vector<std::string> hash_chunks(numChunks);
|
90
94
|
std::vector<idx_t> splits(numChunks + 1);
|
91
95
|
|
92
|
-
|
93
|
-
for (idx_t i = 0; i < chunks.size(); i++) {
|
96
|
+
for (idx_t i = 0; i < numChunks; i++) {
|
94
97
|
splits[i] = maxLenChunks * i;
|
95
98
|
}
|
99
|
+
splits.back() = signature_offset;
|
96
100
|
|
97
101
|
#ifndef DUCKDB_NO_THREADS
|
98
102
|
std::vector<std::thread> threads;
|
99
103
|
threads.reserve(numChunks);
|
100
104
|
for (idx_t i = 0; i < numChunks; i++) {
|
101
|
-
threads.emplace_back(
|
105
|
+
threads.emplace_back(ComputeSHA256FileSegment, handle.get(), splits[i], splits[i + 1], &hash_chunks[i]);
|
102
106
|
}
|
103
107
|
|
104
108
|
for (auto &thread : threads) {
|
@@ -106,26 +110,26 @@ bool ExtensionHelper::TryInitialLoad(DBConfig &config, FileOpener *opener, const
|
|
106
110
|
}
|
107
111
|
#else
|
108
112
|
for (idx_t i = 0; i < numChunks; i++) {
|
109
|
-
|
113
|
+
ComputeSHA256FileSegment(handle.get(), splits[i], splits[i + 1], &hash_chunks[i]);
|
110
114
|
}
|
111
115
|
#endif // DUCKDB_NO_THREADS
|
112
116
|
|
113
|
-
string
|
114
|
-
|
117
|
+
string hash_concatenation;
|
118
|
+
hash_concatenation.reserve(32 * numChunks); // 256 bits -> 32 bytes per chunk
|
115
119
|
|
116
|
-
for (auto &
|
117
|
-
|
120
|
+
for (auto &hash_chunk : hash_chunks) {
|
121
|
+
hash_concatenation += hash_chunk;
|
118
122
|
}
|
119
123
|
|
120
|
-
string
|
121
|
-
|
124
|
+
string two_level_hash;
|
125
|
+
ComputeSHA256String(hash_concatenation, &two_level_hash);
|
122
126
|
|
123
127
|
// TODO maybe we should do a stream read / hash update here
|
124
128
|
handle->Read((void *)signature.data(), signature.size(), signature_offset);
|
125
129
|
|
126
130
|
bool any_valid = false;
|
127
131
|
for (auto &key : ExtensionHelper::GetPublicKeys()) {
|
128
|
-
if (duckdb_mbedtls::MbedTlsWrapper::IsValidSha256Signature(key, signature,
|
132
|
+
if (duckdb_mbedtls::MbedTlsWrapper::IsValidSha256Signature(key, signature, two_level_hash)) {
|
129
133
|
any_valid = true;
|
130
134
|
break;
|
131
135
|
}
|
@@ -72,7 +72,7 @@ void Event::InsertEvent(shared_ptr<Event> replacement_event) {
|
|
72
72
|
executor.AddEvent(std::move(replacement_event));
|
73
73
|
}
|
74
74
|
|
75
|
-
void Event::SetTasks(vector<
|
75
|
+
void Event::SetTasks(vector<shared_ptr<Task>> tasks) {
|
76
76
|
auto &ts = TaskScheduler::GetScheduler(executor.context);
|
77
77
|
D_ASSERT(total_tasks == 0);
|
78
78
|
D_ASSERT(!tasks.empty());
|
@@ -359,6 +359,7 @@ void Executor::CancelTasks() {
|
|
359
359
|
}
|
360
360
|
pipelines.clear();
|
361
361
|
root_pipelines.clear();
|
362
|
+
to_be_rescheduled_tasks.clear();
|
362
363
|
events.clear();
|
363
364
|
}
|
364
365
|
WorkOnTasks();
|
@@ -375,13 +376,44 @@ void Executor::CancelTasks() {
|
|
375
376
|
void Executor::WorkOnTasks() {
|
376
377
|
auto &scheduler = TaskScheduler::GetScheduler(context);
|
377
378
|
|
378
|
-
|
379
|
+
shared_ptr<Task> task;
|
379
380
|
while (scheduler.GetTaskFromProducer(*producer, task)) {
|
380
|
-
task->Execute(TaskExecutionMode::PROCESS_ALL);
|
381
|
+
auto res = task->Execute(TaskExecutionMode::PROCESS_ALL);
|
382
|
+
if (res == TaskExecutionResult::TASK_BLOCKED) {
|
383
|
+
task->Deschedule();
|
384
|
+
}
|
381
385
|
task.reset();
|
382
386
|
}
|
383
387
|
}
|
384
388
|
|
389
|
+
void Executor::RescheduleTask(shared_ptr<Task> &task) {
|
390
|
+
// This function will spin lock until the task provided is added to the to_be_rescheduled_tasks
|
391
|
+
while (true) {
|
392
|
+
lock_guard<mutex> l(executor_lock);
|
393
|
+
if (cancelled) {
|
394
|
+
return;
|
395
|
+
}
|
396
|
+
auto entry = to_be_rescheduled_tasks.find(task.get());
|
397
|
+
if (entry != to_be_rescheduled_tasks.end()) {
|
398
|
+
auto &scheduler = TaskScheduler::GetScheduler(context);
|
399
|
+
to_be_rescheduled_tasks.erase(task.get());
|
400
|
+
scheduler.ScheduleTask(GetToken(), task);
|
401
|
+
break;
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
|
406
|
+
void Executor::AddToBeRescheduled(shared_ptr<Task> &task) {
|
407
|
+
lock_guard<mutex> l(executor_lock);
|
408
|
+
if (cancelled) {
|
409
|
+
return;
|
410
|
+
}
|
411
|
+
if (to_be_rescheduled_tasks.find(task.get()) != to_be_rescheduled_tasks.end()) {
|
412
|
+
return;
|
413
|
+
}
|
414
|
+
to_be_rescheduled_tasks[task.get()] = std::move(task);
|
415
|
+
}
|
416
|
+
|
385
417
|
bool Executor::ExecutionIsFinished() {
|
386
418
|
return completed_pipelines >= total_pipelines || HasError();
|
387
419
|
}
|
@@ -400,7 +432,10 @@ PendingExecutionResult Executor::ExecuteTask() {
|
|
400
432
|
if (task) {
|
401
433
|
// if we have a task, partially process it
|
402
434
|
auto result = task->Execute(TaskExecutionMode::PROCESS_PARTIAL);
|
403
|
-
if (result
|
435
|
+
if (result == TaskExecutionResult::TASK_BLOCKED) {
|
436
|
+
task->Deschedule();
|
437
|
+
task.reset();
|
438
|
+
} else if (result == TaskExecutionResult::TASK_FINISHED) {
|
404
439
|
// if the task is finished, clean it up
|
405
440
|
task.reset();
|
406
441
|
}
|
@@ -444,6 +479,7 @@ void Executor::Reset() {
|
|
444
479
|
exceptions.clear();
|
445
480
|
pipelines.clear();
|
446
481
|
events.clear();
|
482
|
+
to_be_rescheduled_tasks.clear();
|
447
483
|
execution_result = PendingExecutionResult::RESULT_NOT_READY;
|
448
484
|
}
|
449
485
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#include "duckdb/parallel/task.hpp"
|
2
2
|
#include "duckdb/execution/executor.hpp"
|
3
|
+
#include "duckdb/main/client_context.hpp"
|
3
4
|
|
4
5
|
namespace duckdb {
|
5
6
|
|
@@ -12,6 +13,16 @@ ExecutorTask::ExecutorTask(ClientContext &context) : ExecutorTask(Executor::Get(
|
|
12
13
|
ExecutorTask::~ExecutorTask() {
|
13
14
|
}
|
14
15
|
|
16
|
+
void ExecutorTask::Deschedule() {
|
17
|
+
auto this_ptr = shared_from_this();
|
18
|
+
executor.AddToBeRescheduled(this_ptr);
|
19
|
+
}
|
20
|
+
|
21
|
+
void ExecutorTask::Reschedule() {
|
22
|
+
auto this_ptr = shared_from_this();
|
23
|
+
executor.RescheduleTask(this_ptr);
|
24
|
+
}
|
25
|
+
|
15
26
|
TaskExecutionResult ExecutorTask::Execute(TaskExecutionMode mode) {
|
16
27
|
try {
|
17
28
|
return ExecuteTask(mode);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#include "duckdb/parallel/interrupt.hpp"
|
2
|
+
#include "duckdb/execution/executor.hpp"
|
3
|
+
#include "duckdb/main/client_context.hpp"
|
4
|
+
#include "duckdb/common/atomic.hpp"
|
5
|
+
#include "duckdb/common/mutex.hpp"
|
6
|
+
#include <condition_variable>
|
7
|
+
|
8
|
+
namespace duckdb {
|
9
|
+
|
10
|
+
InterruptState::InterruptState() : mode(InterruptMode::NO_INTERRUPTS) {
|
11
|
+
}
|
12
|
+
InterruptState::InterruptState(weak_ptr<Task> task) : mode(InterruptMode::TASK), current_task(std::move(task)) {
|
13
|
+
}
|
14
|
+
InterruptState::InterruptState(weak_ptr<InterruptDoneSignalState> signal_state_p)
|
15
|
+
: mode(InterruptMode::BLOCKING), signal_state(std::move(signal_state_p)) {
|
16
|
+
}
|
17
|
+
|
18
|
+
void InterruptState::Callback() const {
|
19
|
+
if (mode == InterruptMode::TASK) {
|
20
|
+
auto task = current_task.lock();
|
21
|
+
|
22
|
+
if (!task) {
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
|
26
|
+
task->Reschedule();
|
27
|
+
} else if (mode == InterruptMode::BLOCKING) {
|
28
|
+
auto signal_state_l = signal_state.lock();
|
29
|
+
|
30
|
+
if (!signal_state_l) {
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
|
34
|
+
// Signal the caller, who is currently blocked
|
35
|
+
signal_state_l->Signal();
|
36
|
+
} else {
|
37
|
+
throw InternalException("Callback made on InterruptState without valid interrupt mode specified");
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
void InterruptDoneSignalState::Signal() {
|
42
|
+
{
|
43
|
+
unique_lock<mutex> lck {lock};
|
44
|
+
done = true;
|
45
|
+
}
|
46
|
+
cv.notify_all();
|
47
|
+
}
|
48
|
+
|
49
|
+
void InterruptDoneSignalState::Await() {
|
50
|
+
std::unique_lock<std::mutex> lck(lock);
|
51
|
+
cv.wait(lck, [&]() { return done; });
|
52
|
+
|
53
|
+
// Reset after signal received
|
54
|
+
done = false;
|
55
|
+
}
|
56
|
+
|
57
|
+
} // namespace duckdb
|
@@ -12,7 +12,6 @@
|
|
12
12
|
#include "duckdb/parallel/pipeline_event.hpp"
|
13
13
|
#include "duckdb/parallel/pipeline_executor.hpp"
|
14
14
|
#include "duckdb/parallel/task_scheduler.hpp"
|
15
|
-
#include "duckdb/parallel/thread_context.hpp"
|
16
15
|
|
17
16
|
namespace duckdb {
|
18
17
|
|
@@ -33,14 +32,32 @@ public:
|
|
33
32
|
if (!pipeline_executor) {
|
34
33
|
pipeline_executor = make_uniq<PipelineExecutor>(pipeline.GetClientContext(), pipeline);
|
35
34
|
}
|
35
|
+
|
36
|
+
pipeline_executor->SetTaskForInterrupts(shared_from_this());
|
37
|
+
|
36
38
|
if (mode == TaskExecutionMode::PROCESS_PARTIAL) {
|
37
|
-
|
38
|
-
|
39
|
+
auto res = pipeline_executor->Execute(PARTIAL_CHUNK_COUNT);
|
40
|
+
|
41
|
+
switch (res) {
|
42
|
+
case PipelineExecuteResult::NOT_FINISHED:
|
39
43
|
return TaskExecutionResult::TASK_NOT_FINISHED;
|
44
|
+
case PipelineExecuteResult::INTERRUPTED:
|
45
|
+
return TaskExecutionResult::TASK_BLOCKED;
|
46
|
+
case PipelineExecuteResult::FINISHED:
|
47
|
+
break;
|
40
48
|
}
|
41
49
|
} else {
|
42
|
-
pipeline_executor->Execute();
|
50
|
+
auto res = pipeline_executor->Execute();
|
51
|
+
switch (res) {
|
52
|
+
case PipelineExecuteResult::NOT_FINISHED:
|
53
|
+
throw InternalException("Execute without limit should not return NOT_FINISHED");
|
54
|
+
case PipelineExecuteResult::INTERRUPTED:
|
55
|
+
return TaskExecutionResult::TASK_BLOCKED;
|
56
|
+
case PipelineExecuteResult::FINISHED:
|
57
|
+
break;
|
58
|
+
}
|
43
59
|
}
|
60
|
+
|
44
61
|
event->FinishTask();
|
45
62
|
pipeline_executor.reset();
|
46
63
|
return TaskExecutionResult::TASK_FINISHED;
|
@@ -68,7 +85,7 @@ bool Pipeline::GetProgress(double ¤t_percentage, idx_t &source_cardinality
|
|
68
85
|
}
|
69
86
|
|
70
87
|
void Pipeline::ScheduleSequentialTask(shared_ptr<Event> &event) {
|
71
|
-
vector<
|
88
|
+
vector<shared_ptr<Task>> tasks;
|
72
89
|
tasks.push_back(make_uniq<PipelineTask>(*this, event));
|
73
90
|
event->SetTasks(std::move(tasks));
|
74
91
|
}
|
@@ -149,7 +166,7 @@ bool Pipeline::LaunchScanTasks(shared_ptr<Event> &event, idx_t max_threads) {
|
|
149
166
|
}
|
150
167
|
|
151
168
|
// launch a task for every thread
|
152
|
-
vector<
|
169
|
+
vector<shared_ptr<Task>> tasks;
|
153
170
|
for (idx_t i = 0; i < max_threads; i++) {
|
154
171
|
tasks.push_back(make_uniq<PipelineTask>(*this, event));
|
155
172
|
}
|
@@ -265,6 +282,32 @@ vector<const_reference<PhysicalOperator>> Pipeline::GetOperators() const {
|
|
265
282
|
return result;
|
266
283
|
}
|
267
284
|
|
285
|
+
void Pipeline::ClearSource() {
|
286
|
+
source_state.reset();
|
287
|
+
batch_indexes.clear();
|
288
|
+
}
|
289
|
+
|
290
|
+
idx_t Pipeline::RegisterNewBatchIndex() {
|
291
|
+
lock_guard<mutex> l(batch_lock);
|
292
|
+
idx_t minimum = batch_indexes.empty() ? base_batch_index : *batch_indexes.begin();
|
293
|
+
batch_indexes.insert(minimum);
|
294
|
+
return minimum;
|
295
|
+
}
|
296
|
+
|
297
|
+
idx_t Pipeline::UpdateBatchIndex(idx_t old_index, idx_t new_index) {
|
298
|
+
lock_guard<mutex> l(batch_lock);
|
299
|
+
if (new_index < *batch_indexes.begin()) {
|
300
|
+
throw InternalException("Processing batch index %llu, but previous min batch index was %llu", new_index,
|
301
|
+
*batch_indexes.begin());
|
302
|
+
}
|
303
|
+
auto entry = batch_indexes.find(old_index);
|
304
|
+
if (entry == batch_indexes.end()) {
|
305
|
+
throw InternalException("Batch index %llu was not found in set of active batch indexes", old_index);
|
306
|
+
}
|
307
|
+
batch_indexes.erase(entry);
|
308
|
+
batch_indexes.insert(new_index);
|
309
|
+
return *batch_indexes.begin();
|
310
|
+
}
|
268
311
|
//===--------------------------------------------------------------------===//
|
269
312
|
// Pipeline Build State
|
270
313
|
//===--------------------------------------------------------------------===//
|