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

enh: Implement PrimaryReadReplicaConnection #41998

Merged
merged 1 commit into from
Dec 27, 2023
Merged

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Dec 4, 2023

First approach for #33542 split to only have the read replica support in this PR. Follow up prepared in #42345

Fixes #40334

Summary

Make use of the PrimaryReadReplicaConnection class that Doctrine offers to be able to configure read replicas for Nextcloud databases.

Library docs: https://github.com/doctrine/dbal/blob/3.7.x/src/Connections/PrimaryReadReplicaConnection.php#L28C1-L76

Checklist

@mickenordin
Copy link
Contributor

Is this ready for testing, or does it need more work you think?

@juliushaertl juliushaertl force-pushed the enh/read-replica branch 2 times, most recently from 65089ee to 55cfca8 Compare December 16, 2023 12:09
@juliushaertl juliushaertl force-pushed the enh/read-replica branch 4 times, most recently from 6882810 to 1a1e6f9 Compare December 16, 2023 19:17
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliushaertl
Copy link
Member Author

Should be good now for testing @mickenordin :)

@juliushaertl juliushaertl added 3. to review Waiting for reviews pending documentation This pull request needs an associated documentation update and removed 2. developing Work in progress labels Dec 18, 2023
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

I can see how wrong development can nullify the efforts, but it's a start and can only get better forward

@mickenordin
Copy link
Contributor

Is this only for performance, or will there be failover to a replica, if the primary fails?

@juliushaertl
Copy link
Member Author

Is this only for performance, or will there be failover to a replica, if the primary fails?

Only for performance and read only replicas.

@juliushaertl
Copy link
Member Author

I can see how wrong development can nullify the efforts, but it's a start and can only get better forward

Just to mention, there is some follow up for that already in the queue at #42345

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Makes sense!!

@@ -237,7 +233,11 @@ public function createConnectionParams(string $configPrefix = '') {
$connectionParams['persistent'] = true;
}

return $connectionParams;
$replica = $this->config->getValue('dbreplica', []) ?: [$connectionParams];
Copy link
Contributor

Choose a reason for hiding this comment

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

I found that one a bit strange.

Isn't that the same as

$this->config->getValue('dbreplica', [$connectionParams]);

?

Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

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

Cool 👍

Also without configuring dbreplica it still works 🙌

@kesselb kesselb merged commit b9b0ca6 into master Dec 27, 2023
52 checks passed
@kesselb kesselb deleted the enh/read-replica branch December 27, 2023 20:57
@smorimoto
Copy link

This is really fantastic! I was really thinking about whether I should set up YugabyteDB or not!

@smorimoto
Copy link

smorimoto commented Dec 28, 2023

How can I use different port(s)?

@smorimoto
Copy link

@juliushaertl Can you set this as the milestone for 28? It would be great to include this in the next minor release!

@juliushaertl
Copy link
Member Author

We only backport bugfixes and this is a larger enhancement so currently only targeting Nextcloud 29.

@smorimoto
Copy link

That's a sad thing... I'm not familiar with the release cycle of Nextcloud, so when will 29 be released?

@juliushaertl
Copy link
Member Author

Current planned schedule is in https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule

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

Successfully merging this pull request may close these issues.

Read-only database replica support
7 participants