Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide progress when reverse replication is running #610

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pgbelt/cmd/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,20 @@ async def status(conf_future: Awaitable[DbupgradeConfig]) -> dict[str, str]:

result[0].update(result[1])
result[0]["db"] = conf.db
if result[0]["pg1_pg2"] == "replicating":

# We should hide the progress in the following cases:
# 1. When src -> dst is replicating and dst -> src is any state (replicating, unconfigured, down)
# a. We do this because the size when done still will be a tad smaller than SRC, showing <100%
# 2. When src -> dst is unconfigured and dst -> src is replicating (not down or unconfigured)
# a. We do this because reverse-only occurs at the start of cutover and onwards, and seeing the progress at that stage is not useful.
if (result[0]["pg1_pg2"] == "replicating") or ( # 1
result[0]["pg1_pg2"] == "unconfigured"
and result[0]["pg2_pg1"] == "replicating"
): # 2
result[2]["src_dataset_size"] = "n/a"
result[2]["dst_dataset_size"] = "n/a"
result[2]["progress"] = "n/a"

result[0].update(result[2])
return result[0]
finally:
Expand Down