couchbase 4.2.11-rc.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +49 -2
  2. package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
  3. package/deps/couchbase-cxx-client/CMakeLists.txt +1 -0
  4. package/deps/couchbase-cxx-client/cmake/ThirdPartyDependencies.cmake +2 -0
  5. package/deps/couchbase-cxx-client/core/bucket.cxx +2 -2
  6. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +51 -5
  7. package/deps/couchbase-cxx-client/core/impl/collection.cxx +224 -209
  8. package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +2 -2
  9. package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +1 -0
  10. package/deps/couchbase-cxx-client/core/io/dns_client.cxx +4 -0
  11. package/deps/couchbase-cxx-client/core/io/dns_config.cxx +15 -4
  12. package/deps/couchbase-cxx-client/core/io/dns_config.hxx +1 -1
  13. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +95 -53
  14. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +1 -0
  15. package/deps/couchbase-cxx-client/core/mcbp/operation_queue.cxx +1 -0
  16. package/deps/couchbase-cxx-client/core/meta/features.hxx +5 -0
  17. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +116 -105
  18. package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +116 -108
  19. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +97 -81
  20. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +5 -0
  21. package/deps/couchbase-cxx-client/core/range_scan_load_balancer.cxx +141 -0
  22. package/deps/couchbase-cxx-client/core/range_scan_load_balancer.hxx +64 -0
  23. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.cxx +224 -336
  24. package/deps/couchbase-cxx-client/core/range_scan_orchestrator.hxx +5 -6
  25. package/deps/couchbase-cxx-client/core/range_scan_orchestrator_options.hxx +8 -5
  26. package/deps/couchbase-cxx-client/core/scan_result.hxx +1 -11
  27. package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +16 -7
  28. package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +578 -483
  29. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.cxx +51 -50
  30. package/deps/couchbase-cxx-client/core/transactions/attempt_context_testing_hooks.hxx +4 -2
  31. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.cxx +6 -6
  32. package/deps/couchbase-cxx-client/core/transactions/cleanup_testing_hooks.hxx +3 -2
  33. package/deps/couchbase-cxx-client/core/transactions/internal/transactions_cleanup.hxx +2 -0
  34. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +5 -1
  35. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +222 -179
  36. package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +23 -12
  37. package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +61 -24
  38. package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +36 -16
  39. package/deps/couchbase-cxx-client/core/transactions/utils.cxx +9 -0
  40. package/deps/couchbase-cxx-client/core/transactions.hxx +40 -7
  41. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +2 -2
  42. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +20 -1
  43. package/deps/couchbase-cxx-client/couchbase/collection.hxx +1 -0
  44. package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +1 -1
  45. package/deps/couchbase-cxx-client/couchbase/error_context.hxx +1 -0
  46. package/deps/couchbase-cxx-client/couchbase/fork_event.hxx +39 -0
  47. package/deps/couchbase-cxx-client/couchbase/get_links_analytics_options.hxx +2 -2
  48. package/deps/couchbase-cxx-client/couchbase/scope.hxx +1 -1
  49. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +2 -2
  50. package/deps/couchbase-cxx-client/couchbase/search_result.hxx +1 -1
  51. package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +1 -0
  52. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
  53. package/deps/couchbase-cxx-client/couchbase-sdk-cxx-black-duck-manifest.yaml +1 -0
  54. package/dist/binding.d.ts +8 -0
  55. package/dist/bindingutilities.d.ts +6 -1
  56. package/dist/bindingutilities.js +15 -1
  57. package/dist/bucketmanager.d.ts +0 -12
  58. package/dist/cluster.d.ts +0 -2
  59. package/dist/cluster.js +0 -2
  60. package/dist/collection.d.ts +3 -3
  61. package/dist/collection.js +3 -1
  62. package/dist/querytypes.d.ts +0 -2
  63. package/dist/rangeScan.d.ts +0 -8
  64. package/dist/rangeScan.js +0 -8
  65. package/dist/scope.d.ts +0 -5
  66. package/dist/scope.js +0 -5
  67. package/dist/scopesearchindexmanager.d.ts +0 -2
  68. package/dist/scopesearchindexmanager.js +0 -2
  69. package/dist/searchexecutor.js +3 -1
  70. package/dist/searchtypes.d.ts +16 -6
  71. package/dist/searchtypes.js +2 -6
  72. package/dist/transactions.d.ts +23 -0
  73. package/dist/transactions.js +16 -10
  74. package/dist/vectorsearch.d.ts +8 -8
  75. package/dist/vectorsearch.js +7 -7
  76. package/package.json +7 -7
  77. package/src/instance.cpp +11 -1
  78. package/src/instance.hpp +1 -0
  79. package/src/jstocbpp_autogen.hpp +8 -1
  80. package/src/jstocbpp_transactions.hpp +40 -3
  81. package/src/transactions.cpp +12 -1
  82. package/tools/gen-bindings-json.py +0 -1
  83. package/deps/couchbase-cxx-client/core/scan_options.hxx +0 -44
@@ -22,8 +22,8 @@
22
22
 
23
23
  #include <tl/expected.hpp>
24
24
 
25
- #include <memory>
26
- #include <optional>
25
+ #include <cstdint>
26
+ #include <system_error>
27
27
 
28
28
  namespace asio
29
29
  {
@@ -39,10 +39,10 @@ class scan_stream_manager
39
39
  {
40
40
  public:
41
41
  virtual ~scan_stream_manager() = default;
42
- virtual void stream_start_failed(std::int16_t node_id, bool fatal) = 0;
43
42
  virtual void stream_start_failed_awaiting_retry(std::int16_t node_id, std::uint16_t vbucket_id) = 0;
44
- virtual void stream_continue_failed(std::int16_t node_id, bool fatal) = 0;
45
- virtual void stream_completed(std::int16_t node_id) = 0;
43
+ virtual void stream_received_item(range_scan_item item) = 0;
44
+ virtual void stream_failed(std::int16_t node_id, std::uint16_t vbucket_id, std::error_code ec, bool fatal) = 0;
45
+ virtual void stream_completed(std::int16_t node_id, std::uint16_t vbucket_id) = 0;
46
46
  };
47
47
 
48
48
  class range_scan_orchestrator
@@ -61,5 +61,4 @@ class range_scan_orchestrator
61
61
  private:
62
62
  std::shared_ptr<range_scan_orchestrator_impl> impl_;
63
63
  };
64
-
65
64
  } // namespace couchbase::core
@@ -15,17 +15,17 @@
15
15
 
16
16
  #pragma once
17
17
 
18
- #include "scan_options.hxx"
18
+ #include "range_scan_options.hxx"
19
19
  #include "timeout_defaults.hxx"
20
20
 
21
+ #include <couchbase/best_effort_retry_strategy.hxx>
21
22
  #include <couchbase/mutation_token.hxx>
22
23
  #include <couchbase/retry_strategy.hxx>
23
24
 
24
- #include <cinttypes>
25
+ #include <chrono>
26
+ #include <cstdint>
25
27
  #include <memory>
26
28
  #include <optional>
27
- #include <system_error>
28
- #include <variant>
29
29
  #include <vector>
30
30
 
31
31
  namespace couchbase
@@ -39,6 +39,9 @@ class request_span;
39
39
 
40
40
  namespace couchbase::core
41
41
  {
42
+ struct mutation_state {
43
+ std::vector<couchbase::mutation_token> tokens;
44
+ };
42
45
 
43
46
  struct range_scan_orchestrator_options {
44
47
  static constexpr std::uint16_t default_concurrency{ 1 };
@@ -49,7 +52,7 @@ struct range_scan_orchestrator_options {
49
52
  std::uint32_t batch_byte_limit{ range_scan_continue_options::default_batch_byte_limit };
50
53
  std::uint16_t concurrency{ default_concurrency };
51
54
 
52
- std::shared_ptr<couchbase::retry_strategy> retry_strategy{ nullptr };
55
+ std::shared_ptr<couchbase::retry_strategy> retry_strategy{ make_best_effort_retry_strategy() };
53
56
  std::chrono::milliseconds timeout{ timeout_defaults::key_value_scan_timeout };
54
57
  std::shared_ptr<couchbase::tracing::request_span> parent_span{};
55
58
  };
@@ -15,26 +15,16 @@
15
15
 
16
16
  #pragma once
17
17
 
18
- #include "scan_options.hxx"
19
-
18
+ #include "range_scan_options.hxx"
20
19
  #include "utils/movable_function.hxx"
21
20
 
22
- #include <couchbase/mutation_token.hxx>
23
- #include <couchbase/retry_strategy.hxx>
24
-
25
21
  #include <tl/expected.hpp>
26
22
 
27
- #include <cinttypes>
28
23
  #include <future>
29
- #include <memory>
30
- #include <optional>
31
24
  #include <system_error>
32
- #include <variant>
33
- #include <vector>
34
25
 
35
26
  namespace couchbase::core
36
27
  {
37
-
38
28
  class scan_result_impl;
39
29
 
40
30
  class range_scan_item_iterator
@@ -131,12 +131,13 @@ atr_cleanup_entry::check_atr_and_cleanup(transactions_cleanup_attempt* result)
131
131
  throw *err;
132
132
  }
133
133
  cleanup_docs(durability_level);
134
- auto ec = cleanup_->config().cleanup_hooks->on_cleanup_docs_completed();
134
+ auto ec =
135
+ wait_for_hook([this](auto handler) { return cleanup_->config().cleanup_hooks->on_cleanup_docs_completed(std::move(handler)); });
135
136
  if (ec) {
136
137
  throw client_error(*ec, "on_cleanup_docs_completed hook threw error");
137
138
  }
138
139
  cleanup_entry(durability_level);
139
- ec = cleanup_->config().cleanup_hooks->on_cleanup_completed();
140
+ ec = wait_for_hook([this](auto handler) { return cleanup_->config().cleanup_hooks->on_cleanup_completed(std::move(handler)); });
140
141
  if (ec) {
141
142
  throw client_error(*ec, "on_cleanup_completed hook threw error");
142
143
  }
@@ -246,7 +247,9 @@ atr_cleanup_entry::commit_docs(std::optional<std::vector<doc_record>> docs, dura
246
247
  do_per_doc(*docs, true, [&](transaction_get_result& doc, bool) {
247
248
  if (doc.links().has_staged_content()) {
248
249
  auto content = doc.links().staged_content();
249
- auto ec = cleanup_->config().cleanup_hooks->before_commit_doc(doc.id().key());
250
+ auto ec = wait_for_hook([this, key = doc.id().key()](auto handler) {
251
+ return cleanup_->config().cleanup_hooks->before_commit_doc(key, std::move(handler));
252
+ });
250
253
  if (ec) {
251
254
  throw client_error(*ec, "before_commit_doc hook threw error");
252
255
  }
@@ -288,7 +291,9 @@ atr_cleanup_entry::remove_docs(std::optional<std::vector<doc_record>> docs, dura
288
291
  {
289
292
  if (docs) {
290
293
  do_per_doc(*docs, true, [&](transaction_get_result& doc, bool is_deleted) {
291
- auto ec = cleanup_->config().cleanup_hooks->before_remove_doc(doc.id().key());
294
+ auto ec = wait_for_hook([this, key = doc.id().key()](auto handler) mutable {
295
+ return cleanup_->config().cleanup_hooks->before_remove_doc(key, std::move(handler));
296
+ });
292
297
  if (ec) {
293
298
  throw client_error(*ec, "before_remove_doc hook threw error");
294
299
  }
@@ -330,7 +335,9 @@ atr_cleanup_entry::remove_docs_staged_for_removal(std::optional<std::vector<doc_
330
335
  if (docs) {
331
336
  do_per_doc(*docs, true, [&](transaction_get_result& doc, bool) {
332
337
  if (doc.links().is_document_being_removed()) {
333
- auto ec = cleanup_->config().cleanup_hooks->before_remove_doc_staged_for_removal(doc.id().key());
338
+ auto ec = wait_for_hook([this, key = doc.id().key()](auto handler) mutable {
339
+ return cleanup_->config().cleanup_hooks->before_remove_doc_staged_for_removal(key, std::move(handler));
340
+ });
334
341
  if (ec) {
335
342
  throw client_error(*ec, "before_remove_doc_staged_for_removal hook threw error");
336
343
  }
@@ -358,7 +365,9 @@ atr_cleanup_entry::remove_txn_links(std::optional<std::vector<doc_record>> docs,
358
365
  {
359
366
  if (docs) {
360
367
  do_per_doc(*docs, false, [&](transaction_get_result& doc, bool) {
361
- auto ec = cleanup_->config().cleanup_hooks->before_remove_links(doc.id().key());
368
+ auto ec = wait_for_hook([this, key = doc.id().key()](auto handler) mutable {
369
+ return cleanup_->config().cleanup_hooks->before_remove_links(key, std::move(handler));
370
+ });
362
371
  if (ec) {
363
372
  throw client_error(*ec, "before_remove_links hook threw error");
364
373
  }
@@ -385,7 +394,7 @@ void
385
394
  atr_cleanup_entry::cleanup_entry(durability_level dl)
386
395
  {
387
396
  try {
388
- auto ec = cleanup_->config().cleanup_hooks->before_atr_remove();
397
+ auto ec = wait_for_hook([this](auto handler) { return cleanup_->config().cleanup_hooks->before_atr_remove(std::move(handler)); });
389
398
  if (ec) {
390
399
  throw client_error(*ec, "before_atr_remove hook threw error");
391
400
  }