Skip to content

Commit

Permalink
feat(slog): Remove slog related code (apache#1759)
Browse files Browse the repository at this point in the history
Since Pegasus 2.4.0, there will be no new shared logs been created, since Pegasus 2.5.0, all shared logs will garbage collected, then there is no shared logs left. It's a time to remove all shared log related code.
This patch also ensure that there is slog left, otherwise, the server will crash when bootstrap.
This change should be mentioned as "behavior changes" in release notes.
  • Loading branch information
acelyc111 authored Dec 14, 2023
1 parent 5eb33cc commit 2b7d658
Show file tree
Hide file tree
Showing 82 changed files with 165 additions and 1,391 deletions.
6 changes: 1 addition & 5 deletions docker/pegasus-docker-compose/config.min.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
type = replica
name = replica
ports = 34801
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_COMPACT,THREAD_POOL_INGESTION,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_FD,THREAD_POOL_LOCAL_APP,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_COMPACT,THREAD_POOL_INGESTION,THREAD_POOL_PLOG

[apps.collector]
name = collector
Expand Down Expand Up @@ -105,10 +105,6 @@
partitioned = false
worker_count = 2

[threadpool.THREAD_POOL_SLOG]
name = slog
worker_count = 1

[threadpool.THREAD_POOL_PLOG]
name = plog
partitioned = true
Expand Down
5 changes: 0 additions & 5 deletions src/common/replication.codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ DEFINE_THREAD_POOL_CODE(THREAD_POOL_LOCAL_APP)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_REPLICATION_LONG)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_COMPACT)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_INGESTION)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_SLOG)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_PLOG)
DEFINE_THREAD_POOL_CODE(THREAD_POOL_SCAN)

Expand Down Expand Up @@ -207,10 +206,6 @@ MAKE_EVENT_CODE(LPC_REPLICATION_LONG_COMMON, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE(LPC_REPLICATION_LONG_HIGH, TASK_PRIORITY_HIGH)
#undef CURRENT_THREAD_POOL

#define CURRENT_THREAD_POOL THREAD_POOL_SLOG
MAKE_EVENT_CODE_AIO(LPC_WRITE_REPLICATION_LOG_SHARED, TASK_PRIORITY_HIGH)
#undef CURRENT_THREAD_POOL

#define CURRENT_THREAD_POOL THREAD_POOL_PLOG
MAKE_EVENT_CODE_AIO(LPC_WRITE_REPLICATION_LOG_PRIVATE, TASK_PRIORITY_HIGH)
#undef CURRENT_THREAD_POOL
Expand Down
16 changes: 9 additions & 7 deletions src/common/replication_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "common/replication_common.h"

#include <string.h>
// IWYU pragma: no_include <ext/alloc_traits.h>
#include <algorithm>
#include <fstream>
Expand Down Expand Up @@ -63,7 +64,7 @@ DSN_DEFINE_int32(
replication,
gc_interval_ms,
30 * 1000,
"every what period (ms) we do garbage collection for dead replicas, on-disk state, log, etc.");
"every what period (ms) we do replica stat. The name contains 'gc' is for legacy reason.");
DSN_DEFINE_int32(replication,
fd_check_interval_seconds,
2,
Expand Down Expand Up @@ -99,7 +100,12 @@ DSN_DEFINE_bool(replication,
"whether to disable empty write, default is false");
DSN_TAG_VARIABLE(empty_write_disabled, FT_MUTABLE);

DSN_DEFINE_string(replication, slog_dir, "", "The shared log directory");
DSN_DEFINE_string(replication,
slog_dir,
"",
"The shared log directory. Deprecated since Pegasus "
"2.6.0, but leave it and do not modify the value if "
"upgrading from older versions.");
DSN_DEFINE_string(replication, data_dirs, "", "replica directory list");
DSN_DEFINE_string(replication,
data_dirs_black_list_file,
Expand All @@ -118,11 +124,7 @@ void replication_options::initialize()
app_name = info.full_name;
app_dir = info.data_dir;

// slog_dir:
// - if config[slog_dir] is empty: "app_dir/slog"
// - else: "config[slog_dir]/app_name/slog"
slog_dir = FLAGS_slog_dir;
if (slog_dir.empty()) {
if (strlen(FLAGS_slog_dir) == 0) {
slog_dir = app_dir;
} else {
slog_dir = utils::filesystem::path_combine(slog_dir, app_name);
Expand Down
4 changes: 2 additions & 2 deletions src/failure_detector/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ run = true
ports =
count = 1
delay_seconds = 1
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_PLOG

[apps.server]
type = test
arguments =
ports = 20101
run = false
count = 0
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_PLOG

[apps.test_worker]
type = worker
Expand Down
4 changes: 2 additions & 2 deletions src/failure_detector/test/config-whitelist-test-failed.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ run = true
ports =
count = 1
delay_seconds = 1
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_PLOG

[apps.server]
type = test
arguments =
ports = 20101
run = false
count = 0
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_PLOG

[apps.test_worker]
type = worker
Expand Down
4 changes: 2 additions & 2 deletions src/failure_detector/test/config-whitelist-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ run = true
ports =
count = 1
delay_seconds = 1
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT, THREAD_POOL_DLOCK, THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG, THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_PLOG

[apps.server]
type = test
arguments =
ports = 20101
run = false
count = 0
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT, THREAD_POOL_REPLICATION,THREAD_POOL_PLOG

[apps.test_worker]
type = worker
Expand Down
1 change: 0 additions & 1 deletion src/perf_counter/perf_counters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ std::map<std::string, std::string> s_brief_stat_map = {
{"replica*app.pegasus*manual.compact.running.count", "manual_compact_running_count"},
{"replica*app.pegasus*manual.compact.enqueue.count", "manual_compact_enqueue_count"},
{"replica*app.pegasus*rdb.block_cache.memory_usage", "rdb_block_cache_memory_usage"},
{"replica*eon.replica_stub*shared.log.size(MB)", "shared_log_size(MB)"},
{"replica*server*memused.virt(MB)", "memused_virt(MB)"},
{"replica*server*memused.res(MB)", "memused_res(MB)"},
{"replica*eon.replica_stub*disk.capacity.total(MB)", "disk_capacity_total(MB)"},
Expand Down
2 changes: 1 addition & 1 deletion src/replica/backup/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ run = true

[apps.replica]
type = replica
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_PLOG

[core]
tool = nativerun
Expand Down
2 changes: 1 addition & 1 deletion src/replica/bulk_load/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type = replica
run = true
count = 1
ports = 54321
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_BLOCK_SERVICE,THREAD_POOL_PLOG

[core]
;tool = simulator
Expand Down
2 changes: 1 addition & 1 deletion src/replica/duplication/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ run = true

[apps.replica]
type = replica
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_SLOG,THREAD_POOL_PLOG
pools = THREAD_POOL_DEFAULT,THREAD_POOL_REPLICATION_LONG,THREAD_POOL_REPLICATION,THREAD_POOL_PLOG

[core]
tool = nativerun
Expand Down
Loading

0 comments on commit 2b7d658

Please sign in to comment.