[MDEV-32069] Event count option for mariadb-binlog? Created: 2023-09-01  Updated: 2023-09-12

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Gilles Reeves Assignee: Brandon Nesterenko
Resolution: Unresolved Votes: 0
Labels: count, mariadb-binlog, option


 Description   

I am trying to understand the use of mariadb-binlog as a tool for viewing or processing binary logs.
I think that most of the time when you use such tool, it is for viewing or getting log events between a start point and an end point.
So, for that, you have options:
1. For starting:

  • --start-position, for starting at a numeric position, or a GTID list;
  • --start-datetime, for starting at a given timestamp;
  • --offset for skipping a given number of entries in the log.

2. For ending:

  • --stop-position, for ending at a numeric position, or a GTID list;
  • --stop-datetime, for ending at a given timestamp.

The problem with these ending options is that it is almost impossible to pick the proper one for achieving the expected ending.
Especially when you started with a GTID list: how to guess a GTID list reasonably close in the future from the starting one for not getting a too long list of events?
-xxxx-datetime is not a proper choice either. With both start and end, how to choose the correct one?

There is an --offset option for starting after a given number of events from the beginning.

Why isn't there a, for example, --count option, for getting a given number of events after the starting point, for example --count=100, and then stop, whatever was the chosen option for starting?
A little like the LIMIT option in SQL queries.
This would make the usage of this tool tremendously simpler.

I have to say that I am considering adding this option myself in the source code and re-compiling, as its implementation seems simple to achieve.

But the problem is that this manipulation would have to be done again with each version update, which complicates things a little.

Regards.

P.S.: Sorry for choosing the "Task" category to post this. If you had a “Feature Request” category, I definitely would have selected that one.



 Comments   
Comment by Brandon Nesterenko [ 2023-09-01 ]

Hi Gingko!

Thanks for creating this ticket. Would you be willing to create a PR for the feature? We would welcome the contribution. Though, as you mention the relation with the LIMIT clause in SQL, perhaps for consistency we should name the new option --limit (or something similar).

Thanks!

Comment by Gilles Reeves [ 2023-09-01 ]

Hi Brandon.

Thank you for your answer.

Maybe I could create a PR, but ………
What is a PR, exactly??

And for your information, --limit is actually the name that I finally chose for the compilation patch that I made, following the same idea as you, and it works perfectly, I must say (with -L — uppercase — for the short form). 10 lines added in the source code + comments.

Comment by Brandon Nesterenko [ 2023-09-01 ]

Ah sorry, a *P*ull *R*equest We have a guide on doing that here.

And there is also this page with some more information on contributing code.

if you're up for it, I'd be happy to share some similar patches that extended mariadb-binlog with new options that you can follow as examples.

Glad we're on the same page about the naming convention

Comment by Gilles Reeves [ 2023-09-12 ]

Hello,

The main issue, there, is that I probably need to fully understand, first, the whole logic of Git and GitHub whereas I have been only used to use Subversion so far.

This looks like a great deal of effort leading to nothing much, or « une montagne pour accoucher d'une souris » in French.

But who knows …

Generated at Thu Feb 08 10:28:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.