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
base: main
Are you sure you want to change the base?
plugin mysql: add multisource replication support #4133
Conversation
src/collectd.conf.pod
Outdated
@@ -5487,6 +5487,7 @@ Synopsis: | |||
Host "localhost" | |||
Socket "/var/run/mysql/mysqld.sock" | |||
SlaveStats true | |||
MariaDb false |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe MariadbDialect, like telegraf (https://github.com/influxdata/telegraf/blob/master/plugins/inputs/mysql/mysql.go) ?
src/mysql.c
Outdated
@@ -60,6 +60,7 @@ struct mysql_database_s /* {{{ */ | |||
|
|||
bool primary_stats; | |||
bool replica_stats; | |||
bool mariadb; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here then
There was a problem hiding this comment.
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
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
|
||
Enable Multisource replication Mariadb support. | ||
Enable Multisource replication MariadbDialect support. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
mysql plugin: add multisource replication support
ChangeLog: mysql plugin: add multisource replication support