mirror of https://gitee.com/bigwinds/arangodb
don't make RocksDB startup fail with 0-byte log files (#9208)
This commit is contained in:
parent
d1a6d23c36
commit
091abbec77
|
@ -895,11 +895,16 @@ Status CTREncryptionProvider::CreateCipherStream(
|
|||
|
||||
// If the prefix is smaller than twice the block size, we would below read a
|
||||
// very large chunk of the file (and very likely read over the bounds)
|
||||
assert(prefix.size() >= 2 * blockSize);
|
||||
if (prefix.size() < 2 * blockSize) {
|
||||
if (prefix.size() == 0) {
|
||||
return CreateCipherStreamFromPrefix(fname, options, 0, rocksdb::Slice(), prefix, result);
|
||||
}
|
||||
|
||||
return Status::Corruption("Unable to read from file " + fname +
|
||||
": read attempt would read beyond file bounds");
|
||||
}
|
||||
|
||||
assert(prefix.size() >= 2 * blockSize);
|
||||
|
||||
// Decrypt the encrypted part of the prefix, starting from block 2 (block 0, 1 with initial counter & IV are unencrypted)
|
||||
CTRCipherStream cipherStream(cipher_, iv.data(), initialCounter);
|
||||
|
|
|
@ -51,6 +51,15 @@ const testPaths = {
|
|||
// //////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function runArangodRecovery (params) {
|
||||
let useEncryption = false;
|
||||
|
||||
if (params && params.options.storageEngine === 'rocksdb' && global.ARANGODB_CLIENT_VERSION) {
|
||||
let version = global.ARANGODB_CLIENT_VERSION(true);
|
||||
if (version.hasOwnProperty('enterprise-version')) {
|
||||
useEncryption = true;
|
||||
}
|
||||
}
|
||||
|
||||
let argv = [];
|
||||
|
||||
let binary = pu.ARANGOD_BIN;
|
||||
|
@ -81,6 +90,11 @@ function runArangodRecovery (params) {
|
|||
'replication.auto-start': 'true',
|
||||
'javascript.script': params.script
|
||||
});
|
||||
|
||||
if (useEncryption) {
|
||||
args['rocksdb.encryption-keyfile'] = tu.pathForTesting('server/recovery/encryption-keyfile');
|
||||
}
|
||||
|
||||
params.args = args;
|
||||
|
||||
argv = toArgv(
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
01234567890123456789012345678901
|
Loading…
Reference in New Issue