Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve applier .ReadMigrationRangeValues() func accuracy #1164

Merged

Conversation

timvaillancourt
Copy link
Collaborator

@timvaillancourt timvaillancourt commented Aug 13, 2022

Description

This PR moves the applier .ReadMigrationRangeValues() func to use a single transaction for both the min and max queries

Gathering these values in the same transaction is more accurate than the current approach where 2 x different auto-commit transactions grab these values

Lastly, the min/max funcs were made "private" because they're only called by .ReadMigrationRangeValues()

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

@timvaillancourt timvaillancourt added this to the v1.1.6 milestone Aug 18, 2022
Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is fine. Ultimately it does not matter that much: we take note of the binlog position before we evaluate the min/max range values. That means however we read the min/max values, any changes that happen in between -- we will address those changes as we iterate the binary logs; the changes will be covered by the binlog stream that we process.

@timvaillancourt
Copy link
Collaborator Author

This change is fine.

Thanks @shlomi-noach! Yeah I think so, I'm glad this didn't break any assumptions I didn't know about 👍

we will address those changes as we iterate the binary logs; the changes will be covered by the binlog stream that we process.

Agreed, I think this is more of a cosmetic change that won't actually affect the correctness of the end-result

@timvaillancourt timvaillancourt merged commit 3c946e9 into github:master Sep 6, 2022
@timvaillancourt timvaillancourt deleted the ReadMigrationValues-transaction branch September 6, 2022 12:07
RainbowDashy pushed a commit to bytebase/gh-ost that referenced this pull request Dec 13, 2022
)

* Use a transaction in applier `ReadMigrationRangeValues` func

* Private func names
d-bytebase pushed a commit to bytebase/gh-ost that referenced this pull request Dec 13, 2022
* Add script and docs for linter (github#1151)

* Enable more `golang-ci` linters (github#1149)

* Only build RPM and deb packages for amd64

* Convert character to bytes and insert into table using latin1

* delete junk files

* restore connection charset to utf8mb4

* Allow zero in dates (github#1161)

* Merge pull request #31 from openark/zero-date

Support zero date and zero in date, via dedicated command line flag

* Merge pull request #32 from openark/existing-date-with-zero

Support tables with existing zero dates

* Remove un-needed ignore_versions file

* Fix new lint errors from golang-ci update

Co-authored-by: Shlomi Noach <[email protected]>

* Add missing doc from PR github#1131 (github#1162)

* Set a transaction isolation level for MySQL connections (github#1156)

* Set transaction isolation in connections

* Revert load_map.go change

* Var rename

* Restore comment

* Some fix to unit tests.

* convert to bytes if character string without charsetConversion.

* chore: remove duplicate word in comments (github#1175)

Signed-off-by: Abirdcfly <[email protected]>

Signed-off-by: Abirdcfly <[email protected]>

* Improve applier `.ReadMigrationRangeValues()` func accuracy (github#1164)

* Use a transaction in applier `ReadMigrationRangeValues` func

* Private func names

* Add basic tests for applier (github#1165)

* Add basic tests for applier

* Add header

* Add basic test for inspector (github#1166)

* Add basic test for inspector

* Add header

* Fix return

* Add basic tests to migrator (github#1168)

* add-rocksdb-as-transactional-engine

* Add basic test for hooks (github#1179)

* Enable more `golangci-lint` linters (github#1181)

* Print status to migration context logger

* fix CI tests to ubuntu-20.04 because ubuntu-22.04 (current -latest) doesn't support MySQL 5.7

* temp commit to investigate datetime-with-zero test failure

* more testing

* add extra debugging output

* debugging

* add error detection for test setup, sort tests to make it easier to track progress

* fix broken test by removing invalid insert statement

* Fix: Change table name

table name is 'tbl' not 'tble'

* Attempt instant DDL if supported

* minor cleanup

* Add tests, incorporate feedback

* Improve docs

* Address PR feedback

* Make it clear in docs it is disabled by default but safe.

* Update go/logic/migrator.go

Co-authored-by: dm-2 <[email protected]>

* remove useless func per review

* support rocksdb as transactional engine

* Modify tests to support rocksdb tests

* SetConnectionConfig

* add support for rocksdb

* add support for rocksdb

* add percona to versions in workflows

* add description and optimize tests

* Apply suggestions from code review

Co-authored-by: dm-2 <[email protected]>

* Apply suggestions from code review

Co-authored-by: Tim Vaillancourt <[email protected]>

* Update go/logic/applier.go

Signed-off-by: Abirdcfly <[email protected]>
Co-authored-by: Tim Vaillancourt <[email protected]>
Co-authored-by: dm-2 <[email protected]>
Co-authored-by: wangzihuacool <[email protected]>
Co-authored-by: wangzihuacool <[email protected]>
Co-authored-by: Shlomi Noach <[email protected]>
Co-authored-by: Abirdcfly <[email protected]>
Co-authored-by: Nicholas Calugar <[email protected]>
Co-authored-by: Hasan Mshawrab <[email protected]>
Co-authored-by: Morgan Tocker <[email protected]>
Co-authored-by: Morgan Tocker <[email protected]>
Co-authored-by: lukelewang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants