Navigation Menu

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

Support configuration of a reader database #14681

Merged
merged 1 commit into from Jul 22, 2019
Merged

Support configuration of a reader database #14681

merged 1 commit into from Jul 22, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jul 21, 2019

If configured, most archiving, live, and archive reading queries (when browser archiving is disabled) will be read from a reader instead of the master. This means mainly the tracker will hit the master database and when writing archives.

FYI added a system check that connection works if a reader is configured.

fix #7554

@tsteur tsteur added Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. Needs Review PRs that need a code review and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Jul 21, 2019
@tsteur tsteur added this to the 3.12.0 milestone Jul 22, 2019
@tsteur
Copy link
Member Author

tsteur commented Jul 22, 2019

@mattab @sgiehl @diosmosis could you have a quick look at this? Any thoughts?

Tested it locally and worked quite well. Also adjusted all our premium features to use LogAggregator::getDb() and VisitorDetailsAbstract::getDb() // in a BC way so in the future the core can easily decide/control whether to use reader or master etc.

Once I get the OK will give it a test on a different Matomo.

@tsteur tsteur changed the title Support configuration of a slave database Support configuration of a reader database Jul 22, 2019
@mattab
Copy link
Member

mattab commented Jul 22, 2019

Didn't look at the code in details but the idea sounds great! Many users will have slave databases running doing nothing and this is a great way to leverage this valuable CPU.

Just wondering, what happens if the reader goes down, would it maybe help to full back to master automatically or is it better to fail explicitly?

Edit: it would be great to document this feature in an faq

@tsteur
Copy link
Member Author

tsteur commented Jul 22, 2019

For now it would just fail. Would otherwise need a lot of extra code etc. It's just to get a quick win. Later you can at some point do a lot more with it.

@tsteur
Copy link
Member Author

tsteur commented Jul 22, 2019

Maybe we could merge this feature already? Considering it will use regular DB if no reader is defined it shouldn't change anything. Can also patch this later though.

@diosmosis
Copy link
Member

Code looks good to me, seems ok to merge to me

@tsteur tsteur merged commit a50080b into 3.x-dev Jul 22, 2019
@tsteur tsteur deleted the dbslave branch July 22, 2019 23:21
@mattab mattab modified the milestones: 3.13.0, 3.11.0 Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add auxiliary database support for big instances
3 participants