@nxtedition/rocksdb 7.0.57 → 7.0.60
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.
|
@@ -366,7 +366,7 @@ Status WalManager::RetainProbableWalFiles(VectorLogPtr& all_logs,
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
// end could be -ve.
|
|
369
|
-
size_t start_index = static_cast<size_t>(std::max(static_cast<int64_t>(0), end
|
|
369
|
+
size_t start_index = static_cast<size_t>(std::max(static_cast<int64_t>(0), end));
|
|
370
370
|
// The last wal file is always included
|
|
371
371
|
all_logs.erase(all_logs.begin(), all_logs.begin() + start_index);
|
|
372
372
|
return Status::OK();
|
package/index.js
CHANGED
|
@@ -341,14 +341,19 @@ class RocksLevel extends AbstractLevel {
|
|
|
341
341
|
options.signal?.addEventListener('abort', onAbort)
|
|
342
342
|
this.on('closing', onAbort)
|
|
343
343
|
|
|
344
|
+
const db = this
|
|
345
|
+
|
|
344
346
|
// HACK: https://github.com/facebook/rocksdb/issues/10476
|
|
345
347
|
async function* _updates (options) {
|
|
346
348
|
let first = true
|
|
347
|
-
for await (const update of
|
|
349
|
+
for await (const update of db[kUpdates](options)) {
|
|
348
350
|
if (first) {
|
|
349
351
|
if (update.sequence > options.since) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
// HACK
|
|
353
|
+
db.emit('warning', `Invalid update sequence ${update.sequence} > ${options.since}. Starting from 0.`)
|
|
354
|
+
for await (const update of db[kUpdates]({ ...options, since: 0 })) {
|
|
355
|
+
yield update
|
|
356
|
+
}
|
|
352
357
|
break
|
|
353
358
|
} else {
|
|
354
359
|
first = false
|
|
@@ -356,18 +361,10 @@ class RocksLevel extends AbstractLevel {
|
|
|
356
361
|
}
|
|
357
362
|
yield update
|
|
358
363
|
}
|
|
359
|
-
|
|
360
|
-
if (first === null) {
|
|
361
|
-
for await (const update of this[kUpdates]({ ...options, since: 0 })) {
|
|
362
|
-
yield update
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
364
|
}
|
|
366
365
|
|
|
367
366
|
try {
|
|
368
367
|
let since = options.since
|
|
369
|
-
|
|
370
|
-
const db = this
|
|
371
368
|
while (true) {
|
|
372
369
|
const buffer = new Readable({
|
|
373
370
|
signal: ac.signal,
|
|
@@ -399,7 +396,7 @@ class RocksLevel extends AbstractLevel {
|
|
|
399
396
|
}
|
|
400
397
|
|
|
401
398
|
try {
|
|
402
|
-
if (since <=
|
|
399
|
+
if (since <= db.sequence) {
|
|
403
400
|
for await (const update of _updates(options)) {
|
|
404
401
|
if (ac.signal.aborted) {
|
|
405
402
|
throw new AbortError()
|
|
@@ -421,7 +418,16 @@ class RocksLevel extends AbstractLevel {
|
|
|
421
418
|
return
|
|
422
419
|
}
|
|
423
420
|
|
|
421
|
+
let first = true
|
|
424
422
|
for await (const update of buffer) {
|
|
423
|
+
if (first) {
|
|
424
|
+
if (update.sequence > since) {
|
|
425
|
+
// HACK
|
|
426
|
+
db.emit('warning', `Invalid batch sequence. Restarting.`)
|
|
427
|
+
break
|
|
428
|
+
}
|
|
429
|
+
first = false
|
|
430
|
+
}
|
|
425
431
|
if (update.sequence >= since) {
|
|
426
432
|
yield update
|
|
427
433
|
since = update.sequence + update.count
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|