mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Print oldest celldb snapshot to stats (#1078)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
679e6be294
commit
b3828f8eb2
6 changed files with 83 additions and 3 deletions
|
@ -26,6 +26,12 @@
|
|||
#include "td/utils/Status.h"
|
||||
#include "td/utils/optional.h"
|
||||
|
||||
#include "td/utils/Time.h"
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
|
||||
namespace rocksdb {
|
||||
class Cache;
|
||||
class OptimisticTransactionDB;
|
||||
|
@ -36,10 +42,22 @@ class Statistics;
|
|||
} // namespace rocksdb
|
||||
|
||||
namespace td {
|
||||
struct RocksDbSnapshotStatistics {
|
||||
void begin_snapshot(const rocksdb::Snapshot *snapshot);
|
||||
void end_snapshot(const rocksdb::Snapshot *snapshot);
|
||||
td::Timestamp oldest_snapshot_timestamp() const;
|
||||
std::string to_string() const;
|
||||
|
||||
private:
|
||||
mutable std::mutex mutex_;
|
||||
std::map<std::uintptr_t, double> id_to_ts_;
|
||||
std::set<std::pair<double, std::uintptr_t>> by_ts_;
|
||||
};
|
||||
|
||||
struct RocksDbOptions {
|
||||
std::shared_ptr<rocksdb::Statistics> statistics = nullptr;
|
||||
std::shared_ptr<rocksdb::Cache> block_cache; // Default - one 1G cache for all RocksDb
|
||||
std::shared_ptr<RocksDbSnapshotStatistics> snapshot_statistics = nullptr;
|
||||
bool use_direct_reads = false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue