Skip to content

Don't sync MotherDuck metadata forever#582

Merged
JelteF merged 6 commits intomainfrom
dont-always-sync-motherduck
Feb 11, 2025
Merged

Don't sync MotherDuck metadata forever#582
JelteF merged 6 commits intomainfrom
dont-always-sync-motherduck

Conversation

@JelteF
Copy link
Copy Markdown
Collaborator

@JelteF JelteF commented Feb 7, 2025

Keeping a connection open to MotherDuck forever is undesirable from a resourcing perspective. This changes that to behave similarly to the DuckDB CLI: After 5 minutes (by default) syncing will stop. The main difficulty is to restart the syncing. In the DuckDB CLI the syncing will start again after some activity is detected, but the background worker never triggers activity. So instead we need to make sure that activity in other connections triggers a restart of the syncing in the background worker. This is done using some very simple IPC in shared memory.

@JelteF JelteF force-pushed the dont-always-sync-motherduck branch 5 times, most recently from 2fccd22 to 40b2674 Compare February 7, 2025 14:26
Keeping a connection open to MotherDuck forever is undesirable from a
resourcing perspective on the MotherDuck side. This changes that to
behave similarly like the DuckDB CLI, after 5 minutes (by default)
syncing will stop. The main difficulty is to restart the syncing.
In the DuckDB CLI the syncing will start again after some activity is
detected, but the background worker never triggers activity. So instead
we need to make sure that activity in other connections triggers a
restart of the syncing in the background worker. This is done using some
very simple IPC in shared memory.
@JelteF JelteF force-pushed the dont-always-sync-motherduck branch from 40b2674 to 892f6c7 Compare February 7, 2025 14:26
Comment on lines +662 to +664
* TODO: Passing a reference through InvokeCPPFunc doesn't work here
* for some reason. So to work around that we use a pointer instead.
* We should fix the underlying problem instead.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Y-- maybe something for your template magic to fix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think I've seen something like that in the past. Never got a chance to investigate though... Let's open an issue and I'll try to look at it soon?

Copy link
Copy Markdown
Collaborator

@Y-- Y-- left a comment

Choose a reason for hiding this comment

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

LGTM, main comment is around timeout default

@JelteF JelteF enabled auto-merge (squash) February 11, 2025 14:08
@JelteF JelteF merged commit 236e5c1 into main Feb 11, 2025
@JelteF JelteF deleted the dont-always-sync-motherduck branch February 11, 2025 14:17
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