This repository was archived by the owner on Dec 16, 2022. It is now read-only.
forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 8
VDiff External DB #144
Merged
Merged
VDiff External DB #144
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c2c8dab
VDiff ad-hoc version for slack
f20d7cb
Merge branch 'master' into vdiff-external-db
1c13207
Removes extra log items
fbed963
Print actual position where it actually stop
ccc4b5d
Fixes bug in filepos flavor
779c483
Updates how master gtid position is obtained for file:pos flavor
58423f8
Cleanup per review
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| Copyright 2020 The Vitess Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package mysql | ||
|
|
||
| import ( | ||
| "testing" | ||
| ) | ||
|
|
||
| func Test_filePosGTID_String(t *testing.T) { | ||
| type fields struct { | ||
| file string | ||
| pos int | ||
| } | ||
| tests := []struct { | ||
| name string | ||
| fields fields | ||
| want string | ||
| }{ | ||
| { | ||
| "formats gtid correctly", | ||
| fields{file: "mysql-bin.166031", pos: 192394}, | ||
| "mysql-bin.166031:192394", | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| gtid := filePosGTID{ | ||
| file: tt.fields.file, | ||
| pos: tt.fields.pos, | ||
| } | ||
| if got := gtid.String(); got != tt.want { | ||
| t.Errorf("filePosGTID.String() = %v, want %v", got, tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func Test_filePosGTID_ContainsGTID(t *testing.T) { | ||
| type fields struct { | ||
| file string | ||
| pos int | ||
| } | ||
| type args struct { | ||
| other GTID | ||
| } | ||
| tests := []struct { | ||
| name string | ||
| fields fields | ||
| args args | ||
| want bool | ||
| }{ | ||
| { | ||
| "returns true when the position is equal", | ||
| fields{file: "testfile", pos: 1234}, | ||
| args{other: filePosGTID{file: "testfile", pos: 1234}}, | ||
| true, | ||
| }, | ||
| { | ||
| "returns true when the position is less than equal", | ||
| fields{file: "testfile", pos: 1234}, | ||
| args{other: filePosGTID{file: "testfile", pos: 1233}}, | ||
| true, | ||
| }, | ||
| { | ||
| "returns false when the position is less than equal", | ||
| fields{file: "testfile", pos: 1234}, | ||
| args{other: filePosGTID{file: "testfile", pos: 1235}}, | ||
| false, | ||
| }, | ||
| { | ||
| "it uses integer value for comparison (it is not lexicographical order)", | ||
| fields{file: "testfile", pos: 99761227}, | ||
| args{other: filePosGTID{file: "testfile", pos: 103939867}}, | ||
| false, | ||
| }, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| gtid := filePosGTID{ | ||
| file: tt.fields.file, | ||
| pos: tt.fields.pos, | ||
| } | ||
| if got := gtid.ContainsGTID(tt.args.other); got != tt.want { | ||
| t.Errorf("filePosGTID.ContainsGTID() = %v, want %v", got, tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear when we
agent.Tablet()we get a clone of the proto object at that point -- is there danger that it will change in the background in some meaningful way before we come through and run the vtdiff?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is correct. There is no danger, because in this context we always assume that you will be running vdiff from the current tablet, against it's external source.