Skip to content

Commit

Permalink
Limit RocksDB logs size (ton-blockchain#1278)
Browse files Browse the repository at this point in the history
* fix logging of failed destroy attempts

* limit rocksdb log size
  • Loading branch information
dungeon-master-666 authored Oct 15, 2024
1 parent 97398b7 commit 3e806bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 2 additions & 0 deletions tddb/td/db/RocksDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Result<RocksDb> RocksDb::open(std::string path, RocksDbOptions options) {
db_options.bytes_per_sync = 1 << 20;
db_options.writable_file_max_buffer_size = 2 << 14;
db_options.statistics = options.statistics;
db_options.max_log_file_size = 100 << 20;
db_options.keep_log_file_num = 1;
rocksdb::OptimisticTransactionDBOptions occ_options;
occ_options.validate_policy = rocksdb::OccValidationPolicy::kValidateSerial;
rocksdb::ColumnFamilyOptions cf_options(db_options);
Expand Down
13 changes: 4 additions & 9 deletions validator/db/archive-slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,22 +768,19 @@ void destroy_db(std::string name, td::uint32 attempt, td::Promise<td::Unit> prom
promise.set_value(td::Unit());
return;
}
if (S.is_error() && attempt > 0 && attempt % 64 == 0) {
if (attempt > 0 && attempt % 64 == 0) {
LOG(ERROR) << "failed to destroy index " << name << ": " << S;
} else {
LOG(DEBUG) << "failed to destroy index " << name << ": " << S;
}
delay_action(
[name, attempt, promise = std::move(promise)]() mutable { destroy_db(name, attempt, std::move(promise)); },
[name, attempt, promise = std::move(promise)]() mutable { destroy_db(name, attempt + 1, std::move(promise)); },
td::Timestamp::in(1.0));
}
} // namespace

void ArchiveSlice::destroy(td::Promise<td::Unit> promise) {
before_query();
td::MultiPromise mp;
auto ig = mp.init_guard();
ig.add_promise(std::move(promise));
destroyed_ = true;

for (auto &p : packages_) {
Expand All @@ -795,10 +792,8 @@ void ArchiveSlice::destroy(td::Promise<td::Unit> promise) {
packages_.clear();
kv_ = nullptr;

PackageId p_id{archive_id_, key_blocks_only_, temp_};
std::string db_path = PSTRING() << db_root_ << p_id.path() << p_id.name() << ".index";
delay_action([name = db_path, attempt = 0,
promise = ig.get_promise()]() mutable { destroy_db(name, attempt, std::move(promise)); },
delay_action([name = db_path_, attempt = 0,
promise = std::move(promise)]() mutable { destroy_db(name, attempt, std::move(promise)); },
td::Timestamp::in(0.0));
}

Expand Down

0 comments on commit 3e806bf

Please sign in to comment.