本文整理汇总了Java中com.sleepycat.je.CheckpointConfig.setMinimizeRecoveryTime方法的典型用法代码示例。如果您正苦于以下问题:Java CheckpointConfig.setMinimizeRecoveryTime方法的具体用法?Java CheckpointConfig.setMinimizeRecoveryTime怎么用?Java CheckpointConfig.setMinimizeRecoveryTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.je.CheckpointConfig
的用法示例。
在下文中一共展示了CheckpointConfig.setMinimizeRecoveryTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupSplitData
import com.sleepycat.je.CheckpointConfig; //导入方法依赖的package包/类
private void setupSplitData(Database db)
throws DatabaseException {
setStepwiseStart();
int max = 12;
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
/* Populate a tree so it grows to 3 levels, then checkpoint. */
for (int i = 0; i < max; i ++) {
IntegerBinding.intToEntry(i*10, key);
IntegerBinding.intToEntry(i*10, data);
assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
}
CheckpointConfig ckptConfig = new CheckpointConfig();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"First sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Second sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Third sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Fourth sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Fifth sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Sync6");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"After sync");
/* Add a key to dirty the left hand branch. */
IntegerBinding.intToEntry(5, key);
IntegerBinding.intToEntry(5, data);
assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"After single key insert");
ckptConfig.setForce(true);
ckptConfig.setMinimizeRecoveryTime(true);
env.checkpoint(ckptConfig);
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"before split");
/* Add enough keys to split the right hand branch. */
for (int i = 51; i < 57; i ++) {
IntegerBinding.intToEntry(i, key);
IntegerBinding.intToEntry(i, data);
assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
}
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"after split");
}
示例2: doTestBinDelta
import com.sleepycat.je.CheckpointConfig; //导入方法依赖的package包/类
private void doTestBinDelta(boolean useDeltas)
throws Throwable {
createEnvAndDbs(1 << 20, false, NUM_DBS);
StatsConfig statsConfig = new StatsConfig();
statsConfig.setClear(true);
CheckpointConfig deltaConfig = new CheckpointConfig();
deltaConfig.setForce(true);
deltaConfig.setMinimizeRecoveryTime(!useDeltas);
try {
/*
* Insert 4 records (nodeMax is 6), checkpoint, then insert 1
* record. The 1 record insertion will qualify for a delta,
* because the threshold percentage is 25%, and 25% of 4 is 1.
*/
int numRecs = 4;
Hashtable expectedData = new Hashtable();
Transaction txn = env.beginTransaction(null, null);
insertData(txn, 0, numRecs, expectedData, 1, true, NUM_DBS);
env.checkpoint(forceConfig);
insertData(txn, numRecs+1, numRecs+2, expectedData,
1, true, NUM_DBS);
txn.commit();
/*
* If useDeltas is true, this next checkpoint will end up using a
* BINDelta to log the last inserted record. It will have
* practically nothing but the root in the checkpoint.
*/
EnvironmentStats stats = env.getStats(statsConfig);
env.checkpoint(deltaConfig);
stats = env.getStats(statsConfig);
if (useDeltas) {
assertTrue(stats.getNDeltaINFlush() > 0);
} else {
assertTrue(stats.getNDeltaINFlush() == 0);
}
/* Shutdown, recover from a checkpoint that uses BINDeltas. */
closeEnv();
recoverAndVerify(expectedData, NUM_DBS);
} catch (Throwable t) {
t.printStackTrace();
throw t;
}
}
示例3: setupSplitData
import com.sleepycat.je.CheckpointConfig; //导入方法依赖的package包/类
private void setupSplitData(Database db)
throws DatabaseException {
setStepwiseStart();
int max = 12;
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
/* Populate a tree so it grows to 3 levels, then checkpoint. */
for (int i = 0; i < max; i ++) {
IntegerBinding.intToEntry(i*10, key);
IntegerBinding.intToEntry(i*10, data);
assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
}
CheckpointConfig ckptConfig = new CheckpointConfig();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"First sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Second sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Third sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Fourth sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Fifth sync");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"Sync6");
env.sync();
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"After sync");
/* Add a key to dirty the left hand branch. */
IntegerBinding.intToEntry(5, key);
IntegerBinding.intToEntry(5, data);
assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"After single key insert");
ckptConfig.setForce(true);
ckptConfig.setMinimizeRecoveryTime(true);
env.checkpoint(ckptConfig);
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"before split");
/* Add enough keys to split the right hand branch. */
for (int i = 51; i < 57; i ++) {
IntegerBinding.intToEntry(i, key);
IntegerBinding.intToEntry(i, data);
assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
}
Tracer.trace(Level.SEVERE, DbInternal.envGetEnvironmentImpl(env),
"after split");
}
示例4: doTestBinDelta
import com.sleepycat.je.CheckpointConfig; //导入方法依赖的package包/类
private void doTestBinDelta(boolean useDeltas)
throws Throwable {
createEnvAndDbs(1 << 20, false, NUM_DBS);
StatsConfig statsConfig = new StatsConfig();
statsConfig.setClear(true);
CheckpointConfig deltaConfig = new CheckpointConfig();
deltaConfig.setForce(true);
deltaConfig.setMinimizeRecoveryTime(!useDeltas);
try {
/*
* Insert 4 records (nodeMax is 6), checkpoint, then insert 1
* record. The 1 record insertion will qualify for a delta,
* because the threshold percentage is 25%, and 25% of 4 is 1.
*/
int numRecs = 4;
Hashtable expectedData = new Hashtable();
Transaction txn = env.beginTransaction(null, null);
insertData(txn, 0, numRecs, expectedData, 1, true, NUM_DBS);
env.checkpoint(forceConfig);
insertData(txn, numRecs+1, numRecs+2, expectedData,
1, true, NUM_DBS);
txn.commit();
/*
* If useDeltas is true, this next checkpoint will end up using a
* BINDelta to log the last inserted record. It will have
* practically nothing but the root in the checkpoint.
*/
EnvironmentStats stats = env.getStats(statsConfig);
env.checkpoint(deltaConfig);
stats = env.getStats(statsConfig);
if (useDeltas) {
assertTrue(stats.getNDeltaINFlush() > 0);
} else {
assertTrue(stats.getNDeltaINFlush() == 0);
}
/* Shutdown, recover from a checkpoint that uses BINDeltas. */
closeEnv();
recoverAndVerify(expectedData, NUM_DBS);
} catch (Throwable t) {
t.printStackTrace();
throw t;
}
}
示例5: processShutdown
import com.sleepycat.je.CheckpointConfig; //导入方法依赖的package包/类
/**
* Process the shutdown message from the master and return the
* GroupShutdownException that must be thrown to exit the Replica loop.
*
* @return the GroupShutdownException
*/
private GroupShutdownException processShutdown(ShutdownRequest shutdown)
throws IOException {
/*
* Acknowledge the shutdown message right away, since the checkpoint
* operation can take a long time to complete. Long enough to exceed
* the feeder timeout on the master. The master only needs to know that
* the replica has received the message.
*/
protocol.write(protocol.new ShutdownResponse(), replicaFeederChannel);
/*
* Turn off network timeouts on the replica, since we don't want the
* replica to timeout the connection. The connection itself is no
* longer used past this point and will be reclaimed as part of normal
* replica exit cleanup.
*/
replicaFeederChannel.setTimeoutMs(Integer.MAX_VALUE);
/*
* TODO: Share the following code with the standalone Environment
* shutdown, or better yet, call EnvironmentImpl.doClose here.
*/
/*
* Begin shutdown of the deamons before checkpointing. Cleaning during
* the checkpoint is wasted and slows down the checkpoint, plus it may
* cause additional checkpoints.
*/
repNode.getRepImpl().requestShutdownDaemons();
/*
* Now start a potentially long running checkpoint.
*/
LoggerUtils.info(logger, repImpl, "Checkpoint initiated.");
CheckpointConfig config = new CheckpointConfig();
config.setForce(true);
config.setMinimizeRecoveryTime(true);
repNode.getRepImpl().invokeCheckpoint(config, "Group Shutdown");
/* Force final shutdown of the daemons. */
repNode.getRepImpl().shutdownDaemons();
LoggerUtils.info(logger, repImpl, "Checkpoint completed.");
return new GroupShutdownException(logger,
repNode,
shutdown.getShutdownTimeMs());
}
示例6: postRecoveryConversion
import com.sleepycat.je.CheckpointConfig; //导入方法依赖的package包/类
/**
* @see EnvironmentImpl#setupClose
*
* Note: this conversion process will iterate over all user created
* databases in the environment, which could be potentially be a costly
* affair. However, let's opt for simplicity and defer any optimizations
* until we see whether this is an important use case.
*/
@Override
protected void postRecoveryConversion() {
super.postRecoveryConversion();
if (needRepConvert) {
/* Set NameDb to replicated. */
DatabaseImpl nameDb = null;
try {
nameDb = dbMapTree.getDb(DbTree.NAME_DB_ID);
if (!nameDb.isReplicated()) {
nameDb.setIsReplicatedBit();
nameDb.setDirtyUtilization();
}
} finally {
if (nameDb != null) {
dbMapTree.releaseDb(nameDb);
}
}
/* Set user defined databases to replicated. */
Map<DatabaseId, String> idNameMap = dbMapTree.getDbNamesAndIds();
for (DatabaseId id : idNameMap.keySet()) {
DatabaseImpl db = null;
try {
db = dbMapTree.getDb(id);
if (db != null &&
!DbTree.isReservedDbName(idNameMap.get(id))) {
db.setIsReplicatedBit();
db.setDirtyUtilization();
}
} finally {
if (db != null) {
dbMapTree.releaseDb(db);
}
}
}
/*
* Do a checkpointer to flush dirty datbaseImpls that are converted
* to replicated and write the current VLSNRange to the log.
*/
CheckpointConfig ckptConfig = new CheckpointConfig();
ckptConfig.setForce(true);
ckptConfig.setMinimizeRecoveryTime(true);
invokeCheckpoint(ckptConfig, "Environment conversion");
}
}