-
Notifications
You must be signed in to change notification settings - Fork 131
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
feed downstream by relay log at startup if need #883
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5767a31
Group config about relay
july2993 b764a25
Add status to tell quit normal or not
july2993 8876d36
Try to recover status as normal if can't init pd client
july2993 2acc6fa
Merge branch 'master' into relay
july2993 3604ca6
Fix return wrong err
july2993 95e28ff
remove check by empty dir directly
july2993 56877bb
Rename log-size to max-file-size
july2993 81db7e5
Update as normal anyway
july2993 ae18878
Fix lint
july2993 8107f2f
Refine some code and comment
july2993 5bd613a
Merge branch 'master' into relay
july2993 d919746
Address trivial comment
july2993 d341425
Use std error
july2993 bb81853
Make CreateLoader accept sql.DB
july2993 002d449
Rename StatusNormal to StatusConsitent
july2993 34cb18e
Merge branch 'master' into relay
IANTHEREAL 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 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 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 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 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 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 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 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 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,63 @@ | ||
// Copyright 2019 PingCAP, Inc. | ||
// | ||
// 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, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package checkpoint | ||
|
||
import ( | ||
"github.com/DATA-DOG/go-sqlmock" | ||
. "github.com/pingcap/check" | ||
"github.com/pingcap/errors" | ||
) | ||
|
||
var _ = Suite(&testUtil{}) | ||
|
||
type testUtil struct{} | ||
|
||
func (t *testUtil) TestG(c *C) { | ||
tests := []struct { | ||
name string | ||
rows []uint64 | ||
id uint64 | ||
err bool | ||
checkSpecifiedErr error | ||
}{ | ||
{"no row", nil, 0, true, ErrNoCheckpointItem}, | ||
{"on row", []uint64{1}, 1, false, nil}, | ||
{"multi row", []uint64{1, 2}, 0, true, nil}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, true, nil means the result will be some error but we don't check what kind of error. |
||
} | ||
|
||
for _, test := range tests { | ||
db, mock, err := sqlmock.New() | ||
c.Assert(err, IsNil) | ||
|
||
rows := sqlmock.NewRows([]string{"clusterID"}) | ||
for _, row := range test.rows { | ||
rows.AddRow(row) | ||
} | ||
|
||
mock.ExpectQuery("select clusterID from .*").WillReturnRows(rows) | ||
|
||
c.Log("test: ", test.name) | ||
id, err := getClusterID(db, "schema", "table") | ||
if test.err { | ||
c.Assert(err, NotNil) | ||
c.Assert(id, Equals, test.id) | ||
if test.checkSpecifiedErr != nil { | ||
c.Assert(errors.Cause(err), Equals, test.checkSpecifiedErr) | ||
} | ||
} else { | ||
c.Assert(err, IsNil) | ||
c.Assert(id, Equals, test.id) | ||
} | ||
} | ||
} |
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.
This logic is very weird.
In order to handle the situation where the upstream cluster is completely down, drainer needs a correct way to fetch the cluster id. But current implementation is not satisfying, like drainer can't allow store multiple entries in checkpoint table
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.
I file an issue about it #889