- return BDB::CIBtree.open(name, nil,
- "r+", 0600, "env" => @@env)
+ return @@env.open_db(BDB::CIBtree, name, nil, "r+", 0600)
+ end
+
+ def DBTree.cleanup_logs()
+ begin
+ debug "DBTree: checkpointing ..."
+ @@env.checkpoint
+ rescue Exception => e
+ debug "Failed: #{e.pretty_inspect}"
+ end
+ begin
+ debug "DBTree: flushing log ..."
+ @@env.log_flush
+ logs = @@env.log_archive(BDB::ARCH_ABS)
+ debug "DBTree: deleting archivable logs: #{logs.join(', ')}."
+ logs.each { |log|
+ File.delete(log)
+ }
+ rescue Exception => e
+ debug "Failed: #{e.pretty_inspect}"
+ end
+ end
+
+ def DBTree.stats()
+ begin
+ debug "General stats:"
+ debug @@env.stat
+ debug "Lock stats:"
+ debug @@env.lock_stat
+ debug "Log stats:"
+ debug @@env.log_stat
+ debug "Txn stats:"
+ debug @@env.txn_stat
+ rescue
+ debug "Couldn't dump stats"
+ end