Repository navigation
MDEV-40294 mariadb-binlog --start/stop-datetime incorrectly accepts o… - #5983
Zeyadzahran wants to merge 1 commit into
Conversation
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
Please:
- address the test failures in buildbot
- add a commit message to your commit
Otherwise the change seems logical.
I'd do an error since this is changing what's explicitly been specified by the user. But I can live with a warning too. It's something for the final reviewer to decide I guess.
f73e78a to
0f58265
Compare
gkodinov
left a comment
There was a problem hiding this comment.
LGTM. Please stand by for the final review.
|
Thanks @gkodinov for the review! I addressed both points. About error vs warning, my first approach was an error, but Jimmy suggested a warning with clamping in Jira, since values like these were accepted before and some scripts might not sanitize their inputs, so an error could break them. |
ParadoxV5
left a comment
There was a problem hiding this comment.
Thanks for helping out.
| --echo # over-max timestamps | ||
| --echo # | ||
| --exec $MYSQL_BINLOG --short-form "--start-datetime=2106-02-08 00:00:00" $MYSQL_TEST_DIR/std_data/binlog_transaction.000001 2>&1 | ||
| --exec $MYSQL_BINLOG --short-form "--stop-datetime=2106-02-08 00:00:00" $MYSQL_TEST_DIR/std_data/binlog_transaction.000001 2> /dev/null |
There was a problem hiding this comment.
Well that’s a lot of data in the .result file, but only 2 warnings out of 3 test cases.
Did you mean?
| --exec $MYSQL_BINLOG --short-form "--stop-datetime=2106-02-08 00:00:00" $MYSQL_TEST_DIR/std_data/binlog_transaction.000001 2> /dev/null | |
| --exec $MYSQL_BINLOG --short-form "--stop-datetime=2106-02-08 00:00:00" $MYSQL_TEST_DIR/std_data/binlog_transaction.000001 > /dev/null |
If the test focuses on warnings, then it makes sense to squelch the stdout of all of these cases.
But I suppose this test doubles as a max-boundary output test; in this case, it’s better to keep them, with a smaller file to reduce output size.
(FYI, /dev/null might not work on Windoze (MDEV-41085), so error message tests like this use --result-file=path/to/throwaway_file.)
There was a problem hiding this comment.
P.S.
Back-to-back binlog output can easily become unreadable without some --echo labels, though these warnings are sufficient dividers because they’re before the cases’ actual output.
There was a problem hiding this comment.
The 2> was on purpose because of the Windows issue (your comment on the .result). Now all 4 cases show their warnings, I switched to binlog_savepoint.000001 which is about half the size, and there's no /dev/null anymore. Also added an --echo before each case, it reads better.
There was a problem hiding this comment.
Choosing binlog_savepoint.000001 “for consistency with earlier in this test1” is okay.
Though, not far above your addition, there’s a test that generates $MYSQLD_DATADIR/master-bin.000001 (and doesn’t purge it in the name of corruption).
Looks like it’ll give an even smaller output.
(Size doesn’t matter too much; it’s about reducing the noise.
The option with the smallest yet sufficient output is most likely to generate a binlog file with only one entry.)
Footnotes
-
apparently the only thing that uses
binlog_savepoint.000001↩
There was a problem hiding this comment.
I tried a generated one, but it prints sql_mode and collation_server, which differ between builders, so it needs the same replace_regex as the other cases here. Felt like more noise in the .test than it saves in the .result, so I kept binlog_savepoint.000001.
0f58265 to
190d9b4
Compare
190d9b4 to
2029147
Compare
…ver-max timestamps For a value outside of the TIMESTAMP range, my_system_gmt_sec() returns 0 and sets ER_WARN_DATA_OUT_OF_RANGE, but convert_str_to_timestamp() never checked it. So such values silently became 1970: an over-max --start-datetime printed every event and an over-max --stop-datetime printed none. Print a warning for out of range values and clamp the over-max ones to the max timestamp. Under-min values already became the min.
2029147 to
793539a
Compare
Jira: MDEV-40294
--start-datetimeand--stop-datetimesilently treated values outside of the TIMESTAMP range as 1970, so an over-max--start-datetimeprinted every event and an over-max--stop-datetimeprinted none.my_system_gmt_sec()returns 0 and setsER_WARN_DATA_OUT_OF_RANGEfor such values, butconvert_str_to_timestamp()never checked it. Now it prints a "Date and time argument out of range" warning and clamps over-max values to the max timestamp.Tests: new cases in
main.mysqlbinlog, which fail without the fix.main.mysqlbinlogand the relatedbinlogtests pass on a debug build.I am contributing my new code of the whole pull request, including one or several files that are either new files or modified ones, under the BSD-new license.