-
Priyanka Sangam authored
An UPDATE_ROW binlog event contains 2 versions of the updated row: a Before Image which has the row before the update, and an After Image of the row after the update. The Before and After Image do not always include all the columns in the row. The binlog format decides which columns will be included. There is a requirement in ndbcluster to reduce the size of the binlog event while retaining the UPDATE_ROW format of BeforeImage/AfterImage. This can be done by writing only primary key columns from the Before Image and only modified columns from the After Image. However, the existing binlog formats do not support different sets of columns in the Before and After Images. The --binlog-format=MINIMAL option is not usable for ndbcluster because enabling the binlog format code breaks the --ndb-log-updated-only option in ndb replication. This patch implements 2 new ndb binlog formats for UPDATE_ROW where the Before Image and After Image are minimised to remove duplicate information. UPDATED_ONLY_USE_UPDATE_MINIMAL: log update as UPDATE_ROW, log only primary key columns in Before Image and only updated columns in After Image FULL_USE_UPDATE_MINIMAL: log update as UPDATE_ROW, log only primary key columns in Before Image and all non primary key columns in After Image This means that each column is contained only once in each event, bringing efficiency close to that achieved by the variants logging with WRITE_ROW events. The UPDATED_ONLY_USE_UPDATE_MINIMAL and FULL_USE_UPDATE_MINIMAL formats can be used with the conflict resolution algorithms NDB$EPOCH(), NDB$EPOCH2() and NDB$EPOCH_TRANS(), because these do not require the 'Before' values of non-primary-key-columns. Conflict resolution algorithms like NDB$MAX() and NDB$OLD() require the old values of non-PK columns, and will not work correctly with these new variants.
Priyanka Sangam authoredAn UPDATE_ROW binlog event contains 2 versions of the updated row: a Before Image which has the row before the update, and an After Image of the row after the update. The Before and After Image do not always include all the columns in the row. The binlog format decides which columns will be included. There is a requirement in ndbcluster to reduce the size of the binlog event while retaining the UPDATE_ROW format of BeforeImage/AfterImage. This can be done by writing only primary key columns from the Before Image and only modified columns from the After Image. However, the existing binlog formats do not support different sets of columns in the Before and After Images. The --binlog-format=MINIMAL option is not usable for ndbcluster because enabling the binlog format code breaks the --ndb-log-updated-only option in ndb replication. This patch implements 2 new ndb binlog formats for UPDATE_ROW where the Before Image and After Image are minimised to remove duplicate information. UPDATED_ONLY_USE_UPDATE_MINIMAL: log update as UPDATE_ROW, log only primary key columns in Before Image and only updated columns in After Image FULL_USE_UPDATE_MINIMAL: log update as UPDATE_ROW, log only primary key columns in Before Image and all non primary key columns in After Image This means that each column is contained only once in each event, bringing efficiency close to that achieved by the variants logging with WRITE_ROW events. The UPDATED_ONLY_USE_UPDATE_MINIMAL and FULL_USE_UPDATE_MINIMAL formats can be used with the conflict resolution algorithms NDB$EPOCH(), NDB$EPOCH2() and NDB$EPOCH_TRANS(), because these do not require the 'Before' values of non-primary-key-columns. Conflict resolution algorithms like NDB$MAX() and NDB$OLD() require the old values of non-PK columns, and will not work correctly with these new variants.
Loading