Skip to content

Commit 3e806bf

Browse files
Limit RocksDB logs size (#1278)
* fix logging of failed destroy attempts * limit rocksdb log size
1 parent 97398b7 commit 3e806bf

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

tddb/td/db/RocksDb.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Result<RocksDb> RocksDb::open(std::string path, RocksDbOptions options) {
8585
db_options.bytes_per_sync = 1 << 20;
8686
db_options.writable_file_max_buffer_size = 2 << 14;
8787
db_options.statistics = options.statistics;
88+
db_options.max_log_file_size = 100 << 20;
89+
db_options.keep_log_file_num = 1;
8890
rocksdb::OptimisticTransactionDBOptions occ_options;
8991
occ_options.validate_policy = rocksdb::OccValidationPolicy::kValidateSerial;
9092
rocksdb::ColumnFamilyOptions cf_options(db_options);

validator/db/archive-slice.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -768,22 +768,19 @@ void destroy_db(std::string name, td::uint32 attempt, td::Promise<td::Unit> prom
768768
promise.set_value(td::Unit());
769769
return;
770770
}
771-
if (S.is_error() && attempt > 0 && attempt % 64 == 0) {
771+
if (attempt > 0 && attempt % 64 == 0) {
772772
LOG(ERROR) << "failed to destroy index " << name << ": " << S;
773773
} else {
774774
LOG(DEBUG) << "failed to destroy index " << name << ": " << S;
775775
}
776776
delay_action(
777-
[name, attempt, promise = std::move(promise)]() mutable { destroy_db(name, attempt, std::move(promise)); },
777+
[name, attempt, promise = std::move(promise)]() mutable { destroy_db(name, attempt + 1, std::move(promise)); },
778778
td::Timestamp::in(1.0));
779779
}
780780
} // namespace
781781

782782
void ArchiveSlice::destroy(td::Promise<td::Unit> promise) {
783783
before_query();
784-
td::MultiPromise mp;
785-
auto ig = mp.init_guard();
786-
ig.add_promise(std::move(promise));
787784
destroyed_ = true;
788785

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

798-
PackageId p_id{archive_id_, key_blocks_only_, temp_};
799-
std::string db_path = PSTRING() << db_root_ << p_id.path() << p_id.name() << ".index";
800-
delay_action([name = db_path, attempt = 0,
801-
promise = ig.get_promise()]() mutable { destroy_db(name, attempt, std::move(promise)); },
795+
delay_action([name = db_path_, attempt = 0,
796+
promise = std::move(promise)]() mutable { destroy_db(name, attempt, std::move(promise)); },
802797
td::Timestamp::in(0.0));
803798
}
804799

0 commit comments

Comments
 (0)