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

always send feedback for postgres replication messages #107

Merged
merged 1 commit into from
May 23, 2024

Conversation

MattExact
Copy link
Contributor

My previous PR partially fixed the Postgres disk usage issue #84

It was pointed out that for idle databases the disk use was still growing.

I believe that this is because it's not always sending feedback for replication messages, and only does so when there's a change to a table for a Meilisync index.
If instead we always send feedback, then it should allow Postgres to free WAL segments on idle databases.

Comment on lines 89 to 94
def _consumer(self, msg: ReplicationMessage):
payload = json.loads(msg.payload)
changes = payload.get("change")
if not changes:
return
next_lsn = payload["nextlsn"]

changes = payload.get("change", [])
for change in changes:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reworked quite a bit of this for neatness, hope that's okay!

The primary change was to payload.get("change", []) so that it doesn't early return.
I also changed payload.get("nextlsn") to payload["nextlsn"], AFAIK there will always be a nextlsn.

@long2ice long2ice merged commit fc1877d into long2ice:dev May 23, 2024
1 check passed
@long2ice
Copy link
Owner

Thanks!

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