couchbase 3.8.1 → 3.8.2

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.
@@ -79,6 +79,15 @@ public:
79
79
  // we have the lock. Block all further ops
80
80
  allow_ops_ = false;
81
81
  }
82
+ // Peek at whether query mode has already been entered. Briefly acquires mutex_ but, unlike
83
+ // get_mode(), never waits on cv_query_ for the query node to be set, so it returns immediately.
84
+ // Used by defensive invariant checks: a KV mutation must never be staged once query mode is
85
+ // entered.
86
+ auto query_mode_entered() const -> bool
87
+ {
88
+ const std::scoped_lock lock(mutex_);
89
+ return mode_.mode == attempt_mode::modes::QUERY;
90
+ }
82
91
  auto get_mode() -> attempt_mode
83
92
  {
84
93
  std::unique_lock<std::mutex> lock(mutex_);
@@ -143,8 +152,10 @@ public:
143
152
  {
144
153
  // when begin work errors out, it is fatal, so reset to kv mode here, allowing
145
154
  // rollback to function properly.
146
- std::unique_lock<std::mutex> lock;
155
+ const std::scoped_lock lock(mutex_);
147
156
  mode_.mode = attempt_mode::modes::KV;
157
+ // query_node is intentionally left populated: a retry runs with a fresh waitable_op_list, and
158
+ // get_mode()'s wait predicate keys on query_node, so clearing it here would serve no purpose.
148
159
  cv_query_.notify_all();
149
160
  }
150
161
 
@@ -199,6 +210,6 @@ private:
199
210
  std::condition_variable cv_ops_;
200
211
  std::condition_variable cv_query_;
201
212
  std::condition_variable cv_in_flight_;
202
- std::mutex mutex_;
213
+ mutable std::mutex mutex_;
203
214
  };
204
215
  } // namespace couchbase::core::transactions
@@ -97,6 +97,39 @@ public:
97
97
  auto operator=(const cluster& other) -> cluster& = default;
98
98
  auto operator=(cluster&& other) -> cluster& = default;
99
99
 
100
+ /**
101
+ * Notify the cluster of a fork-related event, so it can keep its I/O usable
102
+ * across @c fork().
103
+ *
104
+ * Call it three times, in this order: @ref fork_event::prepare in the parent
105
+ * before forking, then @ref fork_event::child in the child and @ref
106
+ * fork_event::parent in the parent.
107
+ *
108
+ * NOTE: @ref fork_event::child reconnects this cluster on a fresh set of
109
+ * sockets, because the inherited ones belong to the parent. Any @ref bucket,
110
+ * @ref scope or @ref collection handle obtained before the fork still refers to
111
+ * the pre-fork connections, so in the child those handles must be re-acquired
112
+ * from the cluster -- using a stale one fails with @ref
113
+ * errc::network::cluster_closed. Handles held in the parent stay valid.
114
+ *
115
+ * This function must not be called while operations are in flight on this
116
+ * cluster from another thread.
117
+ *
118
+ * On platforms without @c fork(), Windows in particular, this function does
119
+ * nothing. It remains callable everywhere so that portable code does not have to
120
+ * guard the calls, but nothing about the cluster changes.
121
+ *
122
+ * @param event the fork-related event that is about to happen, or just happened.
123
+ *
124
+ * @throws std::system_error if the I/O backend cannot be carried across the fork.
125
+ * There is no recovery for this: the cluster's io_context is unusable afterwards
126
+ * and the only thing left to do with the cluster is destroy it. It is reported
127
+ * rather than swallowed because a caller that went on using such a cluster would
128
+ * be operating on a reactor that no longer tracks its sockets.
129
+ *
130
+ * @since 1.0.0
131
+ * @uncommitted
132
+ */
100
133
  void notify_fork(fork_event event);
101
134
 
102
135
  void close(std::function<void()>&& handler);
@@ -326,20 +326,22 @@ module Couchbase
326
326
  #
327
327
  # @return [PingResult]
328
328
  def ping(options = Options::Ping::DEFAULT)
329
- resp = @backend.ping(nil, options.to_backend)
330
- PingResult.new do |res|
331
- res.version = resp[:version]
332
- res.id = resp[:id]
333
- res.sdk = resp[:sdk]
334
- resp[:services].each do |type, svcs|
335
- res.services[type] = svcs.map do |svc|
336
- PingResult::ServiceInfo.new do |info|
337
- info.id = svc[:id]
338
- info.state = svc[:state]
339
- info.latency = svc[:latency]
340
- info.remote = svc[:remote]
341
- info.local = svc[:local]
342
- info.error = svc[:error]
329
+ @observability.record_operation(Observability::OP_PING, options.parent_span, self) do |_obs_handler|
330
+ resp = @backend.ping(nil, options.to_backend)
331
+ PingResult.new do |res|
332
+ res.version = resp[:version]
333
+ res.id = resp[:id]
334
+ res.sdk = resp[:sdk]
335
+ resp[:services].each do |type, svcs|
336
+ res.services[type] = svcs.map do |svc|
337
+ PingResult::ServiceInfo.new do |info|
338
+ info.id = svc[:id]
339
+ info.state = svc[:state]
340
+ info.latency = svc[:latency]
341
+ info.remote = svc[:remote]
342
+ info.local = svc[:local]
343
+ info.error = svc[:error]
344
+ end
343
345
  end
344
346
  end
345
347
  end
@@ -1919,20 +1919,25 @@ module Couchbase
1919
1919
  attr_accessor :report_id # @return [String]
1920
1920
  attr_accessor :service_types # @return [Array<Symbol>]
1921
1921
  attr_accessor :timeout # @return [Integer, #in_milliseconds]
1922
+ attr_accessor :parent_span # @return [Span, nil]
1922
1923
 
1923
1924
  # Creates an instance of options for {Couchbase::Bucket#ping}
1924
1925
  #
1925
1926
  # @param [String] report_id Holds custom report id.
1926
- # @@param [Array<Symbol>] service_types The service types to limit this diagnostics request
1927
+ # @param [Array<Symbol>] service_types The service types to limit this ping request
1927
1928
  # @param [Integer, #in_milliseconds] timeout
1929
+ # @param [Span, nil] parent_span if set holds the parent span, that should be used for this request
1928
1930
  #
1929
1931
  # @yieldparam [Ping] self
1930
1932
  def initialize(report_id: nil,
1931
1933
  service_types: [:kv, :query, :analytics, :search, :views, :management],
1932
- timeout: nil)
1934
+ timeout: nil,
1935
+ parent_span: nil)
1933
1936
  @report_id = report_id
1934
1937
  @service_types = service_types
1935
1938
  @timeout = timeout
1939
+ @parent_span = parent_span
1940
+
1936
1941
  yield self if block_given?
1937
1942
  end
1938
1943
 
@@ -21,5 +21,5 @@ module Couchbase
21
21
  # $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
22
22
  # {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
23
23
  VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
24
- VERSION.update(:sdk => "3.8.1")
24
+ VERSION.update(:sdk => "3.8.2")
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.1
4
+ version: 3.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Avseyev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-01 00:00:00.000000000 Z
11
+ date: 2026-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -2584,6 +2584,7 @@ files:
2584
2584
  - ext/couchbase/core/impl/with_legacy_durability.hxx
2585
2585
  - ext/couchbase/core/io/config_tracker.cxx
2586
2586
  - ext/couchbase/core/io/config_tracker.hxx
2587
+ - ext/couchbase/core/io/configuration_belongs_to_session.hxx
2587
2588
  - ext/couchbase/core/io/dns_client.cxx
2588
2589
  - ext/couchbase/core/io/dns_client.hxx
2589
2590
  - ext/couchbase/core/io/dns_codec.hxx
@@ -3670,9 +3671,9 @@ metadata:
3670
3671
  homepage_uri: https://docs.couchbase.com/ruby-sdk/current/hello-world/start-using-sdk.html
3671
3672
  bug_tracker_uri: https://jira.issues.couchbase.com/browse/RCBC
3672
3673
  mailing_list_uri: https://www.couchbase.com/forums/c/ruby-sdk
3673
- source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.8.1
3674
- changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.8.1
3675
- documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.8.1/index.html
3674
+ source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.8.2
3675
+ changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.8.2
3676
+ documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.8.2/index.html
3676
3677
  github_repo: https://github.com/couchbase/couchbase-ruby-client
3677
3678
  rubygems_mfa_required: 'true'
3678
3679
  post_install_message: