couchbase 4.7.0 → 4.7.1
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/deps/couchbase-cxx-cache/mozilla-ca-bundle.crt +3 -575
- package/deps/couchbase-cxx-cache/mozilla-ca-bundle.sha256 +1 -1
- package/deps/couchbase-cxx-client/CMakeLists.txt +3 -1
- package/deps/couchbase-cxx-client/README.md +2 -2
- package/deps/couchbase-cxx-client/core/error_context/base_error_context.hxx +32 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +1 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +23 -0
- package/deps/couchbase-cxx-client/core/error_context/key_value_error_context.hxx +35 -0
- package/deps/couchbase-cxx-client/core/error_context/subdocument_error_context.hxx +41 -0
- package/deps/couchbase-cxx-client/core/impl/binary_collection.cxx +123 -88
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +416 -189
- package/deps/couchbase-cxx-client/core/impl/error.cxx +29 -4
- package/deps/couchbase-cxx-client/core/impl/invoke_with_node_id.hxx +44 -0
- package/deps/couchbase-cxx-client/core/impl/node_id.cxx +110 -0
- package/deps/couchbase-cxx-client/core/impl/node_id.hxx +40 -0
- package/deps/couchbase-cxx-client/core/io/configuration_belongs_to_session.hxx +67 -0
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +97 -57
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +7 -16
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +14 -4
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +3 -4
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +4 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +12 -12
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +11 -11
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +11 -11
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +11 -11
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +9 -6
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +5 -4
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +7 -6
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +12 -13
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +8 -9
- package/deps/couchbase-cxx-client/core/topology/configuration.cxx +21 -0
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +28 -0
- package/deps/couchbase-cxx-client/core/utils/contains_string.cxx +61 -0
- package/deps/couchbase-cxx-client/core/utils/contains_string.hxx +26 -0
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +73 -0
- package/deps/couchbase-cxx-client/couchbase/error.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/node_id.hxx +123 -0
- package/deps/couchbase-cxx-client/couchbase/node_id_for_options.hxx +61 -0
- package/deps/couchbase-cxx-client/couchbase/node_ids_options.hxx +62 -0
- package/deps/couchbase-cxx-client/couchbase/result.hxx +42 -0
- package/dist/binding.d.ts +1 -0
- package/dist/bucket.d.ts +9 -1
- package/dist/bucket.js +21 -0
- package/dist/cluster.d.ts +10 -1
- package/dist/cluster.js +22 -0
- package/dist/collection.d.ts +3 -3
- package/dist/collection.js +161 -123
- package/dist/diagnosticsexecutor.js +2 -2
- package/dist/diagnosticstypes.d.ts +36 -0
- package/dist/diagnosticstypes.js +22 -1
- package/dist/observability.d.ts +5 -1
- package/dist/observability.js +11 -3
- package/dist/observabilityhandler.d.ts +6 -0
- package/dist/observabilityhandler.js +51 -14
- package/dist/observabilitytypes.js +19 -42
- package/dist/observabilityutilities.js +1 -1
- package/dist/oteltracer.d.ts +5 -0
- package/dist/oteltracer.js +7 -0
- package/dist/queryindexmanager.js +15 -0
- package/dist/thresholdlogging.d.ts +5 -0
- package/dist/thresholdlogging.js +7 -0
- package/dist/tracing.d.ts +6 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/waituntilreadyexecutor.d.ts +37 -0
- package/dist/waituntilreadyexecutor.js +156 -0
- package/package.json +8 -8
- package/scripts/prebuilds.js +13 -0
- package/src/binding.cpp +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WaitUntilReadyExecutor = void 0;
|
|
4
|
+
const diagnosticsexecutor_1 = require("./diagnosticsexecutor");
|
|
5
|
+
const diagnosticstypes_1 = require("./diagnosticstypes");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
const generaltypes_1 = require("./generaltypes");
|
|
8
|
+
const utilities_1 = require("./utilities");
|
|
9
|
+
const ALL_SERVICE_TYPES = Object.values(generaltypes_1.ServiceType);
|
|
10
|
+
const BACKOFF_BASE_MS = 50;
|
|
11
|
+
const BACKOFF_CAP_MS = 500;
|
|
12
|
+
const BACKOFF_MAX_EXP = 4;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
class WaitUntilReadyExecutor {
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
constructor(cluster, bucketName) {
|
|
21
|
+
this._cluster = cluster;
|
|
22
|
+
this._bucketName = bucketName;
|
|
23
|
+
this._diagExec = new diagnosticsexecutor_1.DiagnoticsExecutor(cluster);
|
|
24
|
+
this._pingExec = new diagnosticsexecutor_1.PingExecutor(cluster);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks whether the endpoints for a single service satisfy the desired cluster state.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
_meetsDesiredState(endpoints, desiredState) {
|
|
32
|
+
if (endpoints.length === 0) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const connected = endpoints.filter((ep) => ep.state === diagnosticstypes_1.EndpointState.Connected).length;
|
|
36
|
+
if (desiredState === diagnosticstypes_1.ClusterState.Online) {
|
|
37
|
+
return connected === endpoints.length;
|
|
38
|
+
}
|
|
39
|
+
if (desiredState === diagnosticstypes_1.ClusterState.Degraded) {
|
|
40
|
+
return connected > 0;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Logs any ping endpoints that reported an error, at warn level.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
_logPingErrors(pingResult) {
|
|
50
|
+
for (const [serviceType, endpoints] of Object.entries(pingResult.services)) {
|
|
51
|
+
for (const ep of endpoints) {
|
|
52
|
+
if (ep.state === diagnosticstypes_1.PingState.Error && ep.error) {
|
|
53
|
+
this._cluster.logger.warn(`waitUntilReady: ping error on service ${serviceType}, remote ${ep.remote}: ${ep.error}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Builds the set of services to wait on, either from the user provided list or via discovery ping.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
async _resolveWaitSet(serviceTypes, deadline) {
|
|
64
|
+
let waitSet;
|
|
65
|
+
if (serviceTypes) {
|
|
66
|
+
waitSet = [...serviceTypes];
|
|
67
|
+
if (this._bucketName === undefined) {
|
|
68
|
+
const filtered = waitSet.filter((s) => s === generaltypes_1.ServiceType.KeyValue || s === generaltypes_1.ServiceType.Views);
|
|
69
|
+
if (filtered.length > 0) {
|
|
70
|
+
this._cluster.logger.warn(`waitUntilReady: ignoring [${filtered.join(', ')}] at cluster scope (no bucket context)`);
|
|
71
|
+
waitSet = waitSet.filter((s) => s !== generaltypes_1.ServiceType.KeyValue && s !== generaltypes_1.ServiceType.Views);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const discoveryResult = await this._pingExec.ping({
|
|
77
|
+
bucket: this._bucketName,
|
|
78
|
+
timeout: deadline.left(),
|
|
79
|
+
});
|
|
80
|
+
this._logPingErrors(discoveryResult);
|
|
81
|
+
waitSet = [];
|
|
82
|
+
for (const [serviceType, endpoints] of Object.entries(discoveryResult.services)) {
|
|
83
|
+
if (endpoints.length > 0) {
|
|
84
|
+
waitSet.push(serviceType);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return waitSet;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
async waitUntilReady(timeout, options) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
if (typeof timeout !== 'number' || !isFinite(timeout) || timeout <= 0) {
|
|
96
|
+
throw new errors_1.InvalidArgumentError(new Error('timeout must be a positive finite number'));
|
|
97
|
+
}
|
|
98
|
+
const desiredState = (_a = options.desiredState) !== null && _a !== void 0 ? _a : diagnosticstypes_1.ClusterState.Online;
|
|
99
|
+
if (desiredState === diagnosticstypes_1.ClusterState.Offline) {
|
|
100
|
+
throw new errors_1.InvalidArgumentError(new Error('ClusterState.Offline is not a valid desired state'));
|
|
101
|
+
}
|
|
102
|
+
if (options.serviceTypes) {
|
|
103
|
+
for (const st of options.serviceTypes) {
|
|
104
|
+
if (!ALL_SERVICE_TYPES.includes(st)) {
|
|
105
|
+
throw new errors_1.InvalidArgumentError(new Error(`Invalid service type: ${st}`));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (options.serviceTypes.length === 0) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const deadline = new utilities_1.CompoundTimeout(timeout);
|
|
113
|
+
const waitSet = await this._resolveWaitSet(options.serviceTypes, deadline);
|
|
114
|
+
if (waitSet.length === 0) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
let iterations = 0;
|
|
118
|
+
let needPing = [...waitSet];
|
|
119
|
+
while (true) {
|
|
120
|
+
const diagResult = await this._diagExec.diagnostics({});
|
|
121
|
+
needPing = [];
|
|
122
|
+
for (const svc of waitSet) {
|
|
123
|
+
const endpoints = diagResult.services[svc] || [];
|
|
124
|
+
if (!this._meetsDesiredState(endpoints, desiredState)) {
|
|
125
|
+
needPing.push(svc);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (needPing.length === 0) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (deadline.expired()) {
|
|
132
|
+
throw new errors_1.UnambiguousTimeoutError(new Error('Timed out prior to reaching desired state. ' +
|
|
133
|
+
'Services not ready: ' + needPing.join(', ')));
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const pingResult = await this._pingExec.ping({
|
|
137
|
+
serviceTypes: needPing,
|
|
138
|
+
bucket: this._bucketName,
|
|
139
|
+
timeout: deadline.left(),
|
|
140
|
+
});
|
|
141
|
+
this._logPingErrors(pingResult);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// One failed ping isn't fatal, try again or eventually time out after deadline is reached.
|
|
145
|
+
}
|
|
146
|
+
const backoffMs = Math.min(BACKOFF_BASE_MS * Math.pow(2, Math.min(iterations, BACKOFF_MAX_EXP)), BACKOFF_CAP_MS);
|
|
147
|
+
const timeLeft = (_b = deadline.left()) !== null && _b !== void 0 ? _b : 0;
|
|
148
|
+
const sleepMs = Math.min(backoffMs, timeLeft);
|
|
149
|
+
if (sleepMs > 0) {
|
|
150
|
+
await new Promise((resolve) => setTimeout(resolve, sleepMs));
|
|
151
|
+
}
|
|
152
|
+
iterations++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.WaitUntilReadyExecutor = WaitUntilReadyExecutor;
|
package/package.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"type": "git",
|
|
69
69
|
"url": "http://github.com/couchbase/couchnode.git"
|
|
70
70
|
},
|
|
71
|
-
"version": "4.7.
|
|
71
|
+
"version": "4.7.1",
|
|
72
72
|
"config": {
|
|
73
73
|
"native": false
|
|
74
74
|
},
|
|
@@ -166,12 +166,12 @@
|
|
|
166
166
|
"deps/couchbase-cxx-cache/mozilla-ca-bundle.*"
|
|
167
167
|
],
|
|
168
168
|
"optionalDependencies": {
|
|
169
|
-
"@couchbase/couchbase-darwin-arm64-napi": "4.7.
|
|
170
|
-
"@couchbase/couchbase-darwin-x64-napi": "4.7.
|
|
171
|
-
"@couchbase/couchbase-linux-arm64-napi": "4.7.
|
|
172
|
-
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.7.
|
|
173
|
-
"@couchbase/couchbase-linuxmusl-x64-napi": "4.7.
|
|
174
|
-
"@couchbase/couchbase-linux-x64-napi": "4.7.
|
|
175
|
-
"@couchbase/couchbase-win32-x64-napi": "4.7.
|
|
169
|
+
"@couchbase/couchbase-darwin-arm64-napi": "4.7.1",
|
|
170
|
+
"@couchbase/couchbase-darwin-x64-napi": "4.7.1",
|
|
171
|
+
"@couchbase/couchbase-linux-arm64-napi": "4.7.1",
|
|
172
|
+
"@couchbase/couchbase-linuxmusl-arm64-napi": "4.7.1",
|
|
173
|
+
"@couchbase/couchbase-linuxmusl-x64-napi": "4.7.1",
|
|
174
|
+
"@couchbase/couchbase-linux-x64-napi": "4.7.1",
|
|
175
|
+
"@couchbase/couchbase-win32-x64-napi": "4.7.1"
|
|
176
176
|
}
|
|
177
177
|
}
|
package/scripts/prebuilds.js
CHANGED
|
@@ -100,6 +100,19 @@ function buildBinary(
|
|
|
100
100
|
cmakejsBuildCmd.push(...['--config', `${buildConfig}`])
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
const sanitizers = process.env.CN_SANITIZERS
|
|
104
|
+
if (sanitizers && sanitizers.length > 0) {
|
|
105
|
+
for (const sanitizer of sanitizers.split(',')) {
|
|
106
|
+
if (
|
|
107
|
+
['address', 'thread', 'undefined', 'memory', 'leak'].includes(
|
|
108
|
+
sanitizer
|
|
109
|
+
)
|
|
110
|
+
) {
|
|
111
|
+
cmakejsBuildCmd.push(`--CDENABLE_SANITIZER_${sanitizer.toUpperCase()}=ON`)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
103
116
|
const cmakeGeneratorPlatform = process.env.CN_CMAKE_GENERATOR_PLATFORM
|
|
104
117
|
if (cmakeGeneratorPlatform) {
|
|
105
118
|
cmakejsBuildCmd.push(`--generator=${cmakeGeneratorPlatform}`)
|
package/src/binding.cpp
CHANGED
|
@@ -51,7 +51,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|
|
51
51
|
cbppLogLevel = couchbase::core::logger::level::info;
|
|
52
52
|
} else if (logLevelStr == "warn") {
|
|
53
53
|
cbppLogLevel = couchbase::core::logger::level::warn;
|
|
54
|
-
} else if (logLevelStr == "err") {
|
|
54
|
+
} else if (logLevelStr == "err" || logLevelStr == "error") {
|
|
55
55
|
cbppLogLevel = couchbase::core::logger::level::err;
|
|
56
56
|
} else if (logLevelStr == "critical") {
|
|
57
57
|
cbppLogLevel = couchbase::core::logger::level::critical;
|