Issues

Select view

Select search mode

 

Fix for PT-1455 introduced new bug

Description

The fix for --PT-1455-- (which allows a table to be altered even when there's replication filters on the slave that prevent the table from being created) introduced a new bug where the check for EXPLAINs on the slave side fails:

pt-online-schema-change --max-load=threads_running=500 --chunk-size=100000 --execute --progress=time,10 --max-lag=300 --nocheck-replication-filters --nocheck-plan --execute --alter="ADD COLUMN c CHAR(32)" D=test,t=norep1,u=msandbox,p=msandbox,P=20393,h=127.0.0.1 > /tmp/pt-osc.debug 2>&1

 

# NibbleIterator:5903 25759 Auto-selecting best index # TableParser:3386 25759 Indexes sorted best-first: PRIMARY # NibbleIterator:5936 25759 Best index: PRIMARY # NibbleIterator:5489 25759 One nibble statement: INSERT LOW_PRIORITY IGNORE INTO `test`.`_norep1_new` (`i`) SELECT `i` FROM `test`.`norep1` LOCK IN SHARE MODE /*pt-online-schema-change 25759 copy table*/ # NibbleIterator:5499 25759 Explain one nibble statement: EXPLAIN SELECT `i` FROM `test`.`norep1` LOCK IN SHARE MODE /*explain pt-online-schema-change 25759 copy table*/ # NibbleIterator:5983 25759 Preparing statement handles 2018-04-14T15:09:17 Copying approximately 4 rows... # pt_online_schema_change:9478 25759 Getting table row estimate on replicas # NibbleIterator:5971 25759 EXPLAIN SELECT * FROM `test`.`norep1` WHERE 1=1 # CleanupTask:6551 25759 Calling cleanup task CODE(0x33f4728) # pt_online_schema_change:9363 25759 Clean up triggers

 

This explain is done when table is processed in a single chunk on the master side.  See attached pt-osc.debug for full run.

 

Environment

None

Attachments

1
  • 14 Apr 2018, 07:16 PM

Smart Checklist

Details

Assignee

Reporter

Priority

Affects versions

Fix versions

Smart Checklist

Created April 14, 2018 at 7:16 PM
Updated January 13, 2024 at 8:05 PM

Activity

Lalit ChoudharyDecember 17, 2018 at 10:43 AM

Thank you for the report

Validated against current latest version pt-online-schema-change 3.0.12

 

Test:

 

slave: replicate-ignore-table=test.sbtest5 on Master: pt-online-schema-change --max-load=threads_running=500 --chunk-size=100000 --execute --progress=time,10 --max-lag=300 --nocheck-replication-filters --nocheck-plan --execute --alter="ADD COLUMN c1 CHAR(32)" D=test,t=sbtest5,u=msandbox,p=msandbox,P=21599,h=127.0.0.1 Found 2 slaves: lalit-ThinkPad-T480 -> SBslave1:21600 lalit-ThinkPad-T480 -> SBslave2:21601 Will check slave lag on: lalit-ThinkPad-T480 -> SBslave1:21600 lalit-ThinkPad-T480 -> SBslave2:21601 Operation, tries, wait: analyze_table, 10, 1 copy_rows, 10, 0.25 create_triggers, 10, 1 drop_triggers, 10, 1 swap_tables, 10, 1 update_foreign_keys, 10, 1 Altering `test`.`sbtest5`... Creating new table... Created new table test._sbtest5_new OK. Altering new table... Altered `test`.`_sbtest5_new` OK. 2018-12-17T16:10:19 Creating triggers... 2018-12-17T16:10:19 Created triggers OK. 2018-12-17T16:10:19 Copying approximately 1000 rows... 2018-12-17T16:10:19 Dropping triggers... 2018-12-17T16:10:19 Dropped triggers OK. 2018-12-17T16:10:19 Dropping new table... 2018-12-17T16:10:19 Dropped new table OK. `test`.`sbtest5` was not altered. 2018-12-17T16:10:19 Error copying rows from `test`.`sbtest5` to `test`.`_sbtest5_new`: DBD::mysql::db selectrow_hashref failed: Table 'test.sbtest5' doesn't exist [for Statement "EXPLAIN SELECT * FROM `test`.`sbtest5` WHERE 1=1"] at /home/lalit/perl5/bin/pt-online-schema-change line 5996.

 

 

 

Shashank SahniDecember 16, 2018 at 8:59 PM

Yes. This behavior is a bit unintuitive. Is it possible to just check for slave lag and not look for specific tables being copied?