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

processor(ticdc): clean up dead code #8405

Merged
merged 7 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
33 changes: 0 additions & 33 deletions cdc/processor/doc.go

This file was deleted.

23 changes: 0 additions & 23 deletions cdc/processor/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ const (
commandTpUnknown commandTp = iota
commandTpClose
commandTpWriteDebugInfo
// Query the number of tables in the manager.
// command payload is a buffer channel of int, make(chan int, 1).
commandTpQueryTableCount
processorLogsWarnDuration = 1 * time.Second
)

Expand All @@ -53,7 +50,6 @@ type command struct {
// Manager is a manager of processor, which maintains the state and behavior of processors
type Manager interface {
orchestrator.Reactor
QueryTableCount(ctx context.Context, tableCh chan int, done chan<- error)
WriteDebugInfo(ctx context.Context, w io.Writer, done chan<- error)
AsyncClose()
}
Expand Down Expand Up @@ -199,16 +195,6 @@ func (m *managerImpl) AsyncClose() {
}
}

// QueryTableCount query the number of tables in the manager.
func (m *managerImpl) QueryTableCount(
ctx context.Context, tableCh chan int, done chan<- error,
) {
err := m.sendCommand(ctx, commandTpQueryTableCount, tableCh, done)
if err != nil {
log.Warn("send command commandTpQueryTableCount failed", zap.Error(err))
}
}

// WriteDebugInfo write the debug info to Writer
func (m *managerImpl) WriteDebugInfo(
ctx context.Context, w io.Writer, done chan<- error,
Expand Down Expand Up @@ -256,15 +242,6 @@ func (m *managerImpl) handleCommand(ctx cdcContext.Context) error {
if err != nil {
cmd.done <- err
}
case commandTpQueryTableCount:
count := 0
for _, p := range m.processors {
count += p.GetTableSpanCount()
}
select {
case cmd.payload.(chan int) <- count:
default:
}
default:
log.Warn("Unknown command in processor manager", zap.Any("command", cmd))
}
Expand Down
22 changes: 0 additions & 22 deletions cdc/processor/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,25 +291,3 @@ func TestManagerLiveness(t *testing.T) {
s.liveness.Store(model.LivenessCaptureStopping)
require.Equal(t, model.LivenessCaptureStopping, p.liveness.Load())
}

func TestQueryTableCount(t *testing.T) {
t.Skip("FIXME: add tables")
liveness := model.LivenessCaptureAlive
cfg := config.NewDefaultSchedulerConfig()
m := NewManager(&model.CaptureInfo{ID: "capture-test"}, nil, &liveness, cfg).(*managerImpl)
ctx := context.TODO()
m.processors[model.ChangeFeedID{ID: "test"}] = &processor{}

done := make(chan error, 1)
tableCh := make(chan int, 1)
err := m.sendCommand(ctx, commandTpQueryTableCount, tableCh, done)
require.Nil(t, err)
err = m.handleCommand(nil)
require.Nil(t, err)
select {
case count := <-tableCh:
require.Equal(t, 2, count)
case <-time.After(time.Second):
require.FailNow(t, "done must be closed")
}
}