percona-xtrabackup icon indicating copy to clipboard operation
percona-xtrabackup copied to clipboard

PXB-2264 Auto increment information is removed after partial restore …

Open rahulmalik87 opened this issue 2 years ago • 5 comments

…of a table

https://jira.percona.com/browse/PXB-2264

Problem: If a table has next auto incremental value 2 then the table exported through PXB has next auto incremental value 1 instead of 2.

Analysis: To get the next autoinc, PXB fetches the current autoinc value from DD tables and increase it by 1. Also it intialize the autoinc value as 1. There is a addition check to not increase the autoinc when DD autoinc is same as current table autoinc. This means autoinc is already correctected by metadata applier through open table. Subject table has autoinc in 1 in DD table and it is also initialize with value 1 So PXB do not increase the counter and with export this value is set as 1.

Fix: PXB intialize autoinc_persisted with 0. So Increase the counter if autoinc persisisted is not same as autoinc presisted from DD tables.

rahulmalik87 avatar Mar 14 '22 10:03 rahulmalik87

Can you describe why the server doesn't face the same issue? Shouldn't we match the server behavior?

Server open the table before doing FLUSH table for export. and as part of open It call MetadataRecover::apply() which fixes this with same logic.

rahulmalik87 avatar Mar 14 '22 11:03 rahulmalik87

Can you describe why the server doesn't face the same issue? Shouldn't we match the server behavior?

Server open the table before doing FLUSH table for export. and as part of open It call MetadataRecover::apply() which fixes this with same logic.

@rahulmalik87 Can we call the dictmetadata apply during startup?

satya-bodapati avatar Mar 14 '22 14:03 satya-bodapati

@rahulmalik87 did you trying loading the autoinc metadata at startup?

Hello @satya-bodapati , we load the dynamic metadata at the startup that is where the fix is inside metadata_applier.

rahulmalik87 avatar Mar 29 '22 05:03 rahulmalik87

@rahulmalik87 did you trying loading the autoinc metadata at startup?

Hello @satya-bodapati , we load the dynamic metadata at the startup that is where the fix is inside metadata_applier.

@rahulmalik87 I mean, do same as server, call MetadataRecover::apply(). Another option is to write back to DD on full backup prepare

satya-bodapati avatar Mar 29 '22 09:03 satya-bodapati

@rahulmalik87 waiting for Jenkins Link

satya-bodapati avatar Jul 26 '22 07:07 satya-bodapati

Jenkin reslut https://pxb.cd.percona.com/job/percona-xtrabackup-8.0-test-param/285/#showFailuresLink

rahulmalik87 avatar Feb 27 '23 11:02 rahulmalik87