quasardb 3.14.1.dev5__cp39-cp39-macosx_10_14_x86_64.whl → 3.14.1.dev6__cp39-cp39-macosx_10_14_x86_64.whl

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.

Potentially problematic release.


This version of quasardb might be problematic. Click here for more details.

quasardb/CMakeLists.txt CHANGED
@@ -325,6 +325,7 @@ set(QDB_FILES
325
325
  batch_inserter.hpp
326
326
  blob.hpp
327
327
  cluster.hpp
328
+ cluster.cpp
328
329
  concepts.hpp
329
330
  continuous.cpp
330
331
  continuous.hpp
@@ -333,9 +334,12 @@ set(QDB_FILES
333
334
  error.hpp
334
335
  entry.hpp
335
336
  handle.hpp
337
+ handle.cpp
336
338
  logger.hpp
337
339
  logger.cpp
338
340
  masked_array.hpp
341
+ metrics.hpp
342
+ metrics.cpp
339
343
  module.hpp
340
344
  module.cpp
341
345
  node.hpp
quasardb/cluster.cpp ADDED
@@ -0,0 +1,89 @@
1
+ #include "cluster.hpp"
2
+ #include "metrics.hpp"
3
+ #include <chrono>
4
+ #include <thread>
5
+
6
+ namespace qdb
7
+ {
8
+
9
+ cluster::cluster(const std::string & uri,
10
+ const std::string & user_name,
11
+ const std::string & user_private_key,
12
+ const std::string & cluster_public_key,
13
+ const std::string & user_security_file,
14
+ const std::string & cluster_public_key_file,
15
+ std::chrono::milliseconds timeout,
16
+ bool do_version_check)
17
+ : _uri{uri}
18
+ , _handle{make_handle_ptr()}
19
+ , _json_loads{pybind11::module::import("json").attr("loads")}
20
+ , _logger("quasardb.cluster")
21
+ {
22
+ if (do_version_check == true)
23
+ {
24
+ _logger.warn(
25
+ "do_version_check parameter has been deprecated and a no-op. It will be removed from a "
26
+ "future release");
27
+ }
28
+
29
+ options().apply_credentials(user_name, user_private_key, cluster_public_key, //
30
+ user_security_file, cluster_public_key_file);
31
+
32
+ options().set_timeout(timeout);
33
+
34
+ // HACKS(leon): we need to ensure there is always one callback active
35
+ // for qdb. Callbacks can be lost when the last active session
36
+ // gets closed. As such, the most pragmatic place to 'check'
37
+ // for this callback is when establishing a new connection.
38
+ qdb::native::swap_callback();
39
+
40
+ _logger.info("Connecting to cluster %s", _uri);
41
+ _handle->connect(_uri);
42
+ }
43
+
44
+ void cluster::close()
45
+ {
46
+ _logger.info("Closing connection to cluster");
47
+
48
+ try
49
+ {
50
+ if (is_open() == true) [[likely]]
51
+ {
52
+ _handle->close();
53
+ }
54
+ }
55
+ catch (qdb::invalid_handle_exception const & e)
56
+ {
57
+ // This can happen if, for example, we call close() after an error occured; in those
58
+ // circumstances, we fully expect the connection to already be invalid, and we should
59
+ // not care if this specific exception is raised.
60
+ _logger.warn("Connection already closed");
61
+ }
62
+
63
+ _handle.reset();
64
+
65
+ assert(is_open() == false);
66
+ }
67
+
68
+ void cluster::wait_for_compaction()
69
+ {
70
+
71
+ // We define this function in the .cpp file so we can avoid including chrono and thread
72
+ // in the header file.
73
+
74
+ using namespace std::chrono_literals;
75
+
76
+ for (;;)
77
+ {
78
+ std::uint64_t progress = compact_progress();
79
+
80
+ if (progress == 0) [[unlikely]]
81
+ {
82
+ break;
83
+ }
84
+
85
+ std::this_thread::sleep_for(100ms);
86
+ }
87
+ }
88
+
89
+ }; // namespace qdb
quasardb/cluster.hpp CHANGED
@@ -72,58 +72,10 @@ public:
72
72
  const std::string & user_security_file = {},
73
73
  const std::string & cluster_public_key_file = {},
74
74
  std::chrono::milliseconds timeout = std::chrono::minutes{1},
75
- bool do_version_check = false)
76
- : _uri{uri}
77
- , _handle{make_handle_ptr()}
78
- , _json_loads{pybind11::module::import("json").attr("loads")}
79
- , _logger("quasardb.cluster")
80
- {
81
- if (do_version_check == true)
82
- {
83
- _logger.warn(
84
- "do_version_check parameter has been deprecated and a no-op. It will be removed from a "
85
- "future release");
86
- }
87
-
88
- options().apply_credentials(user_name, user_private_key, cluster_public_key, //
89
- user_security_file, cluster_public_key_file);
90
-
91
- options().set_timeout(timeout);
92
-
93
- // HACKS(leon): we need to ensure there is always one callback active
94
- // for qdb. Callbacks can be lost when the last active session
95
- // gets closed. As such, the most pragmatic place to 'check'
96
- // for this callback is when establishing a new connection.
97
- qdb::native::swap_callback();
98
-
99
- _logger.info("Connecting to cluster %s", _uri);
100
- _handle->connect(_uri);
101
- }
75
+ bool do_version_check = false);
102
76
 
103
77
  public:
104
- void close()
105
- {
106
- _logger.info("Closing connection to cluster");
107
-
108
- try
109
- {
110
- if (is_open() == true) [[likely]]
111
- {
112
- _handle->close();
113
- }
114
- }
115
- catch (qdb::invalid_handle_exception const & e)
116
- {
117
- // This can happen if, for example, we call close() after an error occured; in those
118
- // circumstances, we fully expect the connection to already be invalid, and we should
119
- // not care if this specific exception is raised.
120
- _logger.warn("Connection already closed");
121
- }
122
-
123
- _handle.reset();
124
-
125
- assert(is_open() == false);
126
- }
78
+ void close();
127
79
 
128
80
  bool is_open() const
129
81
  {
@@ -463,6 +415,37 @@ public:
463
415
  static_cast<int>(timeout_ms.count())));
464
416
  }
465
417
 
418
+ void compact_full()
419
+ {
420
+ check_open();
421
+
422
+ qdb_compact_params_t params{};
423
+ params.options = qdb_compact_full;
424
+
425
+ qdb::qdb_throw_if_error(*_handle, qdb_cluster_compact(*_handle, &params));
426
+ }
427
+
428
+ // Returns 0 when finished / no compaction running
429
+ std::uint64_t compact_progress()
430
+ {
431
+ check_open();
432
+
433
+ std::uint64_t progress;
434
+
435
+ qdb::qdb_throw_if_error(*_handle, qdb_cluster_get_compact_progress(*_handle, &progress));
436
+
437
+ return progress;
438
+ }
439
+
440
+ void compact_abort()
441
+ {
442
+ check_open();
443
+
444
+ qdb::qdb_throw_if_error(*_handle, qdb_cluster_abort_compact(*_handle));
445
+ }
446
+
447
+ void wait_for_compaction();
448
+
466
449
  public:
467
450
  std::vector<std::string> endpoints()
468
451
  {
@@ -558,6 +541,10 @@ static inline void register_cluster(Module & m)
558
541
  .def("purge_all", &qdb::cluster::purge_all) //
559
542
  .def("trim_all", &qdb::cluster::trim_all) //
560
543
  .def("purge_cache", &qdb::cluster::purge_cache) //
544
+ .def("compact_full", &qdb::cluster::compact_full) //
545
+ .def("compact_progress", &qdb::cluster::compact_progress) //
546
+ .def("compact_abort", &qdb::cluster::compact_abort) //
547
+ .def("wait_for_compaction", &qdb::cluster::wait_for_compaction) //
561
548
  .def("endpoints", &qdb::cluster::endpoints); //
562
549
  }
563
550
 
@@ -34,7 +34,7 @@ endif()
34
34
 
35
35
  # Set default install directory permissions.
36
36
  if(NOT DEFINED CMAKE_OBJDUMP)
37
- set(CMAKE_OBJDUMP "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump")
37
+ set(CMAKE_OBJDUMP "/usr/local/clang16/bin/llvm-objdump")
38
38
  endif()
39
39
 
40
40
  if(NOT CMAKE_INSTALL_LOCAL_ONLY)
@@ -34,7 +34,7 @@ endif()
34
34
 
35
35
  # Set default install directory permissions.
36
36
  if(NOT DEFINED CMAKE_OBJDUMP)
37
- set(CMAKE_OBJDUMP "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump")
37
+ set(CMAKE_OBJDUMP "/usr/local/clang16/bin/llvm-objdump")
38
38
  endif()
39
39
 
40
40
  if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
quasardb/handle.cpp ADDED
@@ -0,0 +1,29 @@
1
+ #include "handle.hpp"
2
+ #include "metrics.hpp"
3
+
4
+ namespace qdb
5
+ {
6
+
7
+ void handle::connect(const std::string & uri)
8
+ {
9
+ qdb_error_t err;
10
+ {
11
+ metrics::scoped_capture{"qdb_connect"};
12
+ err = qdb_connect(handle_, uri.c_str());
13
+ }
14
+ qdb::qdb_throw_if_error(handle_, err);
15
+ }
16
+
17
+ void handle::close()
18
+ {
19
+ if (handle_ != nullptr)
20
+ {
21
+ metrics::scoped_capture{"qdb_close"};
22
+ qdb_close(handle_);
23
+ handle_ = nullptr;
24
+ }
25
+
26
+ assert(handle_ == nullptr);
27
+ }
28
+
29
+ }; // namespace qdb
quasardb/handle.hpp CHANGED
@@ -54,26 +54,14 @@ public:
54
54
  close();
55
55
  }
56
56
 
57
- void connect(const std::string & uri)
58
- {
59
- qdb::qdb_throw_if_error(handle_, qdb_connect(handle_, uri.c_str()));
60
- }
57
+ void connect(const std::string & uri);
61
58
 
62
59
  operator qdb_handle_t() const noexcept
63
60
  {
64
61
  return handle_;
65
62
  }
66
63
 
67
- void close()
68
- {
69
- if (handle_ != nullptr)
70
- {
71
- qdb_close(handle_);
72
- handle_ = nullptr;
73
- }
74
-
75
- assert(handle_ == nullptr);
76
- }
64
+ void close();
77
65
 
78
66
  constexpr inline bool is_open() const
79
67
  {
quasardb/libqdb_api.dylib CHANGED
Binary file
quasardb/logger.cpp CHANGED
@@ -11,6 +11,8 @@ void qdb::native::swap_callback()
11
11
  {
12
12
  // Potential race condition avoidance!
13
13
  std::lock_guard<std::mutex> guard(_buffer_lock);
14
+
15
+ #ifndef NDEBUG
14
16
  qdb_error_t error;
15
17
 
16
18
  error = qdb_log_remove_callback(local_callback_id);
@@ -26,6 +28,7 @@ void qdb::native::swap_callback()
26
28
  // fprintf(stderr, "unable to add new callback: %s (%#x)\n", qdb_error(error), error);
27
29
  // fflush(stderr);
28
30
  }
31
+ #endif
29
32
 
30
33
  _logger = qdb::logger("quasardb.native");
31
34
  }
quasardb/metrics.cpp ADDED
@@ -0,0 +1,103 @@
1
+ #include "metrics.hpp"
2
+ #include <mutex>
3
+
4
+ namespace qdb
5
+ {
6
+
7
+ static metrics_container_t metrics_totals_ = metrics_container_t{};
8
+ static std::mutex metrics_lock_ = std::mutex{};
9
+
10
+ metrics::scoped_capture::~scoped_capture()
11
+ {
12
+ using std::chrono::nanoseconds;
13
+
14
+ time_point_t stop = clock_t::now();
15
+
16
+ auto duration = std::chrono::duration_cast<nanoseconds>(stop - start_);
17
+
18
+ metrics::record(test_id_, duration.count());
19
+ }
20
+
21
+ metrics::measure::measure()
22
+ : start_{metrics::totals()}
23
+ {}
24
+
25
+ metrics_container_t metrics::measure::get() const
26
+ {
27
+ metrics_container_t cur = metrics::totals();
28
+
29
+ metrics_container_t ret{};
30
+
31
+ for (auto i : cur)
32
+ {
33
+ assert(ret.find(i.first) == ret.end());
34
+
35
+ metrics_container_t::const_iterator prev = start_.find(i.first);
36
+
37
+ if (prev == start_.end())
38
+ {
39
+ // Previously, metric didn't exist yet, as such it's entirely new
40
+ // and all accumulated time was within the scope.
41
+ ret.emplace(i.first, i.second);
42
+ }
43
+ else if (i.second > prev->second)
44
+ {
45
+ // Accumulated time actually increased, record difference
46
+ ret.emplace(i.first, i.second - prev->second);
47
+ }
48
+ else
49
+ {
50
+ // Integrity check: we can only increase totals over time, never decrease
51
+ assert(i.second == prev->second);
52
+ }
53
+ };
54
+
55
+ return ret;
56
+ };
57
+
58
+ /* static */ void metrics::record(std::string const & test_id, std::uint64_t nsec)
59
+ {
60
+ std::lock_guard<std::mutex> guard(metrics_lock_);
61
+
62
+ metrics_container_t::iterator pos = metrics_totals_.lower_bound(test_id);
63
+
64
+ if (pos == metrics_totals_.end() || pos->first != test_id) [[unlikely]]
65
+ {
66
+ pos = metrics_totals_.emplace_hint(pos, test_id, 0);
67
+
68
+ assert(pos->second == 0);
69
+ }
70
+
71
+ assert(pos->first == test_id);
72
+ pos->second += nsec;
73
+ }
74
+
75
+ /* static */ metrics_container_t metrics::totals()
76
+ {
77
+ std::lock_guard<std::mutex> guard(metrics_lock_);
78
+ return metrics_totals_;
79
+ }
80
+
81
+ /* static */ void metrics::clear()
82
+ {
83
+ std::lock_guard<std::mutex> guard(metrics_lock_);
84
+ metrics_totals_.clear();
85
+ }
86
+
87
+ void register_metrics(py::module_ & m)
88
+ {
89
+
90
+ py::module_ metrics_module =
91
+ m.def_submodule("metrics", "Keep track of low-level performance metrics")
92
+ .def("totals", &qdb::metrics::totals)
93
+ .def("clear", &qdb::metrics::clear);
94
+
95
+ auto metrics_measure = py::class_<qdb::metrics::measure>(
96
+ metrics_module, "Measure", "Track all metrics within a block of code")
97
+ .def(py::init())
98
+ .def("__enter__", &qdb::metrics::measure::enter)
99
+ .def("__exit__", &qdb::metrics::measure::exit)
100
+ .def("get", &qdb::metrics::measure::get);
101
+ };
102
+
103
+ }; // namespace qdb
quasardb/metrics.hpp ADDED
@@ -0,0 +1,112 @@
1
+ /*
2
+ *
3
+ * Official Python API
4
+ *
5
+ * Copyright (c) 2009-2023, quasardb SAS. All rights reserved.
6
+ * All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions are met:
10
+ *
11
+ * * Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * * Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following disclaimer in the
15
+ * documentation and/or other materials provided with the distribution.
16
+ * * Neither the name of quasardb nor the names of its contributors may
17
+ * be used to endorse or promote products derived from this software
18
+ * without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY QUASARDB AND CONTRIBUTORS ``AS IS'' AND ANY
21
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
24
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+ #pragma once
32
+
33
+ #include <pybind11/pybind11.h>
34
+ #include <pybind11/stl.h>
35
+ #include <cassert>
36
+ #include <chrono>
37
+ #include <map>
38
+ #include <string>
39
+
40
+ namespace qdb
41
+ {
42
+ namespace py = pybind11;
43
+ using metrics_container_t = std::map<std::string, std::uint64_t>;
44
+
45
+ class metrics
46
+ {
47
+ private:
48
+ public:
49
+ /**
50
+ * Utility fixture that automatically records timings for a certain block of code.
51
+ * This is intended to be used from native C++ code only.
52
+ */
53
+ class scoped_capture
54
+ {
55
+ using clock_t = std::chrono::high_resolution_clock;
56
+ using time_point_t = std::chrono::time_point<clock_t>;
57
+
58
+ public:
59
+ scoped_capture(std::string const & test_id) noexcept
60
+ : test_id_{test_id}
61
+ , start_{clock_t::now()} {};
62
+ ~scoped_capture();
63
+
64
+ private:
65
+ std::string test_id_;
66
+ time_point_t start_;
67
+ };
68
+
69
+ /**
70
+ * Utility class that's exposed to Python which can be used to record metrics in
71
+ * a scope. It makes it easy to track the difference between the beginning and end
72
+ * of execution.
73
+ */
74
+ class measure
75
+ {
76
+ public:
77
+ measure();
78
+ ~measure(){};
79
+
80
+ public:
81
+ measure enter()
82
+ {
83
+ // No-op, all initialization is done in the constructor.
84
+ return *this;
85
+ }
86
+
87
+ void exit(py::object /* type */, py::object /* value */, py::object /* traceback */)
88
+ {}
89
+
90
+ metrics_container_t get() const;
91
+
92
+ private:
93
+ metrics_container_t start_;
94
+ };
95
+
96
+ public:
97
+ metrics() noexcept {};
98
+
99
+ ~metrics() noexcept {};
100
+
101
+ public:
102
+ static void record(std::string const & test_id, std::uint64_t nsec);
103
+
104
+ static metrics_container_t totals();
105
+ static void clear();
106
+
107
+ private:
108
+ };
109
+
110
+ void register_metrics(py::module_ & m);
111
+
112
+ } // namespace qdb
quasardb/module.cpp CHANGED
@@ -1,5 +1,6 @@
1
1
  #include "module.hpp"
2
2
  #include "cluster.hpp"
3
+ #include "metrics.hpp"
3
4
  #include "node.hpp"
4
5
  #include "writer.hpp"
5
6
  #include <functional>
@@ -62,6 +63,7 @@ PYBIND11_MODULE(quasardb, m)
62
63
  qdb::register_table_reader(m);
63
64
  qdb::register_masked_array(m);
64
65
  qdb::register_writer(m);
66
+ qdb::register_metrics(m);
65
67
 
66
68
  qdb::detail::register_ts_column(m);
67
69
  qdb::reader::register_ts_value(m);
@@ -34,6 +34,6 @@ endif()
34
34
 
35
35
  # Set default install directory permissions.
36
36
  if(NOT DEFINED CMAKE_OBJDUMP)
37
- set(CMAKE_OBJDUMP "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump")
37
+ set(CMAKE_OBJDUMP "/usr/local/clang16/bin/llvm-objdump")
38
38
  endif()
39
39
 
Binary file
quasardb/query.cpp CHANGED
@@ -31,6 +31,7 @@
31
31
 
32
32
  #include "query.hpp"
33
33
  #include "masked_array.hpp"
34
+ #include "metrics.hpp"
34
35
  #include "numpy.hpp"
35
36
  #include "traits.hpp"
36
37
  #include "utils.hpp"
@@ -390,7 +391,12 @@ numpy_query_result_t numpy_query_results(const qdb_query_result_t * r)
390
391
  dict_query_result_t dict_query(qdb::handle_ptr h, const std::string & q, const py::object & blobs)
391
392
  {
392
393
  detail::qdb_resource<qdb_query_result_t> r{*h};
393
- qdb_error_t err = qdb_query(*h, q.c_str(), &r);
394
+
395
+ qdb_error_t err;
396
+ {
397
+ metrics::scoped_capture capture{"qdb_query"};
398
+ err = qdb_query(*h, q.c_str(), &r);
399
+ }
394
400
 
395
401
  qdb::qdb_throw_if_query_error(*h, err, r.get());
396
402
 
@@ -400,7 +406,12 @@ dict_query_result_t dict_query(qdb::handle_ptr h, const std::string & q, const p
400
406
  numpy_query_result_t numpy_query(qdb::handle_ptr h, const std::string & q)
401
407
  {
402
408
  detail::qdb_resource<qdb_query_result_t> r{*h};
403
- qdb_error_t err = qdb_query(*h, q.c_str(), &r);
409
+
410
+ qdb_error_t err;
411
+ {
412
+ metrics::scoped_capture capture{"qdb_query"};
413
+ err = qdb_query(*h, q.c_str(), &r);
414
+ }
404
415
  qdb::qdb_throw_if_query_error(*h, err, r.get());
405
416
 
406
417
  return numpy_query_results(r);
@@ -34,7 +34,7 @@ endif()
34
34
 
35
35
  # Set default install directory permissions.
36
36
  if(NOT DEFINED CMAKE_OBJDUMP)
37
- set(CMAKE_OBJDUMP "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump")
37
+ set(CMAKE_OBJDUMP "/usr/local/clang16/bin/llvm-objdump")
38
38
  endif()
39
39
 
40
40
  if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
quasardb/table.cpp CHANGED
@@ -1,5 +1,6 @@
1
1
  #include "table.hpp"
2
2
  #include "dispatch.hpp"
3
+ #include "metrics.hpp"
3
4
  #include "object_tracker.hpp"
4
5
  #include "table_reader.hpp"
5
6
  #include "traits.hpp"
@@ -68,6 +69,31 @@ inline void insert_column_dispatch(handle_ptr handle,
68
69
 
69
70
  }; // namespace detail
70
71
 
72
+ void table::_cache_columns() const
73
+ {
74
+ _handle->check_open();
75
+
76
+ detail::qdb_resource<qdb_ts_column_info_ex_t> columns{*_handle};
77
+ qdb_size_t count = 0;
78
+
79
+ qdb_error_t err;
80
+
81
+ {
82
+ metrics::scoped_capture("qdb_ts_list_columns");
83
+ err = qdb_ts_list_columns_ex(*_handle, _alias.c_str(), &columns, &count);
84
+ }
85
+
86
+ if (err == qdb_e_alias_not_found) [[unlikely]]
87
+ {
88
+ // Can happen if table does not yet exist, do nothing.
89
+ return;
90
+ }
91
+
92
+ qdb::qdb_throw_if_error(*_handle, err);
93
+
94
+ _columns = detail::convert_columns(columns.get(), count);
95
+ }
96
+
71
97
  py::object table::reader(
72
98
  const std::vector<std::string> & columns, py::object ranges, bool dict_mode) const
73
99
  {
quasardb/table.hpp CHANGED
@@ -68,7 +68,7 @@ public:
68
68
 
69
69
  const auto c_columns = detail::convert_columns_ex(columns);
70
70
  qdb::qdb_throw_if_error(*_handle, qdb_ts_create_ex(*_handle, _alias.c_str(), shard_size.count(),
71
- c_columns.data(), c_columns.size()));
71
+ c_columns.data(), c_columns.size(), qdb_ttl_disabled));
72
72
  }
73
73
 
74
74
  void insert_columns(const std::vector<detail::column_info> & columns)
@@ -156,25 +156,7 @@ private:
156
156
  /**
157
157
  * Loads column info / metadata from server and caches it locally.
158
158
  */
159
- void _cache_columns() const
160
- {
161
- _handle->check_open();
162
-
163
- detail::qdb_resource<qdb_ts_column_info_ex_t> columns{*_handle};
164
- qdb_size_t count = 0;
165
-
166
- auto err = qdb_ts_list_columns_ex(*_handle, _alias.c_str(), &columns, &count);
167
-
168
- if (err == qdb_e_alias_not_found) [[unlikely]]
169
- {
170
- // Can happen if table does not yet exist, do nothing.
171
- return;
172
- }
173
-
174
- qdb::qdb_throw_if_error(*_handle, err);
175
-
176
- _columns = detail::convert_columns(columns.get(), count);
177
- }
159
+ void _cache_columns() const;
178
160
 
179
161
  /**
180
162
  * Loads column info / metadata from server if not yet cached locally.
quasardb/writer.cpp CHANGED
@@ -1,6 +1,7 @@
1
1
  #include "writer.hpp"
2
2
  #include "concepts.hpp"
3
3
  #include "dispatch.hpp"
4
+ #include "metrics.hpp"
4
5
  #include "numpy.hpp"
5
6
  #include "traits.hpp"
6
7
  #include "convert/array.hpp"
@@ -491,6 +492,9 @@ void writer::_push_impl(writer::staged_tables_t & staged_tables,
491
492
  batch_table.data.column_count, table_name);
492
493
  }
493
494
 
495
+ // Make sure to measure the time it takes to do the actual push
496
+ qdb::metrics::scoped_capture capture{"qdb_batch_push"};
497
+
494
498
  qdb::qdb_throw_if_error(
495
499
  *_handle, qdb_exp_batch_push(*_handle, mode, batch.data(), nullptr, batch.size()));
496
500
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quasardb
3
- Version: 3.14.1.dev5
3
+ Version: 3.14.1.dev6
4
4
  Summary: Python API for quasardb
5
5
  Home-page: https://www.quasardb.net/
6
6
  Author: quasardb SAS
@@ -1,11 +1,12 @@
1
- quasardb/CMakeLists.txt,sha256=Dvv6Os6bhJ5JfwkN1jAFidpkA2UfPwQTFvvWk_vhbdU,14682
1
+ quasardb/CMakeLists.txt,sha256=gqGK-ppTl6As74kItvmRFwQATLr9vYhoSLPMq3HrPe0,14737
2
2
  quasardb/Makefile,sha256=yuJ6zNLc5d4kgnA0lNTVAKSX5wZT2K6HfBB1y-giO20,7409
3
3
  quasardb/__init__.py,sha256=LZ2jO_0RX6OCzgnDgyLK78xtYLzNzfguD8TuQju-4Ho,3707
4
4
  quasardb/batch_column.hpp,sha256=lgsf5iYSz5u1udgfhVG4QTv96DW0C2GSCgeIltw-n-w,3308
5
5
  quasardb/batch_inserter.hpp,sha256=23OxfmKG6SdD_lsTZS3v7ZPGuunRMP_4hBov8I8oybA,9555
6
6
  quasardb/blob.hpp,sha256=D7T9ECon76aIlUoQqvN2XNEzF8FQ7dh1sAvEmuvI-u4,5696
7
- quasardb/cluster.hpp,sha256=piKiRV4CW0tR8fhsph2_SUqRbdUiemvqWHhGwhG0Kuk,19480
8
- quasardb/cmake_install.cmake,sha256=IBP1GD4wGbJ_rK5fnGin5XjaTnvvWw7AdMjbXeCwuzM,1732
7
+ quasardb/cluster.cpp,sha256=jMaqH-xL5EMSM2GM8JgZTqAlC3UY38YvZDw8cNDf-Xw,2411
8
+ quasardb/cluster.hpp,sha256=GLZabw9awbe2nr3xPbTcgmDdeFapuGEAtYzK5aJoOEM,18854
9
+ quasardb/cmake_install.cmake,sha256=VIl5Sw4uU0kp4MO0VjJmqtnka90XFYw_B83Vv6xAAyc,1673
9
10
  quasardb/concepts.hpp,sha256=bdfPkYLtcf0s-fc0QDz05c2dTm_gj7y2BMSceIY4dHA,9296
10
11
  quasardb/continuous.cpp,sha256=vNWtyingRC9g_2OQ7KjWm0L62fguQILXvQ14zu9OlLE,4417
11
12
  quasardb/continuous.hpp,sha256=aX90ydtKYcraoGaNfmIK97EFiqCikDwhSR-IcdjG0AE,4221
@@ -18,13 +19,16 @@ quasardb/double.hpp,sha256=lvjHILHMa0JC2egDgO2JVtiJqgcmhQfGMyafCpc0jT0,3152
18
19
  quasardb/entry.hpp,sha256=O-CDkWNqzUHKQiLz17toQFukZE6lZo3b35lRR1kjL0I,9178
19
20
  quasardb/error.hpp,sha256=QIjtxqCSdlB3RD3AMHavJDFrCFGkb46R70YY2rjGo-Q,10489
20
21
  quasardb/firehose.py,sha256=HO0GjCDg3x4cpzVSH3KZ1AJhV8lK2HJyXr9tpfnNSGI,3492
21
- quasardb/handle.hpp,sha256=YXNajJzM1dH51YIhFTwxaM_wXiM0a6HenqWPEw8A2M4,3204
22
+ quasardb/handle.cpp,sha256=6x7qPFvIzGNralz7MFbUtCEXi26Q2RKzNhIywoVIOKM,507
23
+ quasardb/handle.hpp,sha256=2n_n3FwOQRJ9KB0DMmOFC547K320JwOeSsGCHCfrZWE,2953
22
24
  quasardb/integer.hpp,sha256=_h-0PZfvlKAnCUgrzuisOsM_hS-S49MzwBJyJ-yZpyE,3216
23
- quasardb/libqdb_api.dylib,sha256=UBMAal52yKCwhSD7_-vjg-XsXy_gjOeQRsOJu9SM3YQ,36307992
24
- quasardb/logger.cpp,sha256=qGFoA9R7ZRq9QrcJELndOBTdvWE2PjTqRRc_sERjZeU,2927
25
+ quasardb/libqdb_api.dylib,sha256=mHyqtDSeU7N9zvEKSpFhQ0sURJz-ldv4usZu2AqEHLI,33835736
26
+ quasardb/logger.cpp,sha256=UT2dGHF_sk-UIFUAOWxdse8JlcaLnnARsZDu5AP_v4E,2950
25
27
  quasardb/logger.hpp,sha256=USIltBP4gAGQcfLCXLgKXifdk0oJwyNjIJiF8HIMlgU,7050
26
28
  quasardb/masked_array.hpp,sha256=XWzRY0ySs3-xKRxa9UJsixZqGsCNXnOhGuhDrnZOwXU,18337
27
- quasardb/module.cpp,sha256=FPgDf9FcSPC8vpbHOMk3FI9pgbZSce-wp8UiIAtuWF0,2107
29
+ quasardb/metrics.cpp,sha256=7xbg65UUQysbT8AIsnLOaVbBlwxQqB8sMzFgcOw4BMI,2839
30
+ quasardb/metrics.hpp,sha256=Ff9IkRbQ7jbzG9SXTpNnYX7lRKixhbecAn14omgBld4,3421
31
+ quasardb/module.cpp,sha256=f705GwIRdmNO6hb_Yx-3z6QJo5WiRrRvsr54VK7iWH4,2160
28
32
  quasardb/module.hpp,sha256=NQYsuOMyTnhSufJyAFQOXiL9znXea_ch2CnDgEKm1dY,580
29
33
  quasardb/node.hpp,sha256=bE5xtaHwdDNBHPDhgh-vI3lvI9DIPjtmzRszkyZxuBI,4648
30
34
  quasardb/numpy.cpp,sha256=U1lazDCBCCKRR3ubLCf5OaHbK-kLQAZz7jLlHWSr1gw,183
@@ -34,14 +38,14 @@ quasardb/options.hpp,sha256=9v1WRQSBZEZYrzf_jHP_wgeepxhq9s-W9c1nqAmuGeY,9914
34
38
  quasardb/perf.hpp,sha256=gFJiVuE-BUigrm2267o0MacP0YwVYpxR-8ldlmlaLAA,11028
35
39
  quasardb/pool.py,sha256=4IFwot-U8GEHo8h86264uVTWge44bOH_TUkoVy3Hjac,8449
36
40
  quasardb/pytypes.hpp,sha256=buxGpg3ZUbXfAblG2jRncEsqMfjuoaNKpW2IuB8dALw,6673
37
- quasardb/quasardb.cpython-39-darwin.so,sha256=BSbt9E4iTZ1UZ0PUhEmVVUDrZEpg_PP0-2ii8pQ_-Xk,1083616
38
- quasardb/query.cpp,sha256=xYyN8ELpBC4BZQQF6phz5qXM5m6nakPWn-rPS_VNtsE,12149
41
+ quasardb/quasardb.cpython-39-darwin.so,sha256=_t5xsZ3jcPzhztxpKnNS3-N84Om9mO2Z7GTwwq-5vfY,1031788
42
+ quasardb/query.cpp,sha256=yi_lH0nvrSIJUO2kouz8jSeDhgOHpjcNT6HZoBlvbe8,12332
39
43
  quasardb/query.hpp,sha256=-er_n0esgo7AshmGJxEenBRuaJvZUNF-Oco_LvjdcmM,3265
40
44
  quasardb/remove_cvref.hpp,sha256=kGW27WE2GvUL9sWvVdFD6NgnVF40bzeNl74ecTlyG9c,580
41
45
  quasardb/stats.py,sha256=DKvurzur-4c5nVPjr29_Stu9mvwCynM5gGnw0gVQlt8,7387
42
46
  quasardb/string.hpp,sha256=IS9Ep-f_GX-o5XD5Dy82D5Yf1_oA93feMgH13LFDHzg,5911
43
- quasardb/table.cpp,sha256=F19t8OybpNLD_s0Cm_gTD4qDAxJGQfDpd7gFkA_2ZZs,9834
44
- quasardb/table.hpp,sha256=DR8uHcEC7LkYQ9ItB2sS6PDOjucwyX-Uz6UFzHxUrm0,11161
47
+ quasardb/table.cpp,sha256=-zEd3u5o4FhrjxTkW8PKtVyaRZhJ7gI4TYiaaNgL65Y,10444
48
+ quasardb/table.hpp,sha256=sVh1rHGYifvB3sIySIs4BDbu5F205TWupVyya4nB2ps,10666
45
49
  quasardb/table_cache.py,sha256=RgLOYEcgmlc5fVeOBOyjZImtYKoM1UEdzyzPc8EriQI,1507
46
50
  quasardb/table_reader.hpp,sha256=gXFJ3e9E6AzYxwfpCeqnTOyiynpWLwgB2IJJElIl9zs,6721
47
51
  quasardb/tag.hpp,sha256=QhbOSn0Qwaf1TC9GtELREQOQBmPGeKdRpgIBlPdlmq4,2655
@@ -50,7 +54,7 @@ quasardb/traits.hpp,sha256=JBF1ySxuoUM9DdSb1tZyB_lDHCXw8DEC1HlTaEXzkWQ,15764
50
54
  quasardb/ts_iterator.hpp,sha256=tiO5dqPpQrhOT0j6v2AUY5kRYDYj-gki2eBzCiYUDSs,4202
51
55
  quasardb/utils.cpp,sha256=QzmxqyTWPZ0XwxVS_wtTzfffZs3HI8MwwvW9vAHiT-Q,606
52
56
  quasardb/utils.hpp,sha256=pTkffOObpXUi2yQqOWwTNiv9eT80nndeQtySuNIN5MQ,4550
53
- quasardb/writer.cpp,sha256=DzjilpM0FAGUtj3GyrxYksLSYH0NEc415kuBmEnXFPg,18885
57
+ quasardb/writer.cpp,sha256=lBy9j75n-gQfb-ufJAUBDwlrpcCYZ6eve6MNDnjuIYU,19037
54
58
  quasardb/writer.hpp,sha256=wHpIsUsWrNrM1yGOnBL8YQncASlu-129vVqASXqd0Ls,12537
55
59
  quasardb/CMakeFiles/CMakeDirectoryInformation.cmake,sha256=DNncyTE12GRv1AQRJQVQkIwP9uKsUOFqN7pXwjm_p8Q,732
56
60
  quasardb/CMakeFiles/progress.marks,sha256=micfKpFrC27mzsskJvCzIG7wdFeL5V2byU9vP-Orhqo,2
@@ -61,7 +65,7 @@ quasardb/convert/unicode.hpp,sha256=WZcLiC-tRTYS-IAKZ6l2AVbk9AUv3DBbEWbCiwh8MIY,
61
65
  quasardb/convert/util.hpp,sha256=eJhQGs0ymPn3CT48HGHndaChJg_SCOI5U1QkLccXLdQ,560
62
66
  quasardb/convert/value.hpp,sha256=YDBT8UUnMUjrP_isW70WBZMGnldT1tMVER9k5Keekhc,22685
63
67
  quasardb/date/Makefile,sha256=JY1hOA8CZIJLQFeqd6jge56HEecVXN3YnVydBzz1o0E,7434
64
- quasardb/date/cmake_install.cmake,sha256=oHnJK9cyLblMSb7kXbOnhIgPnqTo0xMcGNNRssw2dVo,3308
68
+ quasardb/date/cmake_install.cmake,sha256=81aq1O6FaTVteQSnK5W-ciFjrJTRM1gbAZU1AP0bgQc,3249
65
69
  quasardb/date/dateConfigVersion.cmake,sha256=PLnZWf4r8BmNkw645Jb7mJrIe2QWSJioM6O4nY0Nwj8,2418
66
70
  quasardb/date/dateTargets.cmake,sha256=YJ_GPXSFeDNN7iShTy1Q0kkv5wdBDVkUnhBqDaq4xOg,3000
67
71
  quasardb/date/CMakeFiles/CMakeDirectoryInformation.cmake,sha256=DNncyTE12GRv1AQRJQVQkIwP9uKsUOFqN7pXwjm_p8Q,732
@@ -74,11 +78,11 @@ quasardb/extensions/writer.py,sha256=ZH6ldQrbH-DimuQTyk3mXS1OyaJIhvCmZTzFtG4hRfY
74
78
  quasardb/numpy/__init__.py,sha256=DKIe8702OedqPxSxgiOze15ulf7XZT4HL9X7Zif-j5c,28226
75
79
  quasardb/pandas/__init__.py,sha256=13Gq3sSlU5xIJ1bf-0n7yyKCWRPYBNSBAjc5VSV0j3g,16126
76
80
  quasardb/pybind11/Makefile,sha256=C4-lWSoIYTTuxzdyISKyKWHKjpRuIlMi0_NDFvdk-6g,7454
77
- quasardb/pybind11/cmake_install.cmake,sha256=9_JZtBJMTYlVWhS1Y45EZfqNUs1tU4DAIT14--A2DL8,1228
81
+ quasardb/pybind11/cmake_install.cmake,sha256=b9uFDssIxtpKwp4oiOF937lN6D2fmOettcCHAdbU244,1169
78
82
  quasardb/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake,sha256=DNncyTE12GRv1AQRJQVQkIwP9uKsUOFqN7pXwjm_p8Q,732
79
83
  quasardb/pybind11/CMakeFiles/progress.marks,sha256=micfKpFrC27mzsskJvCzIG7wdFeL5V2byU9vP-Orhqo,2
80
84
  quasardb/range-v3/Makefile,sha256=Uset6pLvjN1Ze0hP57MyJ6040KWXpKj9W0Dkr1WDJh8,8823
81
- quasardb/range-v3/cmake_install.cmake,sha256=OA0aW5UtdIU6x8iegvSPF04JAmFFMOlx_xby_ZfFHko,3417
85
+ quasardb/range-v3/cmake_install.cmake,sha256=r7XxQwpsARjVuNCk5FgRrgcW0NScuGMp49AMfve4iUI,3358
82
86
  quasardb/range-v3/range-v3-config-version.cmake,sha256=X3UrazWN6YOziV7sKMXfydMMV1_8BziHjYAu0HMFEek,2908
83
87
  quasardb/range-v3/range-v3-config.cmake,sha256=BZrbOr8d2SSoaASpmre_rE_3YIsZrWQF8H51o9_dqEY,3554
84
88
  quasardb/range-v3/CMakeFiles/CMakeDirectoryInformation.cmake,sha256=DNncyTE12GRv1AQRJQVQkIwP9uKsUOFqN7pXwjm_p8Q,732
@@ -98,8 +102,8 @@ quasardb/utils/ostream.hpp,sha256=oqnyxurnnbiStXuFTZEewEM_SsYzB-RdUft-q2y1JcI,37
98
102
  quasardb/utils/permutation.hpp,sha256=7iyUNZQLxUEyOliRKwoVzO9pzG_b5Id4JjAHXAy5I50,1502
99
103
  quasardb/utils/stable_sort.hpp,sha256=Z1R3mWl78_Zh4O4bxCXQJHBCd7m71G-qFRcK-ll07qc,465
100
104
  quasardb/utils/unzip_view.hpp,sha256=pkwk_BTYOm_9HOjyf6Z2W2Udc9he5EJKcIbbrYcUzok,2387
101
- quasardb-3.14.1.dev5.dist-info/LICENSE.md,sha256=4D8uWaUfWtnVDET9cPT43pHIiwt1GHXvEr1rzz49pJw,1467
102
- quasardb-3.14.1.dev5.dist-info/METADATA,sha256=b7IqgloEUU9fFOhZSb7-7gpAbx2lt05u0slh4OSiiJY,1461
103
- quasardb-3.14.1.dev5.dist-info/WHEEL,sha256=hgZvrlQ16Hzt5qiSLL09qJyqip_-uMS7-HY4MCTupqU,110
104
- quasardb-3.14.1.dev5.dist-info/top_level.txt,sha256=wlprix4hCywuF1PkgKWYdZeJKq_kgJOqkAvukm_sZQ8,9
105
- quasardb-3.14.1.dev5.dist-info/RECORD,,
105
+ quasardb-3.14.1.dev6.dist-info/LICENSE.md,sha256=4D8uWaUfWtnVDET9cPT43pHIiwt1GHXvEr1rzz49pJw,1467
106
+ quasardb-3.14.1.dev6.dist-info/METADATA,sha256=ta4c-1x4-NyZCo4RS3Kq56W42-bhAO_g0GqMhtZNI7U,1461
107
+ quasardb-3.14.1.dev6.dist-info/WHEEL,sha256=hgZvrlQ16Hzt5qiSLL09qJyqip_-uMS7-HY4MCTupqU,110
108
+ quasardb-3.14.1.dev6.dist-info/top_level.txt,sha256=wlprix4hCywuF1PkgKWYdZeJKq_kgJOqkAvukm_sZQ8,9
109
+ quasardb-3.14.1.dev6.dist-info/RECORD,,