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

do not remove publications of slot defined in manifest #2868

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

FxKu
Copy link
Member

@FxKu FxKu commented Feb 24, 2025

With #2684 we introduced proper stream removal incl. database objects such as slots and publications which helped in cases when
a. users decided to abandon/pause the stream idea after a testing phase
b. the removal of the slot became necessary due to problems with WAL consumption and growing disk space.

Another case might be that users want to migrate to self-deploy the stream resource because it offers more flexibility compared to what our operator will ever offer. Of course, they could turn streams off and on again which would mean a loss of decoded events. If they do not want to lose any event data, they have to

a. define the slot with the exact same name fes_<dbname>_<appId> in the manifest
b. add parameter wal_level: logical to postgresql section
c. create a fes_user replication user.

However, the current implementation only persist the slots, not the publication, making the migration impossible. The problem lies in the initialization of publications to sync. For every database we create an empty struct to allow for later removal. When the following spec.Streams loop is skipped syncPublication is later called with an empty databaseSlotList which will then remove the publications.

This PR suggests to set the slotName in the databaseSlotList when it is specified in the manifest. I could do an additional check if the plugin is also pgoutput, but maybe that's not really necessary (nobody should switch to wal2json). In the syncPublication code I am simply using the current publication tables when the new table list is empty. One cannot define publications in the manifest.

@FxKu FxKu added the bugfix label Feb 24, 2025
@FxKu FxKu added this to the 1.15.0 milestone Feb 24, 2025
@@ -650,7 +650,7 @@ func Test_trimCronjobName(t *testing.T) {
}
}

func TestisInMaintenanceWindow(t *testing.T) {
Copy link
Member Author

@FxKu FxKu Feb 25, 2025

Choose a reason for hiding this comment

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

unrelated change, but my local go was complaining and failing unit test because second word after Test did not have a capital letter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant