mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Mode 644 for db_stats.txt (#938)
This commit is contained in:
parent
7a6bfa7e7a
commit
0feaaf591c
3 changed files with 32 additions and 4 deletions
|
@ -915,7 +915,18 @@ void ArchiveManager::start_up() {
|
|||
void ArchiveManager::alarm() {
|
||||
alarm_timestamp() = td::Timestamp::in(60.0);
|
||||
auto stats = td::RocksDb::statistics_to_string(statistics_);
|
||||
td::atomic_write_file(db_root_ + "/db_stats.txt", stats);
|
||||
auto to_file_r = td::FileFd::open(db_root_ + "/db_stats.txt", td::FileFd::Truncate | td::FileFd::Create | td::FileFd::Write, 0644);
|
||||
if (to_file_r.is_error()) {
|
||||
LOG(ERROR) << "Failed to open db_stats.txt: " << to_file_r.move_as_error();
|
||||
return;
|
||||
}
|
||||
auto to_file = to_file_r.move_as_ok();
|
||||
auto res = to_file.write(stats);
|
||||
to_file.close();
|
||||
if (res.is_error()) {
|
||||
LOG(ERROR) << "Failed to write to db_stats.txt: " << res.move_as_error();
|
||||
return;
|
||||
}
|
||||
td::RocksDb::reset_statistics(statistics_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue