Commit Graph

305 Commits

Author SHA1 Message Date
Sveta Smirnova
f9726e75cc PT-1059 tools cannot parse index names containing newlines (#578)
* PT-1059 - Tools can't parse index names containing newlines

Fixed regular expressions in TableParser.
Added test case, including test for new lines in the column name

* PT-1059 - Tools can't parse index names containing newlines

Disabled pt-1637.t until PT-2174 is fixed.
Updated number of tables in b/t/pt-table-checksum/issue_1485195.t

* Patch newlines in table columns (#369)

Will accept this change as part of the fix for PT-1059 - Tools cannot parse index names containing new lines. We will later fix the issue with the patch ourselves.

mysql 5.6.40 allows newlines in column names however the following code:

my @defs = $ddl =~ m/^(\s+`.*?),?$/gm;

breaks due to it detecting newlines as line ends. The 'm' argument at the end does this by auto-detecting lines by newline characters.

To correct this issue I've made use of zero-length assertions known as " positive lookback"

https://www.regular-expressions.info/lookaround.html

what does it do?

m/(?:(?<=,\n)|(?<=\(\n))(\s+`(?:.|\n)+?`.+?),?\n/g;

TLDR:

Treat the string as one long string and don't treat \n as the end of a line.

look for (\s+`(?:.|\n)+?`.+?),?\n

if one of those matches look at what precedes the string

if it's ',\n' or ')\n' the string matches. Only save what's in (\s+`(?:.|\n)+?`.+?),?\n

m/ is declaring this a matching regex.

(?:(?<=,\n)|(?<=(\n)) This is an OR statement including two look-behind clauses. The ?: tells the enclosing parentheses to not store the result as a variable. I've put the two look-behinds in this OR statement below this line:

(?<=,\n) Look behind the matched string for a comma followed by a newline, the comma must be there for this look behind to match.

(?<=(\n) Look behind the matched string for a open parentheses followed by a newline, the open parentheses must be there.

(\s+`(?:.|\n)+?`.+?),?\n This is the actual match. Match newline character followed by one or more spaces followed by back-tick followed by a character which can be any character or a newline one or more times, but don't be greedy and take the rest of the match into consideration. Followed by a back tick and any character one or more times. This match stops where there is a comma or failing that a newline following a back tick and some characters.

,?\n match a comma that may not be there followed by a newline.
/g don't stop if this pattern matches keep looking for more patterns to the end of the string.

* PT-1059 - Tools can't parse index names containing newlines

Placed fix from PR-369 into proper place and created test case for this fix.

---------

Co-authored-by: geneguido <31323560+geneguido@users.noreply.github.com>
2023-02-02 17:09:13 +03:00
Sveta Smirnova
a7efd8c94e PT-2138 - fix tests for pt table checksum (#568)
* PT-2138 - Fix tests for pt-table-checksum

- Updated t/pt-table-checksum/samples/default-results-8.0.txt and
t/pt-table-checksum/samples/static-chunk-size-results-8.0.txt
to support latest MySQL 8.0 version. Tests are now incompatible with elder 8.0 releases.
- Put fix for PT-136 into package RowChecksum
- Added execution bit for pt-online-schema-change

* PT-2138 - Fix tests for pt-table-checksum

- Fixed percona_test.load_data, so it really tests if LOAD DATA LOCAL INFILE is enabled
- Fixed option --[no]create-replicate-table, broken by commit c9836d5962

* PT-2138 - Fix tests for pt-table-checksum

- Enabled t/pt-table-checksum/error_handling.t for MySQL 8.0
- Fixed test t/pt-table-checksum/fnv_64.t and it's samples file
t/pt-table-checksum/samples/fnv64-sakila-city.txt
to reflect new function name convention and
changes after 62d84e5dba

* PT-2138 - Fix tests for pt-table-checksum

- Fixed t/pt-table-checksum/issue_1485195.t, so it checks only one table and
isn't get broken when we add tables into percona_test database
- Fixed typo in error output of bin/pt-table-checksum
- Skipped issue_47.t in 8.0 until https://jira.percona.com/browse/PT-1805 is fixed

* PT-2138 - Fix tests for pt-table-checksum

- Disabled pt-131.t for 8.0, because it does not have the QUERY_RESPONSE_TIME plugins
- Added SLOW_TESTS check to pt-1616.t
- Updated pt-226.t to include the fix for PT-1766
- For replication_filters.t: excluded false positive expression for tests 10 and 11 and added sys schema to the list of checked databases for 8.0
- Changed get_slaves in lib/MasterSlave.pm, so it returns slave's parent, required for wait_for_slaves in pt-table-checksum to work properly with chained slaves

* PT-2138 - Fix tests for pt-table-checksum

- Modified pt-204.t  to support 8.0 and diffs in system tables due to timestamps
Moved the fix for PT-1616 into the proper place: lib/NibbleIterator.pm

* PT-2138 - Fix tests for pt-table-checksum

- pxc.t -added mysql.proxies_priv into ignore list, because its timestamp is different on node
- pxc.t - removed FORK=pxc from statup options for slave (non-cluster) nodes
- pxc.t - disabled wsrep replication with help of the variable wsrep_on: sql_log_bin doesn't disable wsrep replication anymore. See https://jira.percona.com/browse/PXC-3464 for details
- Removed data.tar.gz from 5.7 sandbox configuration, because it has an outdated definition for Performance Schema
- Disabled pxc.t for version 8.0 until PT-1699 is fixed
- start-sandbox - removed the first line (ALTER USER) from the init file, because it was rewritten by the next echo command, and then repeated later.

* PT-2138 - Fix tests for pt-table-checksum

- Adopted issue_1485195.t and basics.t for MyRocks-enabled setup
- replication_filters.t - added sys schema to the list of expected schemas for 5.7 and 8.0
- issue_1485195.t - added checks for the existence of mysql.plugin, func, and proxies_priv tables
- added samples/pt-131-wipe.sql that uninstalls QRT plugin if it was earlier installed by this test
-adjusted return code in pt-204.t, because expected differences in mysql.proxies_priv

* Update lib/PerconaTest.pm

removed diagnostic code

Co-authored-by: Carlos Salguero <carlos.salguero@percona.com>

Co-authored-by: Carlos Salguero <carlos.salguero@percona.com>
2022-12-28 23:09:13 +03:00
Carlos Salguero
b5a593dc16 Updated TableNibbler 2020-03-31 13:19:26 -03:00
Carlos Salguero
2821b847b3 PT-1766 Fixed DIFF_ROWS calculation
- Fixed DIFF_ROWS calculation
- Removed unused param --force-concat-enums
2019-12-23 08:42:38 -03:00
Carlos Salguero
ed6ebcedbd Updated changelog and tests 2019-09-06 06:25:52 -03:00
Carlos Salguero
5c4a6bd5e1 PT-1728 Fixed missing Quoter pkg 2019-05-30 09:56:26 -05:00
Carlos Salguero
a4d6aabe67 PT-1728 Added test 2019-05-21 15:10:13 -03:00
Carlos Salguero
f7722200e8 Revert "Merge pull request #380 from percona/PT-1114"
This reverts commit bcbc175d0c, reversing
changes made to cf5c661d46.
2019-01-08 10:33:24 -03:00
Carlos Salguero
89f8d03d74 PT-1114 pt-table-checksum fails when table is empty 2018-12-10 16:25:22 -03:00
Carlos Salguero
1703ee58a4 PT-1637 Added tests and exit code 2018-11-08 15:35:25 -03:00
Carlos Salguero
c5ec28fcd6 PT-1637 Added --fail-on stopped-replication param to table checksum 2018-11-08 14:18:18 -03:00
Carlos Salguero
9d52a1b5e2 PT-1616 Added invalid utf-8 chars to the test 2018-10-07 14:00:39 -03:00
Carlos Salguero
97df37a94e PT-1616 Failing test case using plain varchar fields 2018-09-25 13:30:12 -03:00
Carlos Salguero
8f0c80891c PT-1616 Added failing test case 2018-09-24 19:12:19 -03:00
Carlos Salguero
03ff3c314a PT-1572 Fixed MySQL 8 tests 2018-07-30 11:41:10 -03:00
Carlos Salguero
d2c4f57a52 PT-1572 Updated tests 2018-07-28 16:08:27 -03:00
Carlos Salguero
345b7c1d0a Fixed test for MySQL 5.6 2018-06-27 23:21:26 -03:00
Carlos Salguero
9ee287ffdb Updated sample files for table-checksum 5.7 2018-06-27 15:50:59 -03:00
Carlos Salguero
6776631ec0 PT-1554 Fixed typo 2018-06-22 15:47:47 -03:00
Carlos Salguero
4f017cc61a PT-1554 Fixed tests for MySQL 8 2018-06-22 14:56:02 -03:00
Carlos Salguero
d9142df0f6 PT-1551 New wait for master method to pt-table-checksum
This is part of PT-1554. While I was testing pt-table-checksum
ignore_columns.t was failing and it was because the original method in
pt-table-checksum to wait for the slaves to catch up, wasn't enough.
I added a new method who calls MySQL's SELECT MASTER_POS_WAIT from the
MasterSlave package.
2018-06-22 13:00:41 -03:00
Carlos Salguero
c1d0134525 PT-1554 Made tests for table checksum reliable under MySQL 8 2018-06-20 15:23:04 -03:00
Carlos Salguero
0004bb7bbc PT-1554 (WIP) Tests for MySQL 8
There are tests failing but the sandbox doesn't crash
2018-05-30 21:25:28 -03:00
Carlos Salguero
abd84d03a8 PT-1554 Trying to debug to find why t/pt-table-checksum/pt-136.t fails on docker 2018-05-26 19:52:12 -03:00
Carlos Salguero
445d38f359 PT-1554 Test a fix for pt-136 & ps 5.7 2018-05-26 17:10:14 -03:00
Carlos Salguero
b9b152a395 PT-1554 Tests for ps 5.7 2018-05-26 15:07:38 -03:00
Carlos Salguero
50ad844666 Merge pull request #327 from percona/PT-131-a
PT-131 Disable QRT plugin in pt-table-checksum
2018-05-18 14:27:59 -03:00
Carlos Salguero
e8e8d010cb PT-118 Updated tests for MySQL 5.5
Also, sandbox data file (data.tar.gz) was broken.
2018-05-07 16:46:49 -03:00
Carlos Salguero
bf37c0fe5a PT-118 Updated tests for MySQL 5.6 2018-05-07 16:03:56 -03:00
Carlos Salguero
0ae801f3b0 PT-118 Updated tests for t/pt-table-checksum/issue_388.t 2018-05-07 15:41:12 -03:00
Carlos Salguero
caf95f62f7 PT-118 Updated tests for pt-table-checksum/resume.t 2018-05-07 15:33:19 -03:00
Carlos Salguero
85ad206679 PT-118 Updated test for t/pt-table-checksum/pt-226.t 2018-05-07 15:28:12 -03:00
Carlos Salguero
0501558a2e PT-118 Updated tests for pt-table-checksum/error_handling.t 2018-05-07 15:11:33 -03:00
Carlos Salguero
117292b897 PT-118 Updated tests for create_replicate_table.t 2018-05-07 14:39:19 -03:00
Carlos Salguero
458f36c0cc PT-118 Updated tests for char_chunking.t 2018-05-07 14:33:05 -03:00
Carlos Salguero
d17ce01318 PT-118 Updated tests for basics.t 2018-05-07 14:20:30 -03:00
Carlos Salguero
0ade173d0f PT-131 Disable QRT plugin in pt-table-checksum
The use of QRT plugin to monitor the health of production worloads cause the QRT data
to show massive spikes in latency, even thought the workload is relatively unaffected.

Tags: pt-table-checksum
See also: PS-235
2018-04-27 15:37:00 -03:00
Carlos Salguero
51dcca5959 PT-572 Fixes for MySQL 8
- Updated sandbox data file
- Fixes for pt-upgrade since there is no query_cache in MySQL 8
- Updates for SchemaIterator since there are new/renamed tables in MySQL 8
- Disabled some tests due to errors in MySQL 8.0.4-rc
2018-02-01 11:30:12 -03:00
Carlos Salguero
f3132d3cee WIP 2018-01-25 00:01:56 -03:00
Carlos Salguero
bb3334de08 Updated tests for MySQL 5.7 2017-12-16 20:54:03 -03:00
Carlos Salguero
806caff5f5 PT-207 Updated tests for table-checksum - resume 2017-12-16 12:10:03 -03:00
Carlos Salguero
f954a69dd4 PT-207 Fixed test for generated fields. (added mysql version constraint) 2017-12-16 11:58:49 -03:00
Carlos Salguero
91f54ff8af PT-207 updated samples for pt-table-checksum tests 2017-12-16 11:52:22 -03:00
Carlos Salguero
3d343e6ff3 PT-207 fixed tests for pt-table-checksum 2017-12-16 11:43:30 -03:00
Carlos Salguero
99a17cd041 PT-207 Fixed tests 2017-12-16 11:28:03 -03:00
Carlos Salguero
a8f2329721 Merge branch '3.0' into PT-204 2017-12-06 15:01:47 -03:00
Carlos Salguero
5a53f966c2 PT-204 Added tests 2017-12-06 11:18:25 -03:00
Carlos Salguero
b2325fee38 PT-204 WIP 2017-12-05 11:00:18 -03:00
Carlos Salguero
17ecf7eb0a PT-225 pt-table-cheksum ignores generated columns 2017-11-23 17:26:16 -03:00
Carlos Salguero
ebe0569a9d Added test for binlog_format set in pt-table-checksum 2017-11-23 10:36:09 -03:00