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

Undo walloging replorgin file on checkpoint #8794

Merged
merged 4 commits into from
Aug 29, 2024

Conversation

knizhnik
Copy link
Contributor

Problem

See #8620

Summary of changes

Remove walloping of replorigin file because it is reconstructed by PS

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@knizhnik knizhnik requested a review from a team as a code owner August 21, 2024 17:59
@knizhnik knizhnik requested a review from ololobus August 21, 2024 17:59
Copy link

github-actions bot commented Aug 21, 2024

3787 tests run: 3681 passed, 0 failed, 106 skipped (full report)


Code coverage* (full report)

  • functions: 32.5% (7402 of 22759 functions)
  • lines: 50.7% (60052 of 118528 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
e283125 at 2024-08-28T20:50:26.639Z :recycle:

@hlinnaka
Copy link
Contributor

~/git-sandbox/neon/vendor/postgres-v16 (remove_replorigin_checkpoint_v16)$ git diff REL_16_3 src/backend/replication/logical/origin.c
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index b0255ffd25a..bc540521a96 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -83,6 +83,7 @@
 #include "nodes/execnodes.h"
 #include "pgstat.h"
 #include "replication/logical.h"
+#include "replication/message.h"
 #include "replication/origin.h"
 #include "storage/condition_variable.h"
 #include "storage/copydir.h"
@@ -657,7 +658,6 @@ CheckPointReplicationOrigin(void)
                                         errmsg("could not write to file \"%s\": %m",
                                                        tmppath)));
                }
-
                COMP_CRC32C(crc, &disk_state, sizeof(disk_state));
        }
 
@@ -1144,6 +1144,7 @@ replorigin_session_setup(RepOriginId node, int acquired_by)
 
                /* ok, found slot */
                session_replication_state = curstate;
+               break;
        }
 
 

Why the added break? And let's remove those other superfluous changes too.

@hlinnaka
Copy link
Contributor

Do we have a plan for how to eventually remove those obsolete pg_logical/replorigin_checkpoint files from the storage?

@knizhnik knizhnik force-pushed the remove_replorigin_checkpoint branch from b9b37c6 to 066d295 Compare August 23, 2024 17:37
@knizhnik knizhnik force-pushed the remove_replorigin_checkpoint branch from 066d295 to c8563c7 Compare August 23, 2024 17:38
@knizhnik
Copy link
Contributor Author

~/git-sandbox/neon/vendor/postgres-v16 (remove_replorigin_checkpoint_v16)$ git diff REL_16_3 src/backend/replication/logical/origin.c
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index b0255ffd25a..bc540521a96 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -83,6 +83,7 @@
 #include "nodes/execnodes.h"
 #include "pgstat.h"
 #include "replication/logical.h"
+#include "replication/message.h"
 #include "replication/origin.h"
 #include "storage/condition_variable.h"
 #include "storage/copydir.h"
@@ -657,7 +658,6 @@ CheckPointReplicationOrigin(void)
                                         errmsg("could not write to file \"%s\": %m",
                                                        tmppath)));
                }
-
                COMP_CRC32C(crc, &disk_state, sizeof(disk_state));
        }
 
@@ -1144,6 +1144,7 @@ replorigin_session_setup(RepOriginId node, int acquired_by)
 
                /* ok, found slot */
                session_replication_state = curstate;
+               break;
        }
 
 

Why the added break? And let's remove those other superfluous changes too.

Sorry, removed unintended changes.

@knizhnik
Copy link
Contributor Author

Do we have a plan for how to eventually remove those obsolete pg_logical/replorigin_checkpoint files from the storage?

Any reason for it? Can extra ~100 bytes somehow compensate efforts needed to remove them?

@hlinnaka
Copy link
Contributor

Do we have a plan for how to eventually remove those obsolete pg_logical/replorigin_checkpoint files from the storage?

Any reason for it? Can extra ~100 bytes somehow compensate efforts needed to remove them?

It's not urgent, but it might cause surprises later, after everyone has already forgotten about them.

@hlinnaka
Copy link
Contributor

Why the added break? And let's remove those other superfluous changes too.

Sorry, removed unintended changes.

I can still see the extra 'break' there.

@knizhnik
Copy link
Contributor Author

Why the added break? And let's remove those other superfluous changes too.

Sorry, removed unintended changes.

I can still see the extra 'break' there.

Sorry, looks like I didn't push changes in neon repo.
Fixed.

Copy link
Contributor

@hlinnaka hlinnaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more trivial remnants of this:

$ git diff REL_16_4..origin/pr/472  src/backend/replication/logical/origin.c
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index b0255ffd25a..739030a87e1 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -83,6 +83,7 @@
 #include "nodes/execnodes.h"
 #include "pgstat.h"
 #include "replication/logical.h"
+#include "replication/message.h"
 #include "replication/origin.h"
 #include "storage/condition_variable.h"
 #include "storage/copydir.h"
@@ -615,6 +616,7 @@ CheckPointReplicationOrigin(void)
                                 errmsg("could not write to file \"%s\": %m",
                                                tmppath)));
        }
+
        COMP_CRC32C(crc, &magic, sizeof(magic));
 
        /* prevent concurrent creations/drops */

Other than that, LGTM

@knizhnik knizhnik merged commit cfa45ff into main Aug 29, 2024
67 checks passed
@knizhnik knizhnik deleted the remove_replorigin_checkpoint branch August 29, 2024 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants