[MXS-136] Check for MaxScale replication heartbeat table existence before creating Created: 2015-05-12  Updated: 2017-12-01  Due: 2015-05-29  Resolved: 2015-06-17

Status: Closed
Project: MariaDB MaxScale
Component/s: mariadbmon
Affects Version/s: 1.1.0
Fix Version/s: 1.2.0

Type: New Feature Priority: Minor
Reporter: martin brampton (Inactive) Assignee: martin brampton (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Epic Link: MaxScale 1.2 Features

 Description   

Avoid schema operations in the creation of the maxscale_schema database and replication_heartbeat table. (They cause problems with an NDB cluster).



 Comments   
Comment by martin brampton (Inactive) [ 2015-05-22 ]

Don't attempt to create heartbeat table if already exists. Don't create database, assume MaxScale user does not have rights to create databases.

Comment by Dipti Joshi (Inactive) [ 2015-06-17 ]

markus makela Is this for 1.2.0 or after 1.2.0 (1.2.1) ?

Comment by markus makela [ 2015-06-17 ]

Added conditional parts to the queries that create the tables and databases.

Comment by martin brampton (Inactive) [ 2015-06-30 ]

On examination, there was a further problem. The existing code created the database, and then the table. But this assumes that the MaxScale user has permissions for creating databases. It is not desirable for the MaxScale user to have more than the minimum permissions required for correct operation. This does not include being able to create databases. It is therefore a requirement that the user manually create the maxscale_schema database if the delay monitoring feature is to be enabled.

The modification to the code is to check whether the database and table already exist by reading the information_schema database. If they already exist, no action is taken. If not, then an attempt is made to create the table, but not the database. This will succeed provided the user has pre-created the database and granted all rights on it to the MaxScale user. Pre-creation of the database and table obviates the NDB cluster problem.

The changes have been implemented and tested.

This is not new information, simply a clarification of the earlier work.

Comment by Daniel Poßmann [ 2016-03-17 ]

Was this really merged into a branch where it gets into a release?
The develop branch on github has still the same logic ("CREATE DATABASE ... IF NOT EXISTS"). I think this is not fixed.
We wanted to upgrade to the latest version since we are still using the MXS-136 branch with all of the bugs of that version which are fixed in later versions.

I rebased the original branch of this ticket to release-1.3.0, see https://github.com/godmodelabs/MaxScale/tree/MXS-136-1.3.0
The changes to the original are whitespaces and the logging parts (MXS_ERROR). Rest should be the same.
Should I create a pull request to the develop branch?

Comment by markus makela [ 2016-03-17 ]

It seems that the create statement is executed every time even if the table exists. I've taken a look at the merge and it looks OK so you could do a pull request against the develop branch and we'll get it into the next release.

Comment by Daniel Poßmann [ 2016-03-17 ]

Thanks! Pull request was created.

Generated at Thu Feb 08 03:57:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.