10000 don't make RocksDB startup fail with 0-byte log files (#9208) · reynoldsm88/arangodb@091abbe · GitHub
[go: up one dir, main page]

Skip to content

Commit 091abbe

Browse files
jsteemannfceller
authored andcommitted
don't make RocksDB startup fail with 0-byte log files (arangodb#9208)
1 parent d1a6d23 commit 091abbe

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

3rdParty/rocksdb/6.2/env/env_encryption.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,16 @@ Status CTREncryptionProvider::CreateCipherStream(
895895

896896
// If the prefix is smaller than twice the block size, we would below read a
897897
// very large chunk of the file (and very likely read over the bounds)
898-
assert(prefix.size() >= 2 * blockSize);
899898
if (prefix.size() < 2 * blockSize) {
899+
if (prefix.size() == 0) {
900+
return CreateCipherStreamFromPrefix(fname, options, 0, rocksdb::Slice(), prefix, result);
901+
}
902+
900903
return Status::Corruption("Unable to read from file " + fname +
901904
": read attempt would read beyond file bounds");
902905
}
906+
907+
assert(prefix.size() >= 2 * blockSize);
903908

904909
// Decrypt the encrypted part of the prefix, starting from block 2 (block 0, 1 with initial counter & IV are unencrypted)
905910
CTRCipherStream cipherStream(cipher_, iv.data(), initialCounter);

js/client/modules/@arangodb/testsuites/recovery.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ const testPaths = {
5151
// //////////////////////////////////////////////////////////////////////////////
5252

5353
function runArangodRecovery (params) {
54+
let useEncryption = false;
55+
56+
if (params && params.options.storageEngine === 'rocksdb' && global.ARANGODB_CLIENT_VERSION) {
57+
let version = global.ARANGODB_CLIENT_VERSION(true);
58+
if (version.hasOwnProperty('enterprise-version')) {
59+
useEncryption = true;
60+
}
61+
}
62+
5463
let argv = [];
5564

5665
let binary = pu.ARANGOD_BIN;
@@ -81,6 +90,11 @@ function runArangodRecovery (params) {
8190
'replication.auto-start': 'true',
8291
'javascript.script': params.script
8392
});
93+
94+
if (useEncryption) {
95+
args['rocksdb.encryption-keyfile'] = tu.pathForTesting('server/recovery/encryption-keyfile');
96+
}
97+
8498
params.args = args;
8599

86100
argv = toArgv(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
01234567890123456789012345678901

0 commit comments

Comments
 (0)
0