This is an automated email from the ASF dual-hosted git repository.
wangdan pushed a commit to branch v2.5
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/v2.5 by this push:
new b0bbfe943 refactor(slog): refactor logging for slog gc (#1992)
b0bbfe943 is described below
commit b0bbfe9437f3a471289434b0527d0d3cf276cf38
Author: Dan Wang <[email protected]>
AuthorDate: Mon Apr 29 11:48:05 2024 +0800
refactor(slog): refactor logging for slog gc (#1992)
---
src/replica/mutation_log.cpp | 56 ++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 26 deletions(-)
diff --git a/src/replica/mutation_log.cpp b/src/replica/mutation_log.cpp
index ad745670b..e9570acc6 100644
--- a/src/replica/mutation_log.cpp
+++ b/src/replica/mutation_log.cpp
@@ -1445,34 +1445,38 @@ bool can_gc_replica_slog(const
dsn::replication::replica_log_info_map &slog_max_
// `ERR_INCOMPLETE_DATA`, thus it's possible that `valid_start_offset
== 0`.
CHECK(valid_start_offset == 0 || file->end_offset() <=
valid_start_offset,
"valid start offset must be 0 or greater than the end of this
log file");
- LOG_DEBUG("gc @ {}: max_decree for {} is missing vs {} as garbage max
decree, it's "
- "safe to delete this and all older logs for this replica",
- pid,
- file->path(),
- garbage_max_decree);
+ LOG_INFO("gc @ {}: max_decree for {} is missing vs {} as garbage max
decree, it's "
+ "safe to delete this and all older logs for this replica",
+ pid,
+ file->path(),
+ garbage_max_decree);
return true;
- } else if (file->end_offset() <= valid_start_offset) {
+ }
+
+ if (file->end_offset() <= valid_start_offset) {
// This file has been invalid for this replica, since
`valid_start_offset` was reset
// to a file with larger index than this file. Thus all decrees of
this replica in
// this file could be deleted.
- LOG_DEBUG("gc @ {}: log is invalid for {}, as valid start offset vs
log end offset = "
- "{} vs {}, it is therefore safe to delete this and all older
logs for this "
- "replica",
- pid,
- file->path(),
- valid_start_offset,
- file->end_offset());
+ LOG_INFO("gc @ {}: log is invalid for {}, as valid start offset vs log
end offset = "
+ "{} vs {}, it is therefore safe to delete this and all older
logs for this "
+ "replica",
+ pid,
+ file->path(),
+ valid_start_offset,
+ file->end_offset());
return true;
- } else if (it->second.max_decree <= garbage_max_decree) {
+ }
+
+ if (it->second.max_decree <= garbage_max_decree) {
// All decrees are no more than the garbage max decree. Since all
decrees less than
// garbage max decree would be deleted, all decrees of this replica in
this file
// could be deleted.
- LOG_DEBUG("gc @ {}: max_decree for {} is {} vs {} as garbage max
decree, it is "
- "therefore safe to delete this and all older logs for this
replica",
- pid,
- file->path(),
- it->second.max_decree,
- garbage_max_decree);
+ LOG_INFO("gc @ {}: max_decree for {} is {} vs {} as garbage max
decree, it is "
+ "therefore safe to delete this and all older logs for this
replica",
+ pid,
+ file->path(),
+ it->second.max_decree,
+ garbage_max_decree);
return true;
}
@@ -1480,12 +1484,12 @@ bool can_gc_replica_slog(const
dsn::replication::replica_log_info_map &slog_max_
//
// Some decrees are more than garbage max decree, thus this file should
not be deleted
// for now.
- LOG_DEBUG("gc @ {}: max_decree for {} is {} vs {} as garbage max decree,
it "
- "is therefore not allowed to delete this and all older logs",
- pid,
- file->path(),
- it->second.max_decree,
- garbage_max_decree);
+ LOG_INFO("gc @ {}: max_decree for {} is {} vs {} as garbage max decree, it
"
+ "is therefore not allowed to delete this and all older logs",
+ pid,
+ file->path(),
+ it->second.max_decree,
+ garbage_max_decree);
auto gap = it->second.max_decree - garbage_max_decree;
if (file->index() < gc_summary.min_file_index || gap >
gc_summary.max_decree_gap) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]