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

http_api (ticdc): fix http api 'get processor' panic. (#4117) #4122

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cdc/capture/http_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ var httpBadRequestError = []*errors.Error{
cerror.ErrAPIInvalidParam, cerror.ErrSinkURIInvalid, cerror.ErrStartTsBeforeGC,
cerror.ErrChangeFeedNotExists, cerror.ErrTargetTsBeforeStartTs, cerror.ErrTableIneligible,
cerror.ErrFilterRuleInvalid, cerror.ErrChangefeedUpdateRefused, cerror.ErrMySQLConnectionError,
cerror.ErrMySQLInvalidConfig,
cerror.ErrMySQLInvalidConfig, cerror.ErrCaptureNotExist, cerror.ErrTaskStatusNotExists,
cerror.ErrTaskPositionNotExists,
}

// IsHTTPBadRequestError check if a error is a http bad request error
Expand Down
5 changes: 1 addition & 4 deletions cdc/sink/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (m *Manager) getCheckpointTs(tableID model.TableID) uint64 {
return atomic.LoadUint64(&m.changeFeedCheckpointTs)
}

// UpdateChangeFeedCheckpointTs update the changeFeedCheckpointTs every processor tick
func (m *Manager) UpdateChangeFeedCheckpointTs(checkpointTs uint64) {
atomic.StoreUint64(&m.changeFeedCheckpointTs, checkpointTs)
if m.backendSink != nil {
Expand Down Expand Up @@ -235,10 +236,6 @@ func (t *tableSink) FlushRowChangedEvents(ctx context.Context, tableID model.Tab
return ckpt, err
}

func (t *tableSink) getEmittedTs() uint64 {
return atomic.LoadUint64(&t.emittedTs)
}

func (t *tableSink) EmitCheckpointTs(ctx context.Context, ts uint64) error {
// the table sink doesn't receive the checkpoint event
return nil
Expand Down
11 changes: 8 additions & 3 deletions tests/integration_tests/http_api/util/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,19 @@ def list_processor():

# must at least one table is sync will the test success
def get_processor():
url = BASE_URL0 + "/processors"
resp = rq.get(url, cert=CERT, verify=VERIFY)
base_url = BASE_URL0 + "/processors"
resp = rq.get(base_url, cert=CERT, verify=VERIFY)
assert resp.status_code == rq.codes.ok
data = resp.json()[0]
url = url + "/" + data["changefeed_id"] + "/" + data["capture_id"]
url = base_url + "/" + data["changefeed_id"] + "/" + data["capture_id"]
resp = rq.get(url, cert=CERT, verify=VERIFY)
assert resp.status_code == rq.codes.ok

# test capture_id error and cdc server no panic
url = base_url + "/" + data["changefeed_id"] + "/" + "non-exist-capture-id"
resp = rq.get(url, cert=CERT, verify=VERIFY)
assert resp.status_code == rq.codes.bad_request

print("pass test: get processors")


Expand Down