duckdb 0.3.2-dev772.0 → 0.3.2-dev780.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.2-dev772.0",
4
+ "version": "0.3.2-dev780.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -27591,8 +27591,6 @@ public:
27591
27591
  private:
27592
27592
  unique_ptr<TreeNode> CreateTree(PhysicalOperator *root, idx_t depth = 0);
27593
27593
  void Render(const TreeNode &node, std::ostream &str) const;
27594
- //! The lock used for flushing information from a thread into the global query profiler
27595
- mutex flush_lock;
27596
27594
 
27597
27595
  public:
27598
27596
  DUCKDB_API bool IsEnabled() const;
@@ -27633,6 +27631,8 @@ private:
27633
27631
 
27634
27632
  //! Whether or not the query profiler is running
27635
27633
  bool running;
27634
+ //! The lock used for flushing information from a thread into the global query profiler
27635
+ mutex flush_lock;
27636
27636
 
27637
27637
  //! Whether or not the query requires profiling
27638
27638
  bool query_requires_profiling;
@@ -27645,7 +27645,7 @@ private:
27645
27645
  Profiler main_query;
27646
27646
  //! A map of a Physical Operator pointer to a tree node
27647
27647
  TreeMap tree_map;
27648
-
27648
+ //! Whether or not we are running as part of a explain_analyze query
27649
27649
  bool is_explain_analyze;
27650
27650
 
27651
27651
  public:
@@ -27675,12 +27675,12 @@ private:
27675
27675
  class QueryProfilerHistory {
27676
27676
  private:
27677
27677
  //! Previous Query profilers
27678
- deque<pair<transaction_t, unique_ptr<QueryProfiler>>> prev_profilers;
27678
+ deque<pair<transaction_t, shared_ptr<QueryProfiler>>> prev_profilers;
27679
27679
  //! Previous Query profilers size
27680
27680
  uint64_t prev_profilers_size = 20;
27681
27681
 
27682
27682
  public:
27683
- deque<pair<transaction_t, unique_ptr<QueryProfiler>>> &GetPrevProfilers() {
27683
+ deque<pair<transaction_t, shared_ptr<QueryProfiler>>> &GetPrevProfilers() {
27684
27684
  return prev_profilers;
27685
27685
  }
27686
27686
  QueryProfilerHistory() {
@@ -97527,7 +97527,7 @@ struct ActiveQueryContext {
97527
97527
  };
97528
97528
 
97529
97529
  ClientContext::ClientContext(shared_ptr<DatabaseInstance> database)
97530
- : profiler(make_unique<QueryProfiler>(*this)), query_profiler_history(make_unique<QueryProfilerHistory>()),
97530
+ : profiler(make_shared<QueryProfiler>(*this)), query_profiler_history(make_unique<QueryProfilerHistory>()),
97531
97531
  db(move(database)), transaction(db->GetTransactionManager(), *this), interrupted(false),
97532
97532
  temporary_objects(make_unique<SchemaCatalogEntry>(&db->GetCatalog(), TEMP_SCHEMA, true)),
97533
97533
  catalog_search_path(make_unique<CatalogSearchPath>(*this)),
@@ -97622,7 +97622,7 @@ string ClientContext::EndQueryInternal(ClientContextLock &lock, bool success, bo
97622
97622
  auto &prev_profilers = query_profiler_history->GetPrevProfilers();
97623
97623
  prev_profilers.emplace_back(transaction.ActiveTransaction().active_query, move(profiler));
97624
97624
  // Reinitialize the query profiler
97625
- profiler = make_unique<QueryProfiler>(*this);
97625
+ profiler = make_shared<QueryProfiler>(*this);
97626
97626
  // Propagate settings of the saved query into the new profiler.
97627
97627
  profiler->Propagate(*prev_profilers.back().second);
97628
97628
  if (prev_profilers.size() >= query_profiler_history->GetPrevProfilersSize()) {
@@ -107898,6 +107898,7 @@ void QueryProfiler::StartExplainAnalyze() {
107898
107898
  }
107899
107899
 
107900
107900
  void QueryProfiler::EndQuery() {
107901
+ lock_guard<mutex> guard(flush_lock);
107901
107902
  if (!IsEnabled() || !running) {
107902
107903
  return;
107903
107904
  }
@@ -108056,10 +108057,10 @@ void OperatorProfiler::Flush(const PhysicalOperator *phys_op, ExpressionExecutor
108056
108057
  }
108057
108058
 
108058
108059
  void QueryProfiler::Flush(OperatorProfiler &profiler) {
108060
+ lock_guard<mutex> guard(flush_lock);
108059
108061
  if (!IsEnabled() || !running) {
108060
108062
  return;
108061
108063
  }
108062
- lock_guard<mutex> guard(flush_lock);
108063
108064
  for (auto &node : profiler.timings) {
108064
108065
  auto entry = tree_map.find(node.first);
108065
108066
  D_ASSERT(entry != tree_map.end());
@@ -120734,8 +120735,8 @@ void Executor::Initialize(PhysicalOperator *plan) {
120734
120735
  lock_guard<mutex> elock(executor_lock);
120735
120736
  physical_plan = plan;
120736
120737
 
120737
- auto &profiler = QueryProfiler::Get(context);
120738
- profiler.Initialize(physical_plan);
120738
+ this->profiler = context.profiler;
120739
+ profiler->Initialize(physical_plan);
120739
120740
  this->producer = scheduler.CreateProducer();
120740
120741
 
120741
120742
  auto root_pipeline = make_shared<Pipeline>(*this);
@@ -121146,9 +121147,7 @@ void Executor::ThrowExceptionInternal() { // LCOV_EXCL_START
121146
121147
  } // LCOV_EXCL_STOP
121147
121148
 
121148
121149
  void Executor::Flush(ThreadContext &tcontext) {
121149
- lock_guard<mutex> elock(executor_lock);
121150
- auto &profiler = QueryProfiler::Get(context);
121151
- profiler.Flush(tcontext.profiler);
121150
+ profiler->Flush(tcontext.profiler);
121152
121151
  }
121153
121152
 
121154
121153
  bool Executor::GetPipelinesProgress(double &current_progress) { // LCOV_EXCL_START
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "c9573d243"
15
- #define DUCKDB_VERSION "0.3.2-dev772"
14
+ #define DUCKDB_SOURCE_ID "3e55c44bd"
15
+ #define DUCKDB_VERSION "0.3.2-dev780"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -9869,6 +9869,7 @@ class DataChunk;
9869
9869
  class PhysicalOperator;
9870
9870
  class PipelineExecutor;
9871
9871
  class OperatorState;
9872
+ class QueryProfiler;
9872
9873
  class ThreadContext;
9873
9874
  class Task;
9874
9875
 
@@ -9968,6 +9969,8 @@ private:
9968
9969
  vector<pair<ExceptionType, string>> exceptions;
9969
9970
  //! List of events
9970
9971
  vector<shared_ptr<Event>> events;
9972
+ //! The query profiler
9973
+ shared_ptr<QueryProfiler> profiler;
9971
9974
 
9972
9975
  //! The amount of completed pipelines of the query
9973
9976
  atomic<idx_t> completed_pipelines;
@@ -17117,7 +17120,7 @@ public:
17117
17120
  DUCKDB_API ~ClientContext();
17118
17121
 
17119
17122
  //! Query profiler
17120
- unique_ptr<QueryProfiler> profiler;
17123
+ shared_ptr<QueryProfiler> profiler;
17121
17124
  //! QueryProfiler History
17122
17125
  unique_ptr<QueryProfilerHistory> query_profiler_history;
17123
17126
  //! The database that this client is connected to