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

plugin mysql: add multisource replication support #4133

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

lurkr2
Copy link

@lurkr2 lurkr2 commented Aug 14, 2023

mysql plugin: add multisource replication support
ChangeLog: mysql plugin: add multisource replication support

@lurkr2 lurkr2 requested a review from a team as a code owner August 14, 2023 17:54
@@ -5487,6 +5487,7 @@ Synopsis:
Host "localhost"
Socket "/var/run/mysql/mysqld.sock"
SlaveStats true
MariaDb false
Copy link
Member

Choose a reason for hiding this comment

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

Can we please name the option more descriptive? Like MultiSourceReplication?

Copy link
Author

Choose a reason for hiding this comment

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

the variable includes mariadb dialect, multisource-replication on the vanilla version is determined automatically

Copy link
Author

@lurkr2 lurkr2 Aug 21, 2023

Choose a reason for hiding this comment

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

Maybe MariaDbMultiSourceReplication?, or let's leave it as it is for the future.
MariaDb very different from Vanilla mysql

Copy link
Member

Choose a reason for hiding this comment

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

I am very in favor of having a more speaking name. MariaDb sounds very generic and may lead to misunderstandings.

Copy link
Author

Choose a reason for hiding this comment

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

src/mysql.c Outdated
@@ -60,6 +60,7 @@ struct mysql_database_s /* {{{ */

bool primary_stats;
bool replica_stats;
bool mariadb;
Copy link
Member

Choose a reason for hiding this comment

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

same here then

Copy link
Author

Choose a reason for hiding this comment

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

test.zip
docker-compose scenario for test mariadb/vanilla

Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

mysql_read_replica_stats() is now way too large / complex:

$ complexity mysql.c 
NOTE: proc mysql_read_replica_stats in file mysql.c line 429
	nesting depth reached level 5
Complexity Scores
Score | ln-ct | nc-lns| file-name(line): proc-name
   40     228     189   mysql.c(803): mysql_read
   53     193     177   mysql.c(429): mysql_read_replica_stats

It should be split into multiple functions.

(mysql_config_database() has also fairly high complexity score. One can see it by using pmccabe instead of GNU complexity, or lowering latter's default threshold.)

const char *query;
int field_num;
const char *query, *channel_name_field;
unsigned char field_num, field_req;
Copy link
Contributor

@eero-t eero-t Aug 18, 2023

Choose a reason for hiding this comment

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

Why 8-bit variables for the counters instead of e.g. (unsigned) ints?

Copy link
Author

Choose a reason for hiding this comment

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

reduce usage ram, unsigned char - 1 byte, AFAIK

Copy link
Contributor

Choose a reason for hiding this comment

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

Performance claims should be backed up by evidence. :-)

What e.g. "file collecd" states for compiled collectd code (text section) sizes when you use unsigned int vs. unsigned char?

@mrunge mrunge changed the title plugin mysql: add multisource repliacation support plugin mysql: add multisource replication support Aug 27, 2023

Enable Multisource replication Mariadb support.
Enable Multisource replication MariadbDialect support.
Copy link
Member

Choose a reason for hiding this comment

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

This may sound like splitting hairs or overly critical, but what should "MariadbDialect" be? I think this needs a little bit more explanation, what exactly does this switch do?

Copy link
Author

Choose a reason for hiding this comment

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

ok, added like in telegraf :)

@lurkr2 lurkr2 requested a review from a team as a code owner September 6, 2023 19:37
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.

None yet

3 participants