@tsteur opened this Pull Request on July 21st 2019 Member

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 https://github.com/matomo-org/matomo/issues/7554

@tsteur commented on July 22nd 2019 Member

@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.

@mattab commented on July 22nd 2019 Member

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 commented on July 22nd 2019 Member

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 commented on July 22nd 2019 Member

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 commented on July 22nd 2019 Member

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

This Pull Request was closed on July 22nd 2019
Powered by GitHub Issue Mirror