本文整理汇总了Java中com.sleepycat.je.DatabaseStats类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseStats类的具体用法?Java DatabaseStats怎么用?Java DatabaseStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseStats类属于com.sleepycat.je包,在下文中一共展示了DatabaseStats类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyToStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
private void copyToStats(DatabaseStats stats) {
BtreeStats bStats = (BtreeStats) stats;
bStats.setInternalNodeCount(getINNodeIdsSeen().size());
bStats.setBottomInternalNodeCount
(getBINNodeIdsSeen().size());
bStats.setDuplicateInternalNodeCount
(getDINNodeIdsSeen().size());
bStats.setDuplicateBottomInternalNodeCount
(getDBINNodeIdsSeen().size());
bStats.setLeafNodeCount(getLNCount());
bStats.setDeletedLeafNodeCount(getDeletedLNCount());
bStats.setDupCountLeafNodeCount
(getDupCountLNCount().size());
bStats.setMainTreeMaxDepth(getMainTreeMaxDepth());
bStats.setDuplicateTreeMaxDepth(getDuplicateTreeMaxDepth());
bStats.setINsByLevel(getINsByLevel());
bStats.setBINsByLevel(getBINsByLevel());
bStats.setDINsByLevel(getDINsByLevel());
bStats.setDBINsByLevel(getDBINsByLevel());
}
示例2: getDatabaseStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
/**
* Helper to get statistics for a given database.
* @param params operation parameters
* @return DatabaseStats object
*/
private DatabaseStats getDatabaseStats(Environment targetEnv,
Object [] params)
throws IllegalArgumentException,
DatabaseException {
if ((params == null) || (params.length < 3)) {
return null;
}
String dbName = (String)params[2];
Database db = null;
try {
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setReadOnly(true);
DbInternal.setUseExistingConfig(dbConfig, true);
db = targetEnv.openDatabase(null, dbName, dbConfig);
return db.getStats(getStatsConfig(params));
} finally {
if (db != null) {
db.close();
}
}
}
示例3: getDatabaseStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
/**
* Helper to get statistics for a given database.
*
* @param params operation parameters
* @return DatabaseStats object
*/
private DatabaseStats getDatabaseStats(Object[] params)
throws IllegalArgumentException,
DatabaseException {
if ((params == null) || (params.length < 3)) {
return null;
}
String dbName = (String)params[2];
Database db = null;
try {
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setReadOnly(true);
DbInternal.setUseExistingConfig(dbConfig, true);
db = env.openDatabase(null, dbName, dbConfig);
return db.getStats(getStatsConfig(params));
} finally {
if (db != null) {
db.close();
}
}
}
示例4: verify
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
public boolean verify(VerifyConfig config, DatabaseStats emptyStats)
throws DatabaseException {
if (tree == null) {
return true;
}
PrintStream out = config.getShowProgressStream();
if (out == null) {
out = System.err;
}
StatsAccumulator statsAcc =
new StatsAccumulator(out,
config.getShowProgressInterval(),
emptyStats) {
void verifyNode(Node node) {
try {
node.verify(null);
} catch (DatabaseException INE) {
progressStream.println(INE);
}
}
};
boolean ok = walkDatabaseTree(statsAcc, out, config.getPrintInfo());
statsAcc.copyToStats(emptyStats);
return ok;
}
示例5: StatsAccumulator
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
StatsAccumulator(PrintStream progressStream,
int progressInterval,
DatabaseStats useStats) {
this.progressStream = progressStream;
this.progressInterval = progressInterval;
insSeenByLevel = new long[MAX_LEVELS];
binsSeenByLevel = new long[MAX_LEVELS];
dinsSeenByLevel = new long[MAX_LEVELS];
dbinsSeenByLevel = new long[MAX_LEVELS];
this.useStats = useStats;
}
示例6: StatsAccumulator
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
StatsAccumulator(PrintStream progressStream,
int progressInterval,
DatabaseStats useStats) {
this.progressStream = progressStream;
this.progressInterval = progressInterval;
insSeenByLevel = new long[MAX_LEVELS];
binsSeenByLevel = new long[MAX_LEVELS];
dinsSeenByLevel = new long[MAX_LEVELS];
dbinsSeenByLevel = new long[MAX_LEVELS];
this.useStats = useStats;
}
示例7: getStatus
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
public String getStatus() {
StatsConfig config = new StatsConfig();
config.setFast(false);
DatabaseStats stats = beaconEventsDB.getStats(config);
StringBuilder status = new StringBuilder();
status.append(String.format("BeaconEvents count: %s\n", beaconEventsDB.count()));
status.append(String.format("BeaconEvents stats: %s\n", stats));
stats = scannerHealthDB.getStats(config);
status.append(String.format("ScannerHealth count: %s\n", scannerHealthDB.count()));
status.append(String.format("ScannerHealth stats: %s\n", stats));
return status.toString();
}
示例8: verify
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
public boolean verify(VerifyConfig config, DatabaseStats emptyStats)
throws DatabaseException {
if (tree == null) {
return true;
}
PrintStream out = config.getShowProgressStream();
if (out == null) {
out = System.err;
}
StatsAccumulator statsAcc =
new StatsAccumulator(out, config.getShowProgressInterval()) {
@Override
void verifyNode(Node node) {
try {
node.verify(null);
} catch (DatabaseException INE) {
progressStream.println(INE);
}
}
};
boolean ok = walkDatabaseTree(statsAcc, out, config.getPrintInfo());
((BtreeStats) emptyStats).setDbImplStats(statsAcc.getStats());
return ok;
}
示例9: getDatabaseStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
/**
* Helper to get statistics for a given database.
* @param params operation parameters
* @return DatabaseStats object
*/
private DatabaseStats getDatabaseStats(Environment targetEnv,
Object[] params)
throws IllegalArgumentException,
DatabaseNotFoundException,
DatabaseException {
if ((params == null) || (params.length < 3)) {
return null;
}
String dbName = (String)params[2];
Database db = null;
try {
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setReadOnly(true);
DbInternal.setUseExistingConfig(dbConfig, true);
try {
db = targetEnv.openDatabase(null, dbName, dbConfig);
} catch (DatabaseExistsException e) {
/* Should never happen, ExlcusiveCreate is false. */
throw EnvironmentFailureException.unexpectedException(e);
}
return db.getStats(getStatsConfig(params));
} finally {
if (db != null) {
db.close();
}
}
}
示例10: getStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
public DatabaseStats getStats(boolean setFast) {
try {
StatsConfig config = new StatsConfig();
config.setFast(setFast);
return this.getBdbDatabase().getStats(config);
} catch(DatabaseException e) {
logger.error(e);
throw new VoldemortException(e);
}
}
示例11: getStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
/**
* @see SecondaryDatabase#getStats(StatsConfig)
*/
public DatabaseStats getStats(final StatsConfig config) throws DatabaseException {
return delegate().getStats(config);
}
示例12: verify
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
/**
* @see SecondaryDatabase#verify(VerifyConfig)
*/
public DatabaseStats verify(final VerifyConfig config) throws DatabaseException {
return delegate().verify(config);
}
示例13: getEmptyStats
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
public DatabaseStats getEmptyStats() {
return new BtreeStats();
}
示例14: verifyOneDbImpl
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
private boolean verifyOneDbImpl(DatabaseImpl dbImpl,
String name,
VerifyConfig verifyConfig,
PrintStream out)
throws DatabaseException {
boolean status = true;
if (verifyConfig.getPrintInfo()) {
out.println("Verifying database " + name);
}
/*
* First check the tree. Use DatabaseImpl.verify so we can get a status
* return.
*/
if (verifyConfig.getPrintInfo()) {
out.println("Checking tree for " + name);
}
DatabaseStats stats = dbImpl.getEmptyStats();
status = dbImpl.verify(verifyConfig, stats);
if (verifyConfig.getPrintInfo()) {
/*
* Intentionally use print, not println, because stats.toString()
* puts in a newline too.
*/
out.print(stats);
}
/* Then check the obsolete lsns */
if (verifyConfig.getPrintInfo()) {
out.println("Checking obsolete offsets for " + name);
}
try {
VerifyUtils.checkLsns(dbImpl, out);
} catch (DatabaseException e) {
if (verifyConfig.getPrintInfo()) {
out.println("Problem from checkLsns:" + e);
}
status = false;
}
if (verifyConfig.getPrintInfo()) {
out.println();
}
return status;
}
示例15: testVerify
import com.sleepycat.je.DatabaseStats; //导入依赖的package包/类
/**
* Insert a bunch of keys. Call verify and validate the results.
*/
public void testVerify()
throws DatabaseException {
initEnv(false);
byte[][] keys = new byte[N_KEYS][];
LN[] lns = new LN[N_KEYS];
Locker txn = new BasicLocker(DbInternal.envGetEnvironmentImpl(env));
NullCursor cursor = new NullCursor(tree.getDatabase(), txn);
for (int i = 0; i < N_KEYS; i++) {
byte[] key = new byte[N_KEY_BYTES];
keys[i] = key;
lns[i] = new LN((byte[]) new byte[1]);
TestUtils.generateRandomAlphaBytes(key);
insertAndRetrieve(cursor, key, lns[i]);
}
/*
* Note that verify will attempt to continue past errors, so
* assertTrue on the status return.
*/
assertTrue(env.verify(new VerifyConfig(), System.err));
DatabaseStats stats = db.verify(new VerifyConfig());
BtreeStats btStats = (BtreeStats) stats;
assertTrue(btStats.getInternalNodeCount() <
btStats.getBottomInternalNodeCount());
assertTrue(btStats.getBottomInternalNodeCount() <
btStats.getLeafNodeCount() +
btStats.getDeletedLeafNodeCount());
assertTrue(btStats.getLeafNodeCount() +
btStats.getDeletedLeafNodeCount() ==
N_KEYS);
txn.operationEnd();
/* Now intentionally create LogFileNotFoundExceptions */
/*
db.close();
env.close();
This is disabled until the method for flipping files is
introduced. It's too hard to create a LogFileNotFoundException
by brute force deleting a file; often recovery doesn't work.
Instead, use a flipped file later on.
String [] jeFiles =
FileManager.listFiles(envHome,
new String[] {FileManager.JE_SUFFIX});
int targetIdx = jeFiles.length / 2;
assertTrue(targetIdx > 0);
File targetFile = new File(envHome, jeFiles[targetIdx]);
assertTrue(targetFile.delete());
initEnv(false);
assertFalse(env.verify(new VerifyConfig(), System.err));
*/
}