@nxtedition/rocksdb 8.1.1 → 8.1.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.
- package/BUILDING.md +2 -2
- package/deps/rocksdb/rocksdb/db/c.cc +9 -0
- package/deps/rocksdb/rocksdb/db/c_test.c +3 -0
- package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +2 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +31 -32
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.h +2 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +4 -2
- package/deps/rocksdb/rocksdb/include/rocksdb/c.h +4 -0
- package/max_rev_operator.h +8 -2
- package/package.json +1 -1
- package/prebuilds/linux-x64/node.napi.node +0 -0
package/BUILDING.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
- Copy `libfolly.a` to `/usr/lib/x86_64-linux-gnu`.
|
|
11
11
|
- Copy headers to `/usr/lib/x86_64-linux-gnu/include`.
|
|
12
12
|
- Copy boost headers from folly scratchpad to `/usr/lib/x86_64-linux-gnu/include`.
|
|
13
|
-
- `
|
|
13
|
+
- `JOBS=16 npx prebuildify -t 18.11.0 --napi --strip --arch x64`
|
|
14
14
|
|
|
15
15
|
# OSX
|
|
16
16
|
|
|
17
17
|
- `brew install zstd`
|
|
18
|
-
- `
|
|
18
|
+
- `JOBS=16 npx prebuildify -t 18.11.0 --napi --strip --arch arm64`
|
|
@@ -4449,6 +4449,15 @@ rocksdb_readoptions_get_io_timeout(rocksdb_readoptions_t* opt) {
|
|
|
4449
4449
|
return opt->rep.io_timeout.count();
|
|
4450
4450
|
}
|
|
4451
4451
|
|
|
4452
|
+
void rocksdb_readoptions_set_async_io(rocksdb_readoptions_t* opt,
|
|
4453
|
+
unsigned char v) {
|
|
4454
|
+
opt->rep.async_io = v;
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4457
|
+
unsigned char rocksdb_readoptions_get_async_io(rocksdb_readoptions_t* opt) {
|
|
4458
|
+
return opt->rep.async_io;
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4452
4461
|
void rocksdb_readoptions_set_timestamp(rocksdb_readoptions_t* opt,
|
|
4453
4462
|
const char* ts, size_t tslen) {
|
|
4454
4463
|
if (ts == nullptr) {
|
|
@@ -2572,6 +2572,9 @@ int main(int argc, char** argv) {
|
|
|
2572
2572
|
rocksdb_readoptions_set_io_timeout(ro, 400);
|
|
2573
2573
|
CheckCondition(400 == rocksdb_readoptions_get_io_timeout(ro));
|
|
2574
2574
|
|
|
2575
|
+
rocksdb_readoptions_set_async_io(ro, 1);
|
|
2576
|
+
CheckCondition(1 == rocksdb_readoptions_get_async_io(ro));
|
|
2577
|
+
|
|
2575
2578
|
rocksdb_readoptions_destroy(ro);
|
|
2576
2579
|
}
|
|
2577
2580
|
|
|
@@ -694,6 +694,7 @@ TEST_P(ExternalSSTFileBasicTest, IngestFileWithGlobalSeqnoPickedSeqno) {
|
|
|
694
694
|
bool verify_checksums_before_ingest = std::get<1>(GetParam());
|
|
695
695
|
do {
|
|
696
696
|
Options options = CurrentOptions();
|
|
697
|
+
options.disable_auto_compactions = true;
|
|
697
698
|
DestroyAndReopen(options);
|
|
698
699
|
std::map<std::string, std::string> true_data;
|
|
699
700
|
|
|
@@ -928,6 +929,7 @@ TEST_P(ExternalSSTFileBasicTest, IngestFileWithMixedValueType) {
|
|
|
928
929
|
bool verify_checksums_before_ingest = std::get<1>(GetParam());
|
|
929
930
|
do {
|
|
930
931
|
Options options = CurrentOptions();
|
|
932
|
+
options.disable_auto_compactions = true;
|
|
931
933
|
options.merge_operator.reset(new TestPutOperator());
|
|
932
934
|
DestroyAndReopen(options);
|
|
933
935
|
std::map<std::string, std::string> true_data;
|
|
@@ -56,12 +56,11 @@ void ThreadBody(void* v) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
bool RunStressTest(
|
|
59
|
+
bool RunStressTest(SharedState* shared) {
|
|
60
60
|
SystemClock* clock = db_stress_env->GetSystemClock().get();
|
|
61
|
+
StressTest* stress = shared->GetStressTest();
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (shared.ShouldVerifyAtBeginning() && FLAGS_preserve_unverified_changes) {
|
|
63
|
+
if (shared->ShouldVerifyAtBeginning() && FLAGS_preserve_unverified_changes) {
|
|
65
64
|
Status s = InitUnverifiedSubdir(FLAGS_db);
|
|
66
65
|
if (s.ok() && !FLAGS_expected_values_dir.empty()) {
|
|
67
66
|
s = InitUnverifiedSubdir(FLAGS_expected_values_dir);
|
|
@@ -73,8 +72,8 @@ bool RunStressTest(StressTest* stress) {
|
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
stress->InitDb(
|
|
77
|
-
stress->FinishInitDb(
|
|
75
|
+
stress->InitDb(shared);
|
|
76
|
+
stress->FinishInitDb(shared);
|
|
78
77
|
|
|
79
78
|
if (FLAGS_sync_fault_injection) {
|
|
80
79
|
fault_fs_guard->SetFilesystemDirectWritable(false);
|
|
@@ -88,28 +87,28 @@ bool RunStressTest(StressTest* stress) {
|
|
|
88
87
|
fprintf(stdout, "%s Initializing worker threads\n",
|
|
89
88
|
clock->TimeToString(now / 1000000).c_str());
|
|
90
89
|
|
|
91
|
-
shared
|
|
90
|
+
shared->SetThreads(n);
|
|
92
91
|
|
|
93
92
|
if (FLAGS_compaction_thread_pool_adjust_interval > 0) {
|
|
94
|
-
shared
|
|
93
|
+
shared->IncBgThreads();
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
if (FLAGS_continuous_verification_interval > 0) {
|
|
98
|
-
shared
|
|
97
|
+
shared->IncBgThreads();
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
std::vector<ThreadState*> threads(n);
|
|
102
101
|
for (uint32_t i = 0; i < n; i++) {
|
|
103
|
-
threads[i] = new ThreadState(i,
|
|
102
|
+
threads[i] = new ThreadState(i, shared);
|
|
104
103
|
db_stress_env->StartThread(ThreadBody, threads[i]);
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
ThreadState bg_thread(0,
|
|
106
|
+
ThreadState bg_thread(0, shared);
|
|
108
107
|
if (FLAGS_compaction_thread_pool_adjust_interval > 0) {
|
|
109
108
|
db_stress_env->StartThread(PoolSizeChangeThread, &bg_thread);
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
ThreadState continuous_verification_thread(0,
|
|
111
|
+
ThreadState continuous_verification_thread(0, shared);
|
|
113
112
|
if (FLAGS_continuous_verification_interval > 0) {
|
|
114
113
|
db_stress_env->StartThread(DbVerificationThread,
|
|
115
114
|
&continuous_verification_thread);
|
|
@@ -120,12 +119,12 @@ bool RunStressTest(StressTest* stress) {
|
|
|
120
119
|
// wait for others to operate -> verify -> done
|
|
121
120
|
|
|
122
121
|
{
|
|
123
|
-
MutexLock l(shared
|
|
124
|
-
while (!shared
|
|
125
|
-
shared
|
|
122
|
+
MutexLock l(shared->GetMutex());
|
|
123
|
+
while (!shared->AllInitialized()) {
|
|
124
|
+
shared->GetCondVar()->Wait();
|
|
126
125
|
}
|
|
127
|
-
if (shared
|
|
128
|
-
if (shared
|
|
126
|
+
if (shared->ShouldVerifyAtBeginning()) {
|
|
127
|
+
if (shared->HasVerificationFailedYet()) {
|
|
129
128
|
fprintf(stderr, "Crash-recovery verification failed :(\n");
|
|
130
129
|
} else {
|
|
131
130
|
fprintf(stdout, "Crash-recovery verification passed :)\n");
|
|
@@ -144,17 +143,17 @@ bool RunStressTest(StressTest* stress) {
|
|
|
144
143
|
// This is after the verification step to avoid making all those `Get()`s
|
|
145
144
|
// and `MultiGet()`s contend on the DB-wide trace mutex.
|
|
146
145
|
if (!FLAGS_expected_values_dir.empty()) {
|
|
147
|
-
stress->TrackExpectedState(
|
|
146
|
+
stress->TrackExpectedState(shared);
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
now = clock->NowMicros();
|
|
151
150
|
fprintf(stdout, "%s Starting database operations\n",
|
|
152
151
|
clock->TimeToString(now / 1000000).c_str());
|
|
153
152
|
|
|
154
|
-
shared
|
|
155
|
-
shared
|
|
156
|
-
while (!shared
|
|
157
|
-
shared
|
|
153
|
+
shared->SetStart();
|
|
154
|
+
shared->GetCondVar()->SignalAll();
|
|
155
|
+
while (!shared->AllOperated()) {
|
|
156
|
+
shared->GetCondVar()->Wait();
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
now = clock->NowMicros();
|
|
@@ -169,10 +168,10 @@ bool RunStressTest(StressTest* stress) {
|
|
|
169
168
|
clock->TimeToString((uint64_t)now / 1000000).c_str());
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
shared
|
|
173
|
-
shared
|
|
174
|
-
while (!shared
|
|
175
|
-
shared
|
|
171
|
+
shared->SetStartVerify();
|
|
172
|
+
shared->GetCondVar()->SignalAll();
|
|
173
|
+
while (!shared->AllDone()) {
|
|
174
|
+
shared->GetCondVar()->Wait();
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
177
|
|
|
@@ -187,7 +186,7 @@ bool RunStressTest(StressTest* stress) {
|
|
|
187
186
|
}
|
|
188
187
|
now = clock->NowMicros();
|
|
189
188
|
if (!FLAGS_skip_verifydb && !FLAGS_test_batches_snapshots &&
|
|
190
|
-
!shared
|
|
189
|
+
!shared->HasVerificationFailedYet()) {
|
|
191
190
|
fprintf(stdout, "%s Verification successful\n",
|
|
192
191
|
clock->TimeToString(now / 1000000).c_str());
|
|
193
192
|
}
|
|
@@ -195,14 +194,14 @@ bool RunStressTest(StressTest* stress) {
|
|
|
195
194
|
|
|
196
195
|
if (FLAGS_compaction_thread_pool_adjust_interval > 0 ||
|
|
197
196
|
FLAGS_continuous_verification_interval > 0) {
|
|
198
|
-
MutexLock l(shared
|
|
199
|
-
shared
|
|
200
|
-
while (!shared
|
|
201
|
-
shared
|
|
197
|
+
MutexLock l(shared->GetMutex());
|
|
198
|
+
shared->SetShouldStopBgThread();
|
|
199
|
+
while (!shared->BgThreadsFinished()) {
|
|
200
|
+
shared->GetCondVar()->Wait();
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
|
|
205
|
-
if (shared
|
|
204
|
+
if (shared->HasVerificationFailedYet()) {
|
|
206
205
|
fprintf(stderr, "Verification failed :(\n");
|
|
207
206
|
return false;
|
|
208
207
|
}
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
// Use of this source code is governed by a BSD-style license that can be
|
|
8
8
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
9
9
|
|
|
10
|
+
#include "db_stress_tool/db_stress_shared_state.h"
|
|
10
11
|
#ifdef GFLAGS
|
|
11
12
|
#pragma once
|
|
12
13
|
#include "db_stress_tool/db_stress_test_base.h"
|
|
13
14
|
namespace ROCKSDB_NAMESPACE {
|
|
14
15
|
extern void ThreadBody(void* /*thread_state*/);
|
|
15
|
-
extern bool RunStressTest(
|
|
16
|
+
extern bool RunStressTest(SharedState*);
|
|
16
17
|
} // namespace ROCKSDB_NAMESPACE
|
|
17
18
|
#endif // GFLAGS
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// NOTE that if FLAGS_test_batches_snapshots is set, the test will have
|
|
21
21
|
// different behavior. See comment of the flag for details.
|
|
22
22
|
|
|
23
|
+
#include "db_stress_tool/db_stress_shared_state.h"
|
|
23
24
|
#ifdef GFLAGS
|
|
24
25
|
#include "db_stress_tool/db_stress_common.h"
|
|
25
26
|
#include "db_stress_tool/db_stress_driver.h"
|
|
@@ -340,7 +341,7 @@ int db_stress_tool(int argc, char** argv) {
|
|
|
340
341
|
key_gen_ctx.weights.emplace_back(key_gen_ctx.window -
|
|
341
342
|
keys_per_level * (levels - 1));
|
|
342
343
|
}
|
|
343
|
-
|
|
344
|
+
std::unique_ptr<ROCKSDB_NAMESPACE::SharedState> shared;
|
|
344
345
|
std::unique_ptr<ROCKSDB_NAMESPACE::StressTest> stress;
|
|
345
346
|
if (FLAGS_test_cf_consistency) {
|
|
346
347
|
stress.reset(CreateCfConsistencyStressTest());
|
|
@@ -353,7 +354,8 @@ int db_stress_tool(int argc, char** argv) {
|
|
|
353
354
|
}
|
|
354
355
|
// Initialize the Zipfian pre-calculated array
|
|
355
356
|
InitializeHotKeyGenerator(FLAGS_hot_key_alpha);
|
|
356
|
-
|
|
357
|
+
shared.reset(new SharedState(db_stress_env, stress.get()));
|
|
358
|
+
if (RunStressTest(shared.get())) {
|
|
357
359
|
return 0;
|
|
358
360
|
} else {
|
|
359
361
|
return 1;
|
|
@@ -1894,6 +1894,10 @@ extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_io_timeout(
|
|
|
1894
1894
|
rocksdb_readoptions_t*, uint64_t microseconds);
|
|
1895
1895
|
extern ROCKSDB_LIBRARY_API uint64_t
|
|
1896
1896
|
rocksdb_readoptions_get_io_timeout(rocksdb_readoptions_t*);
|
|
1897
|
+
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_async_io(
|
|
1898
|
+
rocksdb_readoptions_t*, unsigned char);
|
|
1899
|
+
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_readoptions_get_async_io(
|
|
1900
|
+
rocksdb_readoptions_t*);
|
|
1897
1901
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_timestamp(
|
|
1898
1902
|
rocksdb_readoptions_t*, const char* ts, size_t tslen);
|
|
1899
1903
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_iter_start_ts(
|
package/max_rev_operator.h
CHANGED
|
@@ -5,10 +5,16 @@
|
|
|
5
5
|
#include <rocksdb/merge_operator.h>
|
|
6
6
|
|
|
7
7
|
int compareRev(const rocksdb::Slice& a, const rocksdb::Slice& b) {
|
|
8
|
+
if (a.empty()) {
|
|
9
|
+
return b.empty() ? 0 : -1;
|
|
10
|
+
} else if (b.empty()) {
|
|
11
|
+
return 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
std::size_t indexA = 0;
|
|
9
15
|
std::size_t indexB = 0;
|
|
10
|
-
const std::size_t endA = a[indexA++];
|
|
11
|
-
const std::size_t endB = b[indexB++];
|
|
16
|
+
const std::size_t endA = std::min<std::size_t>(a[indexA++], a.size());
|
|
17
|
+
const std::size_t endB = std::min<std::size_t>(b[indexB++], b.size());
|
|
12
18
|
|
|
13
19
|
// Compare the revision number
|
|
14
20
|
auto result = 0;
|
package/package.json
CHANGED
|
Binary file
|