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

pdClient (ticdc): Enable the pdClient forwarding function to make cdc more stable during network isolation between the PD leader (#11076) #11086

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/api/v2/api_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@
},
MinConnectTimeout: 3 * time.Second,
}),
))
),
pd.WithForwardingOption(config.EnablePDForwarding))

Check warning on line 468 in cdc/api/v2/api_helpers.go

View check run for this annotation

Codecov / codecov/patch

cdc/api/v2/api_helpers.go#L467-L468

Added lines #L467 - L468 were not covered by tests
if err != nil {
return nil, cerror.WrapError(cerror.ErrAPIGetPDClientFailed, errors.Trace(err))
}
Expand Down
3 changes: 2 additions & 1 deletion cdc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@
},
MinConnectTimeout: 3 * time.Second,
}),
))
),
pd.WithForwardingOption(config.EnablePDForwarding))

Check warning on line 155 in cdc/server/server.go

View check run for this annotation

Codecov / codecov/patch

cdc/server/server.go#L154-L155

Added lines #L154 - L155 were not covered by tests
if err != nil {
return errors.Trace(err)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/config/server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ const (
// DisableMemoryLimit is the default max memory percentage for TiCDC server.
// 0 means no memory limit.
DisableMemoryLimit = 0

// EnablePDForwarding is the value of whether to enable PD client forwarding function.
// The PD client will forward the requests throughthe follower
// If there is a network partition problem between TiCDC and PD leader.
EnablePDForwarding = true
)

var (
Expand Down
4 changes: 3 additions & 1 deletion pkg/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@
},
MinConnectTimeout: 3 * time.Second,
}),
))
),
pd.WithForwardingOption(config.EnablePDForwarding),
)

Check warning on line 152 in pkg/migrate/migrate.go

View check run for this annotation

Codecov / codecov/patch

pkg/migrate/migrate.go#L150-L152

Added lines #L150 - L152 were not covered by tests
}

// Note: we do not use etcd transaction to migrate key
Expand Down
4 changes: 3 additions & 1 deletion pkg/upstream/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"github.com/pingcap/log"
tidbkv "github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tiflow/cdc/kv"
"github.com/pingcap/tiflow/pkg/config"
"github.com/pingcap/tiflow/pkg/errors"
"github.com/pingcap/tiflow/pkg/errorutil"
"github.com/pingcap/tiflow/pkg/etcd"
Expand Down Expand Up @@ -152,7 +153,8 @@
},
MinConnectTimeout: 3 * time.Second,
}),
))
),
pd.WithForwardingOption(config.EnablePDForwarding))

Check warning on line 157 in pkg/upstream/upstream.go

View check run for this annotation

Codecov / codecov/patch

pkg/upstream/upstream.go#L156-L157

Added lines #L156 - L157 were not covered by tests
if err != nil {
up.err.Store(err)
return errors.Trace(err)
Expand Down
Loading