Search in sources :

Example 1 with LogConfig

use of jetbrains.exodus.log.LogConfig in project xodus by JetBrains.

the class LogRecoveryTest method cutAndCheckLastLoggableIncomplete.

private void cutAndCheckLastLoggableIncomplete(int cutSize, int max) {
    openStoreAutoCommit("new_store", StoreConfig.WITHOUT_DUPLICATES);
    /*final Iterator<Loggable> itr = getLog().getLoggablesIterator(0);
        while (itr.hasNext()) {
            final Loggable next = itr.next();
            System.out.println(next.getType() + " @ " + next.getAddress());
        }*/
    assertLoggableTypes(getLog(), 0, seq);
    env.close();
    final StreamCipherProvider cipherProvider = env.getCipherProvider();
    final byte[] cipherKey = env.getCipherKey();
    final long cipherBasicIV = env.getCipherBasicIV();
    env = null;
    final long size = reader.getBlocks(0).iterator().next().length();
    writer.openOrCreateBlock(0, size - cutSize);
    writer.close();
    // only 'max' first loggables should remain
    final LogConfig config = LogConfig.create(reader, writer).setCipherProvider(cipherProvider).setCipherKey(cipherKey).setCipherBasicIV(cipherBasicIV);
    final Log newLog = Environments.newLogInstance(config);
    newLog.setHighAddress(newLog.getTip(), newLog.getTip().approvedHighAddress);
    assertLoggableTypes(max, newLog.getLoggableIterator(0), seq);
}
Also used : Log(jetbrains.exodus.log.Log) StreamCipherProvider(jetbrains.exodus.crypto.StreamCipherProvider) LogConfig(jetbrains.exodus.log.LogConfig)

Example 2 with LogConfig

use of jetbrains.exodus.log.LogConfig in project xodus by JetBrains.

the class TreeBaseTest method createLog.

private void createLog() {
    LogConfig config = createLogConfig();
    config.setLocation(tempFolder.getPath());
    log = Environments.newLogInstance(config);
}
Also used : LogConfig(jetbrains.exodus.log.LogConfig)

Example 3 with LogConfig

use of jetbrains.exodus.log.LogConfig in project xodus by JetBrains.

the class BTreeReclaimSpecialTest method createLogConfig.

@Override
protected LogConfig createLogConfig() {
    LogConfig result = super.createLogConfig();
    result.setFileSize(1);
    return result;
}
Also used : LogConfig(jetbrains.exodus.log.LogConfig)

Aggregations

LogConfig (jetbrains.exodus.log.LogConfig)3 StreamCipherProvider (jetbrains.exodus.crypto.StreamCipherProvider)1 Log (jetbrains.exodus.log.Log)1