From 9d85061670f28db4678e1d1d3ac08452d0c4ff99 Mon Sep 17 00:00:00 2001 From: wk989898 Date: Mon, 23 Nov 2026 07:40:57 +0000 Subject: [PATCH 1/7] init Signed-off-by: wk989898 --- coordinator/capture_write_lease.go | 8 + coordinator/node_load.go | 79 ++ coordinator/node_load_test.go | 95 ++ .../dispatcher/table_progress.go | 11 + .../dispatcher/table_progress_test.go | 21 + heartbeatpb/heartbeat.pb.go | 862 +++++++++++++----- heartbeatpb/heartbeat.proto | 17 + maintainer/maintainer_manager.go | 12 +- maintainer/maintainer_manager_maintainers.go | 6 + maintainer/maintainer_manager_node.go | 3 + maintainer/maintainer_manager_test.go | 3 + maintainer/node_liveness_test.go | 11 + maintainer/replica/node_load.go | 90 ++ maintainer/replica/node_load_test.go | 80 ++ maintainer/replica/replication_span.go | 28 +- maintainer/scheduler/balance.go | 120 ++- maintainer/scheduler/balance_test.go | 154 ++++ maintainer/span/span_controller.go | 11 + pkg/messaging/message_write_lease_test.go | 14 + 19 files changed, 1401 insertions(+), 224 deletions(-) create mode 100644 coordinator/node_load.go create mode 100644 coordinator/node_load_test.go create mode 100644 maintainer/replica/node_load.go create mode 100644 maintainer/replica/node_load_test.go diff --git a/coordinator/capture_write_lease.go b/coordinator/capture_write_lease.go index d46ac9bf2d..5c56d226a2 100644 --- a/coordinator/capture_write_lease.go +++ b/coordinator/capture_write_lease.go @@ -33,6 +33,7 @@ const ( type captureLeaseNodeState struct { nodeEpoch uint64 lastRequestSeq uint64 + load nodeLoadState } type pendingWitnessChallenge struct { @@ -53,6 +54,7 @@ type captureWriteLeaseController struct { nonce func([]byte) (int, error) nodes map[node.ID]*captureLeaseNodeState + activeNodes []node.ID p2pCapableNodes map[node.ID]struct{} p2pLeaseEnabled bool pendingWitness *pendingWitnessChallenge @@ -81,6 +83,7 @@ func (c *captureWriteLeaseController) observeNodeCapability(id node.ID, version // updateClusterMode enables P2P only when every active capture has reported // support for the current protocol. A missing capability is treated as legacy. func (c *captureWriteLeaseController) updateClusterMode(activeNodes []node.ID) { + c.activeNodes = slices.Clone(activeNodes) p2pEnabled := len(activeNodes) > 0 for _, id := range activeNodes { if _, ok := c.p2pCapableNodes[id]; !ok { @@ -119,6 +122,7 @@ func (c *captureWriteLeaseController) handleHeartbeat( return nil } state.lastRequestSeq = heartbeat.GetWriteLeaseRequestSeq() + state.load.observe(heartbeat.GetNodeLoad(), c.now()) messages := c.handleWitnessAck(from, heartbeat) if from != c.selfNodeID { @@ -247,6 +251,7 @@ func (c *captureWriteLeaseController) newGrant( if c.p2pLeaseEnabled { leaseDurationMs = uint64(writelease.P2PLeaseDuration.Milliseconds()) } + loads, loadStatus := c.nodeLoadSnapshot() return messaging.NewSingleTargetMessage( target, messaging.MaintainerManagerTopic, @@ -255,12 +260,15 @@ func (c *captureWriteLeaseController) newGrant( TargetNodeEpoch: targetNodeEpoch, RequestSeq: requestSeq, LeaseDurationMs: leaseDurationMs, + NodeLoads: loads, + NodeLoadStatus: loadStatus, }, ) } func (c *captureWriteLeaseController) removeNode(id node.ID) { delete(c.nodes, id) + c.activeNodes = slices.DeleteFunc(c.activeNodes, func(active node.ID) bool { return active == id }) delete(c.p2pCapableNodes, id) if c.pendingWitness != nil && (c.pendingWitness.witnessNodeID == id || id == c.selfNodeID) { diff --git a/coordinator/node_load.go b/coordinator/node_load.go new file mode 100644 index 0000000000..0e545e7335 --- /dev/null +++ b/coordinator/node_load.go @@ -0,0 +1,79 @@ +// Copyright 2026 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 coordinator + +import ( + "slices" + "time" + + "github.com/pingcap/ticdc/heartbeatpb" +) + +const nodeLoadStaleThreshold = 5 * time.Second + +type nodeLoadState struct { + supported bool + bytes uint64 + rate float64 + available bool + updatedAt time.Time +} + +func (s *nodeLoadState) observe(load *heartbeatpb.NodeLoad, now time.Time) { + if load == nil { + *s = nodeLoadState{} + return + } + s.supported = true + if !s.updatedAt.IsZero() && !now.After(s.updatedAt) { + return + } + elapsed := now.Sub(s.updatedAt) + if !s.updatedAt.IsZero() && elapsed < time.Second && load.FlushedEventBytes >= s.bytes { + // Witness acknowledgements and drain updates force extra heartbeats. + // Keep one sampling window instead of replacing rates with tiny deltas. + return + } + s.available = !s.updatedAt.IsZero() && elapsed <= nodeLoadStaleThreshold && load.FlushedEventBytes >= s.bytes + if s.available { + s.rate = float64(load.FlushedEventBytes-s.bytes) / elapsed.Seconds() + } + s.bytes = load.FlushedEventBytes + s.updatedAt = now +} + +// nodeLoadSnapshot only distributes observations. Maintainers independently +// decide which of their dispatchers to move, without coordinator approval. +func (c *captureWriteLeaseController) nodeLoadSnapshot() ([]*heartbeatpb.NodeLoad, heartbeatpb.NodeLoadStatus) { + if len(c.activeNodes) == 0 { + return nil, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED + } + for _, id := range c.activeNodes { + if state := c.nodes[id]; state == nil || !state.load.supported { + return nil, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED + } + } + now := c.now() + ids := slices.Clone(c.activeNodes) + slices.Sort(ids) + loads := make([]*heartbeatpb.NodeLoad, 0, len(ids)) + for _, id := range ids { + load := &c.nodes[id].load + if !load.available || now.Sub(load.updatedAt) > nodeLoadStaleThreshold { + return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + } + loads = append(loads, &heartbeatpb.NodeLoad{NodeId: id.String(), BytesPerSecond: load.rate}) + } + return loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE +} diff --git a/coordinator/node_load_test.go b/coordinator/node_load_test.go new file mode 100644 index 0000000000..910bc2a48b --- /dev/null +++ b/coordinator/node_load_test.go @@ -0,0 +1,95 @@ +// Copyright 2026 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 coordinator + +import ( + "testing" + "time" + + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/pkg/node" + "github.com/stretchr/testify/require" +) + +func TestNodeLoadHeartbeatSnapshot(t *testing.T) { + now := time.Unix(100, 0) + c := newCaptureWriteLeaseController(10, "coordinator") + c.now = func() time.Time { return now } + enableP2PForNodes(c, "a", "b") + report := func(id node.ID, seq, bytes uint64) *heartbeatpb.NodeHeartbeatResponse { + hb := newWriteLeaseHeartbeat(1, seq) + hb.NodeLoad = &heartbeatpb.NodeLoad{FlushedEventBytes: bytes} + messages := c.handleHeartbeat(id, hb, nil) + require.Len(t, messages, 1) + return requireWriteLeaseResponse(t, messages[0]) + } + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED, report("a", 1, 100).NodeLoadStatus) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, report("b", 1, 1000).NodeLoadStatus) + now = now.Add(time.Second) + report("a", 2, 200) + response := report("b", 2, 1200) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, response.NodeLoadStatus) + require.Equal(t, []*heartbeatpb.NodeLoad{ + {NodeId: "a", BytesPerSecond: 100}, {NodeId: "b", BytesPerSecond: 200}, + }, response.NodeLoads) + + // A new a sample does not turn b's unchanged cumulative counter into zero. + now = now.Add(2 * time.Second) + response = report("a", 3, 400) + require.Equal(t, float64(100), response.NodeLoads[0].BytesPerSecond) + require.Equal(t, float64(200), response.NodeLoads[1].BytesPerSecond) + // Replayed reports cannot replace the sample, even with another counter. + hb := newWriteLeaseHeartbeat(1, 3) + hb.NodeLoad = &heartbeatpb.NodeLoad{FlushedEventBytes: 9999} + require.Empty(t, c.handleHeartbeat("a", hb, nil)) + require.Equal(t, uint64(400), c.nodes["a"].load.bytes) + + now = now.Add(nodeLoadStaleThreshold) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, report("a", 4, 900).NodeLoadStatus) + // A stale sample needs a new baseline before its rate becomes available. + report("b", 3, 2000) + now = now.Add(time.Second) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, report("b", 4, 2200).NodeLoadStatus) + // Counter reset also requires a new baseline. + now = now.Add(time.Second) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, report("b", 5, 10).NodeLoadStatus) + now = now.Add(time.Second) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, report("b", 6, 110).NodeLoadStatus) + + c.updateClusterMode([]node.ID{"a", "b", "new"}) + _, status := c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED, status) + c.removeNode("new") + _, status = c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + // A new process with the same ID must not inherit the previous baseline. + c.removeNode("b") + c.updateClusterMode([]node.ID{"a", "b"}) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, report("b", 1, 5).NodeLoadStatus) +} + +func TestNodeLoadKeepsSamplingWindowAcrossForcedHeartbeats(t *testing.T) { + now := time.Unix(100, 0) + state := nodeLoadState{} + state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 0}, now) + state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 100}, now.Add(time.Second)) + require.Equal(t, float64(100), state.rate) + state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 100}, now.Add(time.Second+time.Millisecond)) + state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 150}, now.Add(1500*time.Millisecond)) + require.Equal(t, float64(100), state.rate) + require.Equal(t, uint64(100), state.bytes) + state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 300}, now.Add(3*time.Second)) + require.Equal(t, float64(100), state.rate) + require.Equal(t, uint64(300), state.bytes) +} diff --git a/downstreamadapter/dispatcher/table_progress.go b/downstreamadapter/dispatcher/table_progress.go index e12522825d..a2d5879058 100644 --- a/downstreamadapter/dispatcher/table_progress.go +++ b/downstreamadapter/dispatcher/table_progress.go @@ -16,6 +16,7 @@ package dispatcher import ( "container/list" "sync" + "sync/atomic" "time" "github.com/pingcap/log" @@ -23,6 +24,15 @@ import ( "go.uber.org/zap" ) +var flushedEventBytes atomic.Uint64 + +// FlushedEventBytes returns the process-wide cumulative event size, in the same +// units as dispatcher EventSizePerSecond reports. Reading it never resets the +// per-dispatcher sampling window. +func FlushedEventBytes() uint64 { + return flushedEventBytes.Load() +} + // TableProgress maintains event timestamp information in the sink. // It provides the ability to: // - Query the current table checkpoint timestamp @@ -132,6 +142,7 @@ func (p *TableProgress) remove(ts Ts, size int64) { } } p.cumulateEventSize += size + flushedEventBytes.Add(uint64(size)) } // Empty checks if the TableProgress is empty. diff --git a/downstreamadapter/dispatcher/table_progress_test.go b/downstreamadapter/dispatcher/table_progress_test.go index a8c6aa9746..8c208e33e9 100644 --- a/downstreamadapter/dispatcher/table_progress_test.go +++ b/downstreamadapter/dispatcher/table_progress_test.go @@ -15,10 +15,12 @@ package dispatcher import ( "testing" + "time" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestTableProgress(t *testing.T) { @@ -194,3 +196,22 @@ func TestMultiSameCommitTsStartTsPair(t *testing.T) { assert.True(t, isEmpty) assert.Equal(t, 0, tp.Len()) } + +func TestFlushedEventBytesPreservesDispatcherSamples(t *testing.T) { + initial := FlushedEventBytes() + a, b := NewTableProgress(), NewTableProgress() + first := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 2, ApproximateSize: 100} + second := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 3, ApproximateSize: 200} + a.Add(first) + b.Add(second) + require.Equal(t, initial, FlushedEventBytes()) + first.PostFlush() + second.PostFlush() + require.Equal(t, initial+300, FlushedEventBytes()) + // Node-level reads never consume the per-dispatcher traffic samples. + a.lastQueryTime = time.Now().Add(-time.Second) + b.lastQueryTime = a.lastQueryTime + require.InDelta(t, float64(100), a.GetEventSizePerSecond(), 1) + require.InDelta(t, float64(200), b.GetEventSizePerSecond(), 1) + require.Equal(t, initial+300, FlushedEventBytes()) +} diff --git a/heartbeatpb/heartbeat.pb.go b/heartbeatpb/heartbeat.pb.go index f2d2be03db..d87aa7a185 100644 --- a/heartbeatpb/heartbeat.pb.go +++ b/heartbeatpb/heartbeat.pb.go @@ -314,6 +314,34 @@ func (ChecksumState) EnumDescriptor() ([]byte, []int) { return fileDescriptor_6d584080fdadb670, []int{8} } +type NodeLoadStatus int32 + +const ( + NodeLoadStatus_LOAD_UNSUPPORTED NodeLoadStatus = 0 + NodeLoadStatus_LOAD_INCOMPLETE NodeLoadStatus = 1 + NodeLoadStatus_LOAD_AVAILABLE NodeLoadStatus = 2 +) + +var NodeLoadStatus_name = map[int32]string{ + 0: "LOAD_UNSUPPORTED", + 1: "LOAD_INCOMPLETE", + 2: "LOAD_AVAILABLE", +} + +var NodeLoadStatus_value = map[string]int32{ + "LOAD_UNSUPPORTED": 0, + "LOAD_INCOMPLETE": 1, + "LOAD_AVAILABLE": 2, +} + +func (x NodeLoadStatus) String() string { + return proto.EnumName(NodeLoadStatus_name, int32(x)) +} + +func (NodeLoadStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6d584080fdadb670, []int{9} +} + type TableSpan struct { TableID int64 `protobuf:"varint,1,opt,name=TableID,proto3" json:"TableID,omitempty"` StartKey []byte `protobuf:"bytes,2,opt,name=StartKey,proto3" json:"StartKey,omitempty"` @@ -1628,6 +1656,7 @@ type NodeHeartbeat struct { WriteLeaseRequestSeq uint64 `protobuf:"varint,5,opt,name=write_lease_request_seq,json=writeLeaseRequestSeq,proto3" json:"write_lease_request_seq,omitempty"` WriteLeaseProtocolVersion uint32 `protobuf:"varint,6,opt,name=write_lease_protocol_version,json=writeLeaseProtocolVersion,proto3" json:"write_lease_protocol_version,omitempty"` WriteLeaseWitnessAck *WriteLeaseWitnessAck `protobuf:"bytes,7,opt,name=write_lease_witness_ack,json=writeLeaseWitnessAck,proto3" json:"write_lease_witness_ack,omitempty"` + NodeLoad *NodeLoad `protobuf:"bytes,8,opt,name=node_load,json=nodeLoad,proto3" json:"node_load,omitempty"` } func (m *NodeHeartbeat) Reset() { *m = NodeHeartbeat{} } @@ -1712,6 +1741,13 @@ func (m *NodeHeartbeat) GetWriteLeaseWitnessAck() *WriteLeaseWitnessAck { return nil } +func (m *NodeHeartbeat) GetNodeLoad() *NodeLoad { + if m != nil { + return m.NodeLoad + } + return nil +} + type WriteLeaseWitnessChallenge struct { CoordinatorVersion int64 `protobuf:"varint,1,opt,name=coordinator_version,json=coordinatorVersion,proto3" json:"coordinator_version,omitempty"` CoordinatorNodeEpoch uint64 `protobuf:"varint,2,opt,name=coordinator_node_epoch,json=coordinatorNodeEpoch,proto3" json:"coordinator_node_epoch,omitempty"` @@ -1870,6 +1906,8 @@ type NodeHeartbeatResponse struct { RequestSeq uint64 `protobuf:"varint,3,opt,name=request_seq,json=requestSeq,proto3" json:"request_seq,omitempty"` LeaseDurationMs uint64 `protobuf:"varint,4,opt,name=lease_duration_ms,json=leaseDurationMs,proto3" json:"lease_duration_ms,omitempty"` WitnessChallenge *WriteLeaseWitnessChallenge `protobuf:"bytes,5,opt,name=witness_challenge,json=witnessChallenge,proto3" json:"witness_challenge,omitempty"` + NodeLoads []*NodeLoad `protobuf:"bytes,6,rep,name=node_loads,json=nodeLoads,proto3" json:"node_loads,omitempty"` + NodeLoadStatus NodeLoadStatus `protobuf:"varint,7,opt,name=node_load_status,json=nodeLoadStatus,proto3,enum=heartbeatpb.NodeLoadStatus" json:"node_load_status,omitempty"` } func (m *NodeHeartbeatResponse) Reset() { *m = NodeHeartbeatResponse{} } @@ -1940,6 +1978,20 @@ func (m *NodeHeartbeatResponse) GetWitnessChallenge() *WriteLeaseWitnessChalleng return nil } +func (m *NodeHeartbeatResponse) GetNodeLoads() []*NodeLoad { + if m != nil { + return m.NodeLoads + } + return nil +} + +func (m *NodeHeartbeatResponse) GetNodeLoadStatus() NodeLoadStatus { + if m != nil { + return m.NodeLoadStatus + } + return NodeLoadStatus_LOAD_UNSUPPORTED +} + // SetNodeLivenessRequest asks a node to transition its local liveness. type SetNodeLivenessRequest struct { Target NodeLiveness `protobuf:"varint,1,opt,name=target,proto3,enum=heartbeatpb.NodeLiveness" json:"target,omitempty"` @@ -4208,6 +4260,68 @@ func (m *DispatcherSetChecksumUpdateRequest) GetChecksum() *DispatcherSetChecksu return nil } +// Requests report a process-wide cumulative counter. Coordinator responses +// identify each node and report its derived rate, without dispatcher details. +type NodeLoad struct { + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + FlushedEventBytes uint64 `protobuf:"varint,2,opt,name=flushed_event_bytes,json=flushedEventBytes,proto3" json:"flushed_event_bytes,omitempty"` + BytesPerSecond float64 `protobuf:"fixed64,3,opt,name=bytes_per_second,json=bytesPerSecond,proto3" json:"bytes_per_second,omitempty"` +} + +func (m *NodeLoad) Reset() { *m = NodeLoad{} } +func (m *NodeLoad) String() string { return proto.CompactTextString(m) } +func (*NodeLoad) ProtoMessage() {} +func (*NodeLoad) Descriptor() ([]byte, []int) { + return fileDescriptor_6d584080fdadb670, []int{56} +} +func (m *NodeLoad) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeLoad) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeLoad.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NodeLoad) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeLoad.Merge(m, src) +} +func (m *NodeLoad) XXX_Size() int { + return m.Size() +} +func (m *NodeLoad) XXX_DiscardUnknown() { + xxx_messageInfo_NodeLoad.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeLoad proto.InternalMessageInfo + +func (m *NodeLoad) GetNodeId() string { + if m != nil { + return m.NodeId + } + return "" +} + +func (m *NodeLoad) GetFlushedEventBytes() uint64 { + if m != nil { + return m.FlushedEventBytes + } + return 0 +} + +func (m *NodeLoad) GetBytesPerSecond() float64 { + if m != nil { + return m.BytesPerSecond + } + return 0 +} + func init() { proto.RegisterEnum("heartbeatpb.Action", Action_name, Action_value) proto.RegisterEnum("heartbeatpb.ScheduleAction", ScheduleAction_name, ScheduleAction_value) @@ -4218,6 +4332,7 @@ func init() { proto.RegisterEnum("heartbeatpb.RouteTableAdmissionAction", RouteTableAdmissionAction_name, RouteTableAdmissionAction_value) proto.RegisterEnum("heartbeatpb.ComponentState", ComponentState_name, ComponentState_value) proto.RegisterEnum("heartbeatpb.ChecksumState", ChecksumState_name, ChecksumState_value) + proto.RegisterEnum("heartbeatpb.NodeLoadStatus", NodeLoadStatus_name, NodeLoadStatus_value) proto.RegisterType((*TableSpan)(nil), "heartbeatpb.TableSpan") proto.RegisterType((*HeartBeatRequest)(nil), "heartbeatpb.HeartBeatRequest") proto.RegisterType((*Watermark)(nil), "heartbeatpb.Watermark") @@ -4274,218 +4389,228 @@ func init() { proto.RegisterType((*DispatcherSetChecksum)(nil), "heartbeatpb.DispatcherSetChecksum") proto.RegisterType((*DispatcherSetChecksumAckResponse)(nil), "heartbeatpb.DispatcherSetChecksumAckResponse") proto.RegisterType((*DispatcherSetChecksumUpdateRequest)(nil), "heartbeatpb.DispatcherSetChecksumUpdateRequest") + proto.RegisterType((*NodeLoad)(nil), "heartbeatpb.NodeLoad") } func init() { proto.RegisterFile("heartbeatpb/heartbeat.proto", fileDescriptor_6d584080fdadb670) } var fileDescriptor_6d584080fdadb670 = []byte{ - // 3285 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x1a, 0x4d, 0x73, 0x1c, 0x47, - 0xd5, 0x33, 0xfb, 0xa5, 0x7d, 0xd2, 0x4a, 0xe3, 0xb6, 0x2c, 0xcb, 0xb6, 0x2c, 0xcb, 0x93, 0x00, - 0xca, 0x26, 0xd8, 0xd8, 0x89, 0x29, 0x08, 0x21, 0x66, 0xbd, 0xab, 0xc4, 0x5b, 0xd6, 0x4a, 0xaa, - 0x59, 0x25, 0x4e, 0x85, 0xc3, 0x32, 0x9a, 0x69, 0xaf, 0x26, 0xda, 0x9d, 0x59, 0xcf, 0xcc, 0x5a, - 0xb6, 0xab, 0x80, 0x4a, 0x51, 0xdc, 0x38, 0xc0, 0x09, 0x0e, 0xe4, 0xc2, 0x89, 0x13, 0xc5, 0x1f, - 0xa0, 0xc8, 0x81, 0x03, 0x27, 0x2a, 0xc5, 0x81, 0x0a, 0x17, 0x48, 0x25, 0x47, 0x2e, 0x50, 0x54, - 0xc1, 0x95, 0xea, 0xaf, 0x99, 0x9e, 0x9d, 0x59, 0xad, 0x84, 0xb6, 0x52, 0x14, 0xa7, 0x99, 0x7e, - 0xfd, 0xde, 0xeb, 0xd7, 0xef, 0xbd, 0x7e, 0xfd, 0xfa, 0x75, 0xc3, 0xe5, 0x7d, 0x6c, 0xfa, 0xe1, - 0x1e, 0x36, 0xc3, 0xc1, 0xde, 0x8d, 0xe8, 0xff, 0xfa, 0xc0, 0xf7, 0x42, 0x0f, 0xcd, 0x4a, 0x9d, - 0xfa, 0x53, 0x28, 0xef, 0x9a, 0x7b, 0x3d, 0xdc, 0x1e, 0x98, 0x2e, 0x5a, 0x86, 0x12, 0x6d, 0x34, - 0x1b, 0xcb, 0xca, 0x9a, 0xb2, 0x9e, 0x33, 0x44, 0x13, 0x5d, 0x82, 0x99, 0x76, 0x68, 0xfa, 0xe1, - 0x7d, 0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d4, 0xc2, 0x41, 0x60, 0x76, 0x4f, 0x3d, 0xc7, 0xd1, 0x58, 0xa7, 0xa6, 0x63, - 0x9d, 0xfe, 0x5b, 0x05, 0x16, 0x0c, 0x6c, 0x7b, 0x2d, 0x1c, 0x9a, 0x53, 0x1a, 0x76, 0x52, 0xf8, - 0x1c, 0x15, 0x2b, 0x97, 0x11, 0x82, 0x4f, 0xa0, 0xbb, 0xef, 0xc1, 0x15, 0x32, 0x01, 0x23, 0x1a, - 0x60, 0xc7, 0xf7, 0xba, 0x3e, 0x0e, 0x82, 0xcf, 0x67, 0x3a, 0xfa, 0x2f, 0x15, 0x58, 0x49, 0x0a, - 0xf0, 0x86, 0xe7, 0x1f, 0x9a, 0xbe, 0xfd, 0x39, 0xa9, 0x33, 0x4b, 0x55, 0xb9, 0x6c, 0x55, 0xfd, - 0x53, 0x91, 0x83, 0x4c, 0xdd, 0x73, 0x1f, 0x3a, 0x5d, 0x54, 0x85, 0x7c, 0x30, 0x30, 0x5d, 0x2e, - 0xd6, 0x52, 0xf6, 0x66, 0x6d, 0x50, 0x1c, 0x92, 0x12, 0x05, 0x24, 0xd1, 0x89, 0x04, 0x11, 0x4d, - 0x32, 0x49, 0x5b, 0x0a, 0x72, 0x3c, 0x44, 0x1c, 0x11, 0x05, 0x13, 0xe8, 0x24, 0xce, 0x06, 0x22, - 0xce, 0xe6, 0x59, 0x9c, 0x15, 0xed, 0x68, 0x6d, 0x15, 0xa4, 0xb5, 0x55, 0x05, 0x2d, 0x38, 0x70, - 0x06, 0x8d, 0xd6, 0x66, 0x2d, 0x68, 0x73, 0x89, 0x8a, 0x74, 0x6f, 0x49, 0xc1, 0xf5, 0x0f, 0x55, - 0xb8, 0x48, 0x82, 0xb6, 0x3d, 0xec, 0x49, 0x31, 0x77, 0x4a, 0x29, 0xd6, 0x6d, 0x28, 0x5a, 0x54, - 0x8f, 0x13, 0x02, 0x29, 0x53, 0xb6, 0xc1, 0x91, 0x51, 0x1d, 0xe6, 0x03,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ee, 0xf5, 0x70, - 0x27, 0xf4, 0x9d, 0x6e, 0x97, 0x88, 0xff, 0x18, 0xbb, 0x89, 0xa3, 0x86, 0x73, 0x8c, 0x42, 0xe9, - 0x15, 0xca, 0x63, 0x97, 0xb1, 0xd8, 0x20, 0x1c, 0xe4, 0x92, 0x69, 0xb6, 0xd3, 0x14, 0xb2, 0x9d, - 0xc6, 0x24, 0xc7, 0x16, 0x59, 0x20, 0x1f, 0xdb, 0xde, 0x88, 0x3c, 0xc5, 0x49, 0xf2, 0xac, 0xc8, - 0xf2, 0x18, 0xd8, 0xf6, 0x12, 0xe2, 0x8c, 0x18, 0xb4, 0x74, 0x2c, 0x83, 0xce, 0x64, 0x1b, 0xf4, - 0x8f, 0x39, 0xb8, 0x9c, 0x69, 0xd0, 0xe9, 0x14, 0x3f, 0x6f, 0x43, 0x21, 0x18, 0x98, 0xae, 0x38, - 0x6c, 0x27, 0xab, 0xb2, 0xd1, 0x68, 0x71, 0xf1, 0x87, 0x61, 0x8b, 0x83, 0x4e, 0xee, 0x38, 0xd7, - 0x2e, 0xc7, 0x3b, 0x3a, 0xbd, 0x04, 0x88, 0x1a, 0x22, 0x89, 0xc9, 0xbc, 0x5c, 0x23, 0x3d, 0x72, - 0x55, 0x14, 0x35, 0xa0, 0x2c, 0x0a, 0x18, 0xc1, 0x72, 0x91, 0x8a, 0xfe, 0xc5, 0xcc, 0x7a, 0x49, - 0xaa, 0x4a, 0x61, 0xc4, 0x84, 0x99, 0x66, 0x28, 0x65, 0x9a, 0x01, 0x6d, 0xc2, 0x02, 0x2d, 0x13, - 0x74, 0xe2, 0x61, 0x67, 0xe8, 0xb0, 0xcf, 0x25, 0x77, 0x96, 0xcc, 0xca, 0x88, 0x31, 0x4f, 0x69, - 0x45, 0x01, 0x26, 0xd0, 0xff, 0xa2, 0xc2, 0x6a, 0x6c, 0xd4, 0x1d, 0x2f, 0x08, 0xa7, 0xbd, 0x52, - 0x8f, 0xb5, 0xec, 0xd4, 0x53, 0x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, 0x00, + // 3437 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x3a, 0xcd, 0x8f, 0x1c, 0x47, + 0xf5, 0xee, 0x9e, 0xef, 0xb7, 0xbb, 0xb3, 0xbd, 0xb5, 0x6b, 0x7b, 0x6c, 0xaf, 0xd7, 0xeb, 0x4e, + 0x7e, 0x3f, 0x36, 0x93, 0x60, 0x63, 0xc7, 0x46, 0x10, 0x42, 0xcc, 0x78, 0x66, 0x13, 0x8f, 0xbc, + 0x5f, 0xea, 0x19, 0xc7, 0x51, 0x38, 0x0c, 0xbd, 0xdd, 0xe5, 0xd9, 0xce, 0xce, 0x74, 0x8f, 0xbb, + 0x7b, 0xbc, 0xb6, 0xa5, 0x80, 0x22, 0xc4, 0x8d, 0x03, 0x48, 0x1c, 0x38, 0x90, 0x0b, 0x27, 0x4e, + 0x88, 0x7f, 0x00, 0xc1, 0x81, 0x03, 0x27, 0x14, 0x71, 0x40, 0xe1, 0x02, 0x51, 0x72, 0xe4, 0x02, + 0x02, 0xc1, 0x15, 0xd5, 0x57, 0x77, 0xf5, 0x4c, 0xef, 0xce, 0x2e, 0x3b, 0x8a, 0x10, 0xa7, 0xee, + 0xf7, 0xea, 0xbd, 0x57, 0xaf, 0x5e, 0xbd, 0x7a, 0xf5, 0xea, 0x55, 0xc1, 0xa5, 0x3d, 0x6c, 0xfa, + 0xe1, 0x2e, 0x36, 0xc3, 0xc1, 0xee, 0xf5, 0xe8, 0xff, 0xda, 0xc0, 0xf7, 0x42, 0x0f, 0xcd, 0x48, + 0x8d, 0xfa, 0x33, 0x28, 0xb5, 0xcd, 0xdd, 0x1e, 0x6e, 0x0d, 0x4c, 0x17, 0x55, 0xa0, 0x40, 0x81, + 0x66, 0xa3, 0xa2, 0xac, 0x2a, 0x6b, 0x19, 0x43, 0x80, 0xe8, 0x22, 0x14, 0x5b, 0xa1, 0xe9, 0x87, + 0xf7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 0x0c, 0xe8, + 0x0e, 0xcc, 0xc5, 0x02, 0x9b, 0x0d, 0x62, 0xb7, 0xcc, 0x98, 0xcb, 0xc8, 0x14, 0x46, 0x92, 0x9e, + 0xae, 0x74, 0x6b, 0x0f, 0xf7, 0xcd, 0x66, 0x83, 0x1a, 0x35, 0x63, 0x44, 0x30, 0xba, 0x0f, 0x8b, + 0xf8, 0xa9, 0xd5, 0x1b, 0xda, 0x58, 0xe2, 0xb1, 0xe9, 0xdc, 0x1f, 0xd9, 0x45, 0x1a, 0x97, 0xfe, + 0x63, 0x55, 0x76, 0x0f, 0x6e, 0xd8, 0x77, 0xe0, 0xac, 0x93, 0x66, 0x19, 0x1e, 0x07, 0xf4, 0x74, + 0x43, 0xc8, 0x94, 0x46, 0xba, 0x00, 0x74, 0x3b, 0x72, 0x3c, 0x16, 0x16, 0x2e, 0x1f, 0xa2, 0xee, + 0x88, 0x0b, 0xea, 0x90, 0x31, 0x2d, 0x11, 0x10, 0xb4, 0xa4, 0xb3, 0xd6, 0xef, 0x1b, 0xa4, 0x11, + 0x6d, 0x03, 0x72, 0xc6, 0x7c, 0x84, 0x5b, 0xe5, 0x4a, 0x52, 0xe3, 0x31, 0x32, 0x23, 0x85, 0x55, + 0xff, 0x44, 0x81, 0x05, 0x29, 0x32, 0x06, 0x03, 0xcf, 0x0d, 0xf0, 0x69, 0x43, 0xe3, 0x26, 0x20, + 0x7b, 0xc4, 0xdc, 0x58, 0xb8, 0xc7, 0x61, 0xc6, 0x10, 0x3a, 0x8e, 0x33, 0x22, 0x04, 0xd9, 0xbe, + 0x67, 0x63, 0xee, 0x23, 0xf4, 0x1f, 0xbd, 0x04, 0x5a, 0xdf, 0x74, 0xdc, 0xd0, 0x74, 0x5c, 0xec, + 0x77, 0xf0, 0xc0, 0xb3, 0xf6, 0x78, 0x60, 0x98, 0x8f, 0xf1, 0xeb, 0x04, 0xad, 0x3f, 0x85, 0xc5, + 0xba, 0x14, 0x81, 0x36, 0x71, 0x10, 0x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 0xc6, + 0x5e, 0x81, 0x82, 0x65, 0x06, 0x96, 0x69, 0x63, 0x5e, 0x91, 0x15, 0x20, 0x69, 0xf1, 0xa9, 0x7c, + 0x9b, 0x17, 0x91, 0x05, 0x38, 0x3a, 0x8c, 0xec, 0xb1, 0x86, 0x71, 0xc8, 0x51, 0xe9, 0x77, 0x19, + 0xb8, 0x18, 0x0f, 0x60, 0x6c, 0x55, 0x9e, 0xf2, 0x1c, 0x70, 0xd8, 0xcc, 0x5e, 0xa0, 0x0b, 0xce, + 0x97, 0x26, 0x35, 0x2a, 0x5f, 0x58, 0x70, 0x35, 0x24, 0xb5, 0x8e, 0x4e, 0xe8, 0x3b, 0xdd, 0x2e, + 0x51, 0xff, 0x09, 0x76, 0x13, 0x67, 0x23, 0xe7, 0x18, 0x95, 0xdd, 0xcb, 0x54, 0x46, 0x9b, 0x89, + 0x58, 0x27, 0x12, 0xa4, 0x66, 0x3b, 0xdd, 0x69, 0x72, 0xe9, 0x4e, 0x63, 0xc2, 0x6a, 0x52, 0x21, + 0x1f, 0xdb, 0xde, 0x88, 0x3e, 0xf9, 0x49, 0xfa, 0x2c, 0xcb, 0xfa, 0x90, 0x1a, 0x55, 0x42, 0x9d, + 0x91, 0x09, 0x2d, 0x1c, 0x6b, 0x42, 0x8b, 0xe9, 0x13, 0xfa, 0xfb, 0x0c, 0x5c, 0x4a, 0x9d, 0xd0, + 0xe9, 0x54, 0x6b, 0x6f, 0x43, 0x8e, 0xd4, 0x9f, 0x44, 0x75, 0x20, 0x59, 0x46, 0x8e, 0x7a, 0x8b, + 0xab, 0x55, 0x8c, 0x5a, 0x9c, 0xcc, 0x32, 0xc7, 0xb9, 0x27, 0x3a, 0xde, 0x59, 0xef, 0x15, 0x40, + 0x74, 0x22, 0x92, 0x94, 0xcc, 0xcb, 0x35, 0xd2, 0x22, 0x97, 0x71, 0x51, 0x03, 0x4a, 0xa2, 0xe2, + 0x22, 0xf2, 0x87, 0xff, 0x4f, 0x2d, 0xf0, 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0x34, 0x11, 0x2f, 0x8f, 0xa4, + 0x24, 0xe2, 0xd5, 0x44, 0x97, 0x5d, 0x60, 0x74, 0x31, 0x6a, 0xc3, 0x52, 0x8a, 0xe3, 0x04, 0x95, + 0x12, 0xd5, 0x6d, 0x75, 0x92, 0x87, 0x19, 0xa9, 0xdc, 0xfa, 0x77, 0x60, 0x29, 0xda, 0x61, 0xe4, + 0x87, 0x40, 0x27, 0xd8, 0xd9, 0xd6, 0xc4, 0x65, 0x8c, 0x7a, 0xe8, 0xf6, 0x90, 0x0b, 0x12, 0x3b, + 0x83, 0xf4, 0xb4, 0x42, 0xff, 0xab, 0x02, 0xf3, 0x91, 0x06, 0x27, 0xef, 0x3c, 0x6d, 0x3b, 0x54, + 0xa7, 0xb1, 0x1d, 0xa6, 0x95, 0x0a, 0x6e, 0xc0, 0x59, 0x96, 0x73, 0x05, 0xce, 0x73, 0xdc, 0x19, + 0x60, 0xbf, 0x13, 0x60, 0xcb, 0x73, 0xd9, 0x71, 0x52, 0x35, 0x10, 0x6d, 0x6c, 0x39, 0xcf, 0xf1, + 0x0e, 0xf6, 0x5b, 0xb4, 0x25, 0xed, 0xc6, 0x5b, 0xff, 0x85, 0x02, 0x48, 0x7e, 0x29, 0x33, 0x9d, + 0x8d, 0xf0, 0x2d, 0x98, 0xdb, 0x8d, 0x85, 0x46, 0x2f, 0x60, 0xae, 0xa6, 0x67, 0x13, 0x72, 0xff, + 0x49, 0xbe, 0xd4, 0x59, 0xb2, 0x61, 0x56, 0x4e, 0xff, 0x08, 0x4d, 0xe8, 0x44, 0x01, 0x98, 0xfe, + 0x13, 0x9c, 0xeb, 0xd9, 0x22, 0xd2, 0xd2, 0x7f, 0x82, 0xb3, 0x84, 0xac, 0x92, 0x41, 0xff, 0x49, + 0x10, 0xe9, 0xb3, 0xf7, 0x14, 0x3c, 0x7c, 0x0a, 0x50, 0xbf, 0x05, 0xb3, 0xa3, 0xb7, 0xb8, 0x7b, + 0x4e, 0x77, 0x8f, 0x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0xa9, 0xfa, 0x9f, 0x15, 0xd0, 0x53, 0xf5, 0x63, + 0xfb, 0xcf, 0x94, 0x82, 0xc9, 0x29, 0x34, 0x44, 0x6f, 0x40, 0x51, 0xcc, 0x74, 0x25, 0x97, 0xf2, + 0xba, 0x31, 0x55, 0x7b, 0x23, 0xe2, 0xd1, 0xdf, 0x87, 0xa2, 0xb8, 0x50, 0x41, 0xe7, 0xa1, 0x90, + 0xbc, 0x35, 0xc8, 0xbb, 0xac, 0x74, 0x7d, 0x0d, 0x16, 0x1f, 0xf5, 0x86, 0xc1, 0x1e, 0xb6, 0xf9, + 0x31, 0x78, 0xf7, 0x59, 0x88, 0x85, 0x47, 0x2f, 0xf0, 0x26, 0x7a, 0xbc, 0xbd, 0x4b, 0x1a, 0xc8, + 0x45, 0x1c, 0xa5, 0x90, 0xa3, 0x36, 0x19, 0x86, 0x62, 0x94, 0x29, 0x3e, 0x8a, 0xd8, 0xd5, 0xcb, + 0x22, 0x77, 0x43, 0x25, 0xc8, 0xd1, 0x4b, 0x26, 0xed, 0x0c, 0x2a, 0x42, 0x76, 0xc7, 0x0c, 0x02, + 0x4d, 0xa9, 0xae, 0x41, 0x59, 0x94, 0x7a, 0x38, 0x19, 0x40, 0xbe, 0xee, 0x63, 0x93, 0xd2, 0x01, + 0xe4, 0x59, 0x4d, 0x57, 0x53, 0xaa, 0x9b, 0x30, 0x2b, 0x3f, 0xd9, 0x21, 0xe2, 0xb6, 0x3b, 0x35, + 0xdb, 0xd6, 0xce, 0xa0, 0x59, 0x28, 0x6e, 0x77, 0x04, 0x21, 0x61, 0xda, 0xee, 0x90, 0xf7, 0x14, + 0x9a, 0x8a, 0x66, 0xa0, 0xb0, 0xdd, 0xa1, 0xc9, 0xb0, 0x96, 0x61, 0x00, 0xad, 0xf0, 0x68, 0xd9, + 0xea, 0x6d, 0x98, 0x95, 0xaf, 0x68, 0x88, 0xb8, 0xda, 0x46, 0xf3, 0xed, 0x75, 0x26, 0xae, 0x61, + 0xd4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0x07, 0x5b, 0xcd, 0xad, 0x66, 0xbb, 0x59, 0xdb, 0x68, 0xbe, + 0xbb, 0xde, 0x60, 0xe6, 0xde, 0x6c, 0xb6, 0x36, 0x6b, 0xed, 0xfa, 0x3d, 0x4d, 0x21, 0x23, 0x63, + 0xbf, 0x6a, 0x75, 0x1b, 0xca, 0xc9, 0xab, 0x40, 0xb4, 0x04, 0xda, 0xc6, 0x76, 0xad, 0xd1, 0x79, + 0xb0, 0xd5, 0x7a, 0xb0, 0xb3, 0xb3, 0x6d, 0xb4, 0xa9, 0x80, 0x45, 0x98, 0xa7, 0xd8, 0xe6, 0x56, + 0x7d, 0x7b, 0x73, 0x67, 0x63, 0xbd, 0xcd, 0x2d, 0x41, 0x91, 0xb5, 0xb7, 0x6b, 0xcd, 0x8d, 0xda, + 0xdd, 0x8d, 0x75, 0x4d, 0xbd, 0xfb, 0xc6, 0x6f, 0x3f, 0x5d, 0x51, 0x3e, 0xfa, 0x74, 0x45, 0xf9, + 0xe4, 0xd3, 0x15, 0xe5, 0x07, 0x9f, 0xad, 0x9c, 0xf9, 0xe8, 0xb3, 0x95, 0x33, 0x1f, 0x7f, 0xb6, + 0x72, 0xe6, 0xdd, 0x17, 0xbb, 0x4e, 0xb8, 0x37, 0xdc, 0xbd, 0x66, 0x79, 0xfd, 0xeb, 0x03, 0xc7, + 0xed, 0x5a, 0xe6, 0xe0, 0x7a, 0xe8, 0x58, 0xb6, 0x75, 0x5d, 0x5a, 0x6a, 0xbb, 0x79, 0x7a, 0x1f, + 0xf3, 0xea, 0xbf, 0x07, 0x00, 0xe8, 0xb5, 0x08, 0xf1, 0x37, 0x31, 0x00, 0x00, } func (m *TableSpan) Marshal() (dAtA []byte, err error) { @@ -5561,6 +5686,18 @@ func (m *NodeHeartbeat) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.NodeLoad != nil { + { + size, err := m.NodeLoad.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHeartbeat(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } if m.WriteLeaseWitnessAck != nil { { size, err := m.WriteLeaseWitnessAck.MarshalToSizedBuffer(dAtA[:i]) @@ -5728,6 +5865,25 @@ func (m *NodeHeartbeatResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.NodeLoadStatus != 0 { + i = encodeVarintHeartbeat(dAtA, i, uint64(m.NodeLoadStatus)) + i-- + dAtA[i] = 0x38 + } + if len(m.NodeLoads) > 0 { + for iNdEx := len(m.NodeLoads) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NodeLoads[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHeartbeat(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } if m.WitnessChallenge != nil { { size, err := m.WitnessChallenge.MarshalToSizedBuffer(dAtA[:i]) @@ -6716,21 +6872,21 @@ func (m *InfluencedTables) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x18 } if len(m.TableIDs) > 0 { - dAtA43 := make([]byte, len(m.TableIDs)*10) - var j42 int + dAtA44 := make([]byte, len(m.TableIDs)*10) + var j43 int for _, num1 := range m.TableIDs { num := uint64(num1) for num >= 1<<7 { - dAtA43[j42] = uint8(uint64(num)&0x7f | 0x80) + dAtA44[j43] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j42++ + j43++ } - dAtA43[j42] = uint8(num) - j42++ + dAtA44[j43] = uint8(num) + j43++ } - i -= j42 - copy(dAtA[i:], dAtA43[:j42]) - i = encodeVarintHeartbeat(dAtA, i, uint64(j42)) + i -= j43 + copy(dAtA[i:], dAtA44[:j43]) + i = encodeVarintHeartbeat(dAtA, i, uint64(j43)) i-- dAtA[i] = 0x12 } @@ -7559,6 +7715,47 @@ func (m *DispatcherSetChecksumUpdateRequest) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } +func (m *NodeLoad) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeLoad) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeLoad) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BytesPerSecond != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.BytesPerSecond)))) + i-- + dAtA[i] = 0x19 + } + if m.FlushedEventBytes != 0 { + i = encodeVarintHeartbeat(dAtA, i, uint64(m.FlushedEventBytes)) + i-- + dAtA[i] = 0x10 + } + if len(m.NodeId) > 0 { + i -= len(m.NodeId) + copy(dAtA[i:], m.NodeId) + i = encodeVarintHeartbeat(dAtA, i, uint64(len(m.NodeId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintHeartbeat(dAtA []byte, offset int, v uint64) int { offset -= sovHeartbeat(v) base := offset @@ -8036,6 +8233,10 @@ func (m *NodeHeartbeat) Size() (n int) { l = m.WriteLeaseWitnessAck.Size() n += 1 + l + sovHeartbeat(uint64(l)) } + if m.NodeLoad != nil { + l = m.NodeLoad.Size() + n += 1 + l + sovHeartbeat(uint64(l)) + } return n } @@ -8111,6 +8312,15 @@ func (m *NodeHeartbeatResponse) Size() (n int) { l = m.WitnessChallenge.Size() n += 1 + l + sovHeartbeat(uint64(l)) } + if len(m.NodeLoads) > 0 { + for _, e := range m.NodeLoads { + l = e.Size() + n += 1 + l + sovHeartbeat(uint64(l)) + } + } + if m.NodeLoadStatus != 0 { + n += 1 + sovHeartbeat(uint64(m.NodeLoadStatus)) + } return n } @@ -8882,6 +9092,25 @@ func (m *DispatcherSetChecksumUpdateRequest) Size() (n int) { return n } +func (m *NodeLoad) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodeId) + if l > 0 { + n += 1 + l + sovHeartbeat(uint64(l)) + } + if m.FlushedEventBytes != 0 { + n += 1 + sovHeartbeat(uint64(m.FlushedEventBytes)) + } + if m.BytesPerSecond != 0 { + n += 9 + } + return n +} + func sovHeartbeat(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -11962,6 +12191,42 @@ func (m *NodeHeartbeat) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeLoad", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHeartbeat + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHeartbeat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NodeLoad == nil { + m.NodeLoad = &NodeLoad{} + } + if err := m.NodeLoad.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipHeartbeat(dAtA[iNdEx:]) @@ -12444,6 +12709,59 @@ func (m *NodeHeartbeatResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeLoads", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHeartbeat + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHeartbeat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeLoads = append(m.NodeLoads, &NodeLoad{}) + if err := m.NodeLoads[len(m.NodeLoads)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeLoadStatus", wireType) + } + m.NodeLoadStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NodeLoadStatus |= NodeLoadStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipHeartbeat(dAtA[iNdEx:]) @@ -17496,6 +17814,118 @@ func (m *DispatcherSetChecksumUpdateRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *NodeLoad) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeLoad: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeLoad: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHeartbeat + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHeartbeat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FlushedEventBytes", wireType) + } + m.FlushedEventBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FlushedEventBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field BytesPerSecond", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.BytesPerSecond = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipHeartbeat(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHeartbeat + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipHeartbeat(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/heartbeatpb/heartbeat.proto b/heartbeatpb/heartbeat.proto index 4f16a90539..9259b5a3de 100644 --- a/heartbeatpb/heartbeat.proto +++ b/heartbeatpb/heartbeat.proto @@ -209,6 +209,7 @@ message NodeHeartbeat { uint64 write_lease_request_seq = 5; uint32 write_lease_protocol_version = 6; WriteLeaseWitnessAck write_lease_witness_ack = 7; + NodeLoad node_load = 8; } message WriteLeaseWitnessChallenge { @@ -233,6 +234,8 @@ message NodeHeartbeatResponse { uint64 request_seq = 3; uint64 lease_duration_ms = 4; WriteLeaseWitnessChallenge witness_challenge = 5; + repeated NodeLoad node_loads = 6; + NodeLoadStatus node_load_status = 7; } // SetNodeLivenessRequest asks a node to transition its local liveness. @@ -549,3 +552,17 @@ message DispatcherSetChecksumUpdateRequest { uint64 seq = 4; DispatcherSetChecksum checksum = 5; } + +// Requests report a process-wide cumulative counter. Coordinator responses +// identify each node and report its derived rate, without dispatcher details. +message NodeLoad { + string node_id = 1; + uint64 flushed_event_bytes = 2; + double bytes_per_second = 3; +} + +enum NodeLoadStatus { + LOAD_UNSUPPORTED = 0; + LOAD_INCOMPLETE = 1; + LOAD_AVAILABLE = 2; +} diff --git a/maintainer/maintainer_manager.go b/maintainer/maintainer_manager.go index c54ca83957..801faae116 100644 --- a/maintainer/maintainer_manager.go +++ b/maintainer/maintainer_manager.go @@ -20,6 +20,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" "github.com/pingcap/ticdc/pkg/config" @@ -53,7 +54,8 @@ type Manager struct { // heartbeatCh coalesces prompt reports from low-latency maintainers. heartbeatCh chan struct{} // node holds node-scoped liveness and drain state that applies to the whole capture. - node *managerNodeState + node *managerNodeState + nodeLoads *replica.NodeLoadTracker // maintainers holds changefeed-scoped state and lifecycle operations. maintainers *managerMaintainerSet writeGate *writelease.Gate @@ -85,6 +87,7 @@ func NewMaintainerManager( node: newManagerNodeState(nodeLiveness), maintainers: newManagerMaintainerSet(conf, nodeInfo, heartbeatCh), writeGate: writeGate, + nodeLoads: replica.NewNodeLoadTracker(), verifyCoordinator: func(ctx context.Context, id node.ID, version int64) error { nodeManager, ok := appcontext.TryGetService[*watcher.NodeManager](watcher.NodeManagerName) if !ok || nodeManager == nil { @@ -100,6 +103,7 @@ func NewMaintainerManager( return nil }, } + m.maintainers.nodeLoads = m.nodeLoads mc.RegisterHandler(messaging.MaintainerManagerTopic, m.recvMessages) mc.RegisterHandler(messaging.MaintainerTopic, m.recvMaintainerMessage) @@ -280,10 +284,16 @@ func (m *Manager) onCoordinatorBootstrapRequest(msg *messaging.TargetMessage) { if m.coordinatorID != msg.From || m.coordinatorVersion != req.Version { m.writeGate.InvalidateP2P() m.node.resetWriteLeaseRequests() + m.nodeLoads.Replace(nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, time.Now()) } m.writeGate.SetP2PRequired( req.GetWriteLeaseProtocolVersion() == heartbeatpb.CurrentWriteLeaseProtocolVersion, ) + if req.GetWriteLeaseProtocolVersion() != heartbeatpb.CurrentWriteLeaseProtocolVersion { + // Older coordinators do not send node heartbeat responses. Retain count + // balancing instead of waiting indefinitely for a resource snapshot. + m.nodeLoads.Replace(nil, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED, time.Now()) + } m.coordinatorID = msg.From m.coordinatorVersion = req.Version diff --git a/maintainer/maintainer_manager_maintainers.go b/maintainer/maintainer_manager_maintainers.go index 7a0ff718d2..514de2004e 100644 --- a/maintainer/maintainer_manager_maintainers.go +++ b/maintainer/maintainer_manager_maintainers.go @@ -21,6 +21,7 @@ import ( "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/errors" @@ -52,6 +53,7 @@ type managerMaintainerSet struct { taskScheduler threadpool.ThreadPool // heartbeatCh coalesces prompt reports from low-latency maintainers. heartbeatCh chan<- struct{} + nodeLoads *replica.NodeLoadTracker // registryMu serializes registry mutations that create, replace, or fully // close maintainers because maintainer metrics share changefeed labels across @@ -220,6 +222,10 @@ func (p *managerMaintainerSet) handleAddMaintainer( newMaintainer := func() *Maintainer { maintainer := NewMaintainer(changefeedID, p.conf, info, p.nodeInfo, p.taskScheduler, req.CheckpointTs, req.IsNewChangefeed, req.KeyspaceId) maintainer.managerHeartbeatCh = p.heartbeatCh + maintainer.controller.spanController.SetNodeLoadTracker(p.nodeLoads) + if maintainer.controller.redoSpanController != nil { + maintainer.controller.redoSpanController.SetNodeLoadTracker(p.nodeLoads) + } return maintainer } registeredMaintainer := p.registerMaintainerForAdd(changefeedID, requestEpoch, newMaintainer) diff --git a/maintainer/maintainer_manager_node.go b/maintainer/maintainer_manager_node.go index 552f3b45ff..6536ee030c 100644 --- a/maintainer/maintainer_manager_node.go +++ b/maintainer/maintainer_manager_node.go @@ -18,6 +18,7 @@ import ( "time" "github.com/pingcap/log" + "github.com/pingcap/ticdc/downstreamadapter/dispatcher" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/liveness" "github.com/pingcap/ticdc/pkg/messaging" @@ -112,6 +113,7 @@ func (m *Manager) sendNodeHeartbeat(force bool) { WriteLeaseRequestSeq: requestSeq, WriteLeaseProtocolVersion: heartbeatpb.CurrentWriteLeaseProtocolVersion, WriteLeaseWitnessAck: m.node.pendingWitnessAck, + NodeLoad: &heartbeatpb.NodeLoad{FlushedEventBytes: dispatcher.FlushedEventBytes()}, } target := m.newCoordinatorTopicMessage(hb) if err := m.mc.SendCommand(target); err != nil { @@ -190,6 +192,7 @@ func (m *Manager) onNodeHeartbeatResponse(msg *messaging.TargetMessage) { m.writeGate.SetP2PRequired(true) } captureLeaseResponseCounter.WithLabelValues("accepted").Inc() + m.nodeLoads.Replace(response.NodeLoads, response.NodeLoadStatus, time.Now()) m.node.lastAppliedLeaseSeq = requestSeq for seq := range m.node.writeLeaseRequestSentAt { if seq <= requestSeq { diff --git a/maintainer/maintainer_manager_test.go b/maintainer/maintainer_manager_test.go index 193e94d6e5..390f836065 100644 --- a/maintainer/maintainer_manager_test.go +++ b/maintainer/maintainer_manager_test.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/kvproto/pkg/keyspacepb" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/maintainer/testutil" "github.com/pingcap/ticdc/pkg/common" appcontext "github.com/pingcap/ticdc/pkg/common/context" @@ -234,6 +235,7 @@ func cleanupMaintainerMetricsForTest(t *testing.T, cfID common.ChangeFeedID) { func TestManagerMaintainerSet_AddMaintainerRejectsLiveNewerEpoch(t *testing.T) { maintainers := newManagerMaintainerSetForAddTest(t) + maintainers.nodeLoads = replica.NewNodeLoadTracker() cfID := common.NewChangeFeedIDWithName("reject-live-newer-epoch", common.DefaultKeyspaceName) cleanupMaintainerMetricsForTest(t, cfID) noDrainTarget := func() (node.ID, uint64) { return "", 0 } @@ -242,6 +244,7 @@ func TestManagerMaintainerSet_AddMaintainerRejectsLiveNewerEpoch(t *testing.T) { maintainers.handleAddMaintainer(newAddMaintainerRequestForEpoch(t, cfID, 1, 1), noDrainTarget) oldMaintainer, ok := maintainers.getMaintainer(cfID) require.True(t, ok) + require.Same(t, maintainers.nodeLoads, oldMaintainer.controller.spanController.NodeLoadTracker()) require.Equal(t, uint64(1), oldMaintainer.currentMaintainerEpoch()) require.Equal(t, float64(1), promtestutil.ToFloat64(maintainerGauge.WithLabelValues(keyspace, changefeed))) diff --git a/maintainer/node_liveness_test.go b/maintainer/node_liveness_test.go index 39e14fac3d..e79af8f5c4 100644 --- a/maintainer/node_liveness_test.go +++ b/maintainer/node_liveness_test.go @@ -322,6 +322,7 @@ func TestNodeHeartbeatResponseRenewsP2PWriteLease(t *testing.T) { heartbeat := heartbeatMessage.Message[0].(*heartbeatpb.NodeHeartbeat) require.Equal(t, heartbeatpb.CurrentWriteLeaseProtocolVersion, heartbeat.WriteLeaseProtocolVersion) require.NotZero(t, heartbeat.WriteLeaseRequestSeq) + require.NotNil(t, heartbeat.NodeLoad) responseMessage := messaging.NewSingleTargetMessage( m.nodeInfo.ID, @@ -331,23 +332,33 @@ func TestNodeHeartbeatResponseRenewsP2PWriteLease(t *testing.T) { TargetNodeEpoch: m.node.nodeEpoch, RequestSeq: heartbeat.WriteLeaseRequestSeq, LeaseDurationMs: uint64(writelease.P2PLeaseDuration.Milliseconds()), + NodeLoads: []*heartbeatpb.NodeLoad{{NodeId: "n1", BytesPerSecond: 1234}}, + NodeLoadStatus: heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, }, ) responseMessage.From = m.coordinatorID m.onNodeHeartbeatResponse(responseMessage) require.True(t, gate.IsWritable()) + rates, status := m.nodeLoads.Snapshot(map[node.ID]*node.Info{"n1": {ID: "n1"}}, time.Now()) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + require.Equal(t, float64(1234), rates["n1"]) // An old coordinator response cannot renew a new request. m.writeGate.InvalidateP2P() responseMessage.Message[0].(*heartbeatpb.NodeHeartbeatResponse).CoordinatorVersion = 9 + responseMessage.Message[0].(*heartbeatpb.NodeHeartbeatResponse).NodeLoads[0].BytesPerSecond = 9999 m.onNodeHeartbeatResponse(responseMessage) require.False(t, gate.IsWritable()) + rates, _ = m.nodeLoads.Snapshot(map[node.ID]*node.Info{"n1": {ID: "n1"}}, time.Now()) + require.Equal(t, float64(1234), rates["n1"], "stale coordinator cannot replace node load") // Replaying an already applied sequence from the current coordinator is also rejected. responseMessage.Message[0].(*heartbeatpb.NodeHeartbeatResponse).CoordinatorVersion = 10 m.onNodeHeartbeatResponse(responseMessage) require.False(t, gate.IsWritable()) + rates, _ = m.nodeLoads.Snapshot(map[node.ID]*node.Info{"n1": {ID: "n1"}}, time.Now()) + require.Equal(t, float64(1234), rates["n1"], "replayed response cannot replace node load") } func TestNodeHeartbeatResponseUpdatesClusterP2PMode(t *testing.T) { diff --git a/maintainer/replica/node_load.go b/maintainer/replica/node_load.go new file mode 100644 index 0000000000..2eaa4822ed --- /dev/null +++ b/maintainer/replica/node_load.go @@ -0,0 +1,90 @@ +// Copyright 2026 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 replica + +import ( + "math" + "sync" + "time" + + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/pkg/node" +) + +const NodeLoadStaleThreshold = 5 * time.Second + +// NodeLoadTracker shares an immutable coordinator snapshot among all maintainers +// on a capture. It contains node totals only, never dispatcher placement. +type NodeLoadTracker struct { + mu sync.RWMutex + rates map[node.ID]float64 + status heartbeatpb.NodeLoadStatus + updatedAt time.Time +} + +func NewNodeLoadTracker() *NodeLoadTracker { + return &NodeLoadTracker{status: heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE} +} + +func (t *NodeLoadTracker) Replace(loads []*heartbeatpb.NodeLoad, status heartbeatpb.NodeLoadStatus, now time.Time) { + if t == nil { + return + } + rates := make(map[node.ID]float64, len(loads)) + if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + for _, load := range loads { + if load == nil || load.NodeId == "" || load.BytesPerSecond < 0 || + math.IsNaN(load.BytesPerSecond) || math.IsInf(load.BytesPerSecond, 0) { + status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + break + } + id := node.ID(load.NodeId) + if _, exists := rates[id]; exists { + status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + break + } + rates[id] = load.BytesPerSecond + } + } else if status != heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED { + status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + } + t.mu.Lock() + defer t.mu.Unlock() + t.rates, t.status, t.updatedAt = rates, status, now +} + +// Snapshot returns immutable rates. Callers must copy them before projecting +// local moves; those projections must not influence other maintainers. +func (t *NodeLoadTracker) Snapshot(nodes map[node.ID]*node.Info, now time.Time) (map[node.ID]float64, heartbeatpb.NodeLoadStatus) { + if t == nil { + return nil, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED + } + t.mu.RLock() + defer t.mu.RUnlock() + if t.status == heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED { + return nil, t.status + } + if now.Sub(t.updatedAt) > NodeLoadStaleThreshold { + return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + } + if t.status != heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + return nil, t.status + } + for id := range nodes { + if _, ok := t.rates[id]; !ok { + return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + } + } + return t.rates, t.status +} diff --git a/maintainer/replica/node_load_test.go b/maintainer/replica/node_load_test.go new file mode 100644 index 0000000000..5b2d9c624d --- /dev/null +++ b/maintainer/replica/node_load_test.go @@ -0,0 +1,80 @@ +// Copyright 2026 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 replica + +import ( + "math" + "testing" + "time" + + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/pkg/common" + "github.com/pingcap/ticdc/pkg/node" + "github.com/stretchr/testify/require" +) + +func TestNodeLoadTracker(t *testing.T) { + now := time.Now() + nodes := map[node.ID]*node.Info{"a": {ID: "a"}, "b": {ID: "b"}} + tracker := NewNodeLoadTracker() + _, status := tracker.Snapshot(nodes, now) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) + loads := []*heartbeatpb.NodeLoad{{NodeId: "a", BytesPerSecond: 100}, {NodeId: "b"}} + tracker.Replace(loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) + rates, status := tracker.Snapshot(nodes, now) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + require.Equal(t, float64(100), rates["a"]) + // Mutating a protobuf or replacing the tracker never mutates old snapshots. + loads[0].BytesPerSecond = 200 + tracker.Replace(loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) + require.Equal(t, float64(100), rates["a"]) + _, status = tracker.Snapshot(nodes, now.Add(NodeLoadStaleThreshold+1)) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) + nodes["new"] = &node.Info{ID: "new"} + _, status = tracker.Snapshot(nodes, now) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) + delete(nodes, "new") + for _, invalid := range [][]*heartbeatpb.NodeLoad{ + {nil}, + {{NodeId: ""}}, + {{NodeId: "a", BytesPerSecond: -1}}, + {{NodeId: "a", BytesPerSecond: math.NaN()}}, + {{NodeId: "a", BytesPerSecond: math.Inf(1)}}, + {{NodeId: "a"}, {NodeId: "a"}}, + } { + tracker.Replace(invalid, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) + _, status = tracker.Snapshot(nodes, now) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) + } + tracker.Replace(nil, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED, now) + _, status = tracker.Snapshot(nodes, now.Add(time.Hour)) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED, status) +} + +func TestSpanTrafficSamples(t *testing.T) { + r := NewSpanReplication(common.NewChangeFeedIDWithName("test", common.DefaultKeyspaceName), common.NewDispatcherID(), 1, getTableSpanByID(4), 10, 0, false) + now := time.Now() + require.Zero(t, r.TrafficRate(now)) + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 11, EventSizePerSecond: 100}) + require.Equal(t, float64(100), r.TrafficRate(time.Now())) + // Status-only heartbeats and rejected old checkpoints retain the sample. + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 12}) + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 9, EventSizePerSecond: 200}) + require.Equal(t, float64(100), r.TrafficRate(time.Now())) + require.Zero(t, r.TrafficRate(time.Now().Add(NodeLoadStaleThreshold+time.Second))) + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 12, EventSizePerSecond: 1}) + require.Equal(t, float64(1), r.TrafficRate(time.Now())) + r.SetNodeID("another") + require.Zero(t, r.TrafficRate(time.Now())) +} diff --git a/maintainer/replica/replication_span.go b/maintainer/replica/replication_span.go index 465afa20c1..0246b3d344 100644 --- a/maintainer/replica/replication_span.go +++ b/maintainer/replica/replication_span.go @@ -16,6 +16,7 @@ package replica import ( "bytes" "sync" + "time" "github.com/pingcap/log" "github.com/pingcap/ticdc/heartbeatpb" @@ -41,16 +42,33 @@ type SpanReplication struct { enabledSplit bool schemaID int64 - nodeIDMutex sync.Mutex // mutex for nodeID + nodeIDMutex sync.Mutex // protects nodeID and traffic nodeID node.ID groupID replica.GroupID status *atomic.Pointer[heartbeatpb.TableSpanStatus] + traffic spanTraffic blockState *atomic.Pointer[heartbeatpb.State] // committedCheckpointTs points to the controller owned committed checkpoint for this mode. // It provides a monotonic lower bound for any recreated dispatcher StartTs. committedCheckpointTs *atomic.Uint64 } +type spanTraffic struct { + bytesPerSecond float64 + updatedAt time.Time +} + +// TrafficRate preserves complete traffic samples across status-only updates. +// Zero means no recent sample; one is the dispatcher's idle sentinel. +func (r *SpanReplication) TrafficRate(now time.Time) float64 { + r.nodeIDMutex.Lock() + defer r.nodeIDMutex.Unlock() + if now.Sub(r.traffic.updatedAt) > NodeLoadStaleThreshold { + return 0 + } + return r.traffic.bytesPerSecond +} + func NewSpanReplication(cfID common.ChangeFeedID, id common.DispatcherID, SchemaID int64, @@ -177,6 +195,11 @@ func (r *SpanReplication) UpdateStatus(newStatus *heartbeatpb.TableSpanStatus) b return false } r.status.Store(newStatus) + if newStatus.EventSizePerSecond > 0 { + r.nodeIDMutex.Lock() + r.traffic = spanTraffic{bytesPerSecond: float64(newStatus.EventSizePerSecond), updatedAt: time.Now()} + r.nodeIDMutex.Unlock() + } return newStatus.CheckpointTs != oldStatus.CheckpointTs } @@ -227,6 +250,9 @@ func (r *SpanReplication) SetSchemaID(schemaID int64) { func (r *SpanReplication) SetNodeID(n node.ID) { r.nodeIDMutex.Lock() defer r.nodeIDMutex.Unlock() + if r.nodeID != n { + r.traffic = spanTraffic{} + } r.nodeID = n } diff --git a/maintainer/scheduler/balance.go b/maintainer/scheduler/balance.go index 524be7638b..9ab7d6172d 100644 --- a/maintainer/scheduler/balance.go +++ b/maintainer/scheduler/balance.go @@ -15,10 +15,12 @@ package scheduler import ( "context" + "maps" "math/rand" "time" "github.com/pingcap/failpoint" + "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/maintainer/operator" "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/maintainer/span" @@ -34,7 +36,7 @@ import ( // balanceScheduler mainly focus on two types of operations: // 1. Split operations: splits the one large span for the whole table into smaller ones. -// 2. Move operations: distributes spans across nodes for balance the span count in each node. +// 2. Move operations: balances node traffic and span counts without splitting tables. type balanceScheduler struct { changefeedID common.ChangeFeedID batchSize int @@ -52,6 +54,8 @@ type balanceScheduler struct { drainState *DrainState drainBalanceBlockedUntil time.Time + trafficMovePending bool + trafficBalanceNotBefore time.Time } func NewBalanceScheduler( @@ -81,6 +85,11 @@ func NewBalanceScheduler( func (s *balanceScheduler) Execute() time.Time { now := time.Now() nextCheckTime := now.Add(s.checkBalanceInterval) + if s.spanController.NodeLoadTracker() != nil && s.checkBalanceInterval > 0 { + // Independent maintainers should not repeatedly act on the same sample + // at the same time after bootstrap or a cluster-wide workload change. + nextCheckTime = nextCheckTime.Add(time.Duration(s.random.Int63n(int64(s.checkBalanceInterval/2) + 1))) + } failpoint.Inject("StopBalanceScheduler", func() { failpoint.Return(nextCheckTime) }) @@ -90,12 +99,17 @@ func (s *balanceScheduler) Execute() time.Time { // and keep a cooldown window after drain completion to avoid churn. return nextCheckTime } - // TODO: consider to ignore split tables' dispatcher basic schedule operator to decide whether we can make balance schedule if s.operatorController.OperatorSize() > 0 || s.spanController.GetAbsentSize() > 0 { // not in stable schedule state, skip balance return nextCheckTime } + if s.trafficMovePending { + // Start the observation window after the operator finishes, so a slow + // move cannot consume the cooldown before its new placement is sampled. + s.trafficMovePending = false + s.trafficBalanceNotBefore = now.Add(max(s.checkBalanceInterval, replica.NodeLoadStaleThreshold)) + } // 1. check whether we have spans in defaultGroupID need to be splitted. // we only consider the not splitted span here. @@ -126,19 +140,113 @@ func (s *balanceScheduler) schedulerDefaultGroup( maxSize int, state drainStateSnapshot, ) int { + if maxSize <= 0 || time.Now().Before(s.trafficBalanceNotBefore) { + return 0 + } nodes := s.nodeManager.GetAliveNodes() nodes = filterAliveNodesByDrainTarget(nodes, state) - if len(nodes) == 0 { + if len(nodes) < 2 { return 0 } group := pkgreplica.DefaultGroupID - // fast path, check the balance status + now := time.Now() + loads, status := s.spanController.NodeLoadTracker().Snapshot(nodes, now) + if status == heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE { + return 0 + } moveSize := pkgScheduler.CheckBalanceStatus(s.spanController.GetTaskSizePerNodeByGroup(group), nodes) - if moveSize <= 0 { + average, overloaded := float64(0), false + if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + for id := range nodes { + average += loads[id] + } + average /= float64(len(nodes)) + for id := range nodes { + if loads[id] > average*1.2 { + overloaded = true + break + } + } + } + if moveSize <= 0 && !overloaded { + // The common balanced or idle case must not scan every dispatcher. return 0 } replicas := s.spanController.GetReplicatingByGroup(group) - return pkgScheduler.Balance(maxSize, s.random, nodes, replicas, s.doMove) + if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + // Project only this maintainer's accepted moves. Other maintainers keep + // using the coordinator snapshot until the next node sample arrives. + loads = maps.Clone(loads) + if overloaded && s.balanceTraffic(nodes, replicas, loads, average, now) { + s.trafficMovePending = true + return 1 + } + } + // fast path, check the balance status + if moveSize <= 0 { + return 0 + } + return pkgScheduler.Balance(maxSize, s.random, nodes, replicas, func(r *replica.SpanReplication, target node.ID) bool { + if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + rate := r.TrafficRate(now) + if rate == 0 || (rate > 1 && !improvesNodeLoad(loads[r.GetNodeID()], loads[target], rate)) { + return false + } + if rate == 1 { + rate = 0 // The idle sentinel contributes no actual traffic. + } + if !s.doMove(r, target) { + return false + } + loads[r.GetNodeID()] = max(0, loads[r.GetNodeID()]-rate) + loads[target] += rate + return true + } + return s.doMove(r, target) + }) +} + +// improvesNodeLoad requires a meaningful reduction in the pair's imbalance. +// A single indivisible hot table must not bounce between otherwise idle nodes. +func improvesNodeLoad(source, target, rate float64) bool { + return rate > 0 && rate < (source-target)*0.9 +} + +func (s *balanceScheduler) balanceTraffic( + nodes map[node.ID]*node.Info, + replicas []*replica.SpanReplication, + loads map[node.ID]float64, + average float64, + now time.Time, +) bool { + // Randomize both dispatcher and destination choice so independent + // maintainers can spread their moves across eligible idle nodes. + s.random.Shuffle(len(replicas), func(i, j int) { replicas[i], replicas[j] = replicas[j], replicas[i] }) + for _, r := range replicas { + source := r.GetNodeID() + if _, alive := nodes[source]; !alive || !r.IsWorking() || loads[source] <= average*1.2 { + continue + } + rate := r.TrafficRate(now) + if rate <= 1 { + continue + } + var target node.ID + candidates := 0 + for id := range nodes { + if id == source || loads[id] >= average || !improvesNodeLoad(loads[source], loads[id], rate) { + continue + } + candidates++ + if s.random.Intn(candidates) == 0 { + target = id + } + } + if candidates > 0 && s.doMove(r, target) { + return true + } + } + return false } func (s *balanceScheduler) doSplit(results pkgReplica.GroupCheckResult) int { diff --git a/maintainer/scheduler/balance_test.go b/maintainer/scheduler/balance_test.go index 24d571c59a..1de653cff5 100644 --- a/maintainer/scheduler/balance_test.go +++ b/maintainer/scheduler/balance_test.go @@ -14,9 +14,12 @@ package scheduler import ( + "math/rand" "testing" "time" + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/node" "github.com/stretchr/testify/require" @@ -158,3 +161,154 @@ func TestBalanceSchedulerSkipsDuringDrainCooldown(t *testing.T) { _ = s.Execute() require.Greater(t, oc.OperatorSize(), 0) } + +// Reproduce #6251: nine indivisible tables, equal counts, and three hot +// dispatchers initially on one node. Execute real move operators to completion +// and feed their placement back through subsequent node samples. +func TestBalanceSchedulerBalancesWholeTableTraffic(t *testing.T) { + cfID, nm, oc, sc, drainState, self := newDrainSchedulerTestHarness(t) + nodes := []node.ID{self, "a", "b"} + tracker := replica.NewNodeLoadTracker() + sc.SetNodeLoadTracker(tracker) + replicas := make([]*replica.SpanReplication, 0, 9) + traffic := make(map[common.DispatcherID]float32) + for n, id := range nodes { + nm.GetAliveNodes()[id] = &node.Info{ID: id} + for i := range 3 { + r := addReplicatingSpan(t, cfID, sc, int64(n*3+i+1), id) + replicas = append(replicas, r) + traffic[r.ID] = 1 + if n == 0 { + traffic[r.ID] = 1000 + } + } + } + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, drainState, 5) + s.random = rand.New(rand.NewSource(1)) + hotMoves := 0 + for round := range 40 { + loads := map[node.ID]float64{} + for _, r := range replicas { + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: traffic[r.ID]}) + if traffic[r.ID] > 1 { + loads[r.GetNodeID()] += float64(traffic[r.ID]) + } + } + reports := make([]*heartbeatpb.NodeLoad, 0, 3) + for _, id := range nodes { + reports = append(reports, &heartbeatpb.NodeLoad{NodeId: id.String(), BytesPerSecond: loads[id]}) + } + tracker.Replace(reports, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + // Advance the observation window without sleeping in the unit test. + s.trafficMovePending = false + s.trafficBalanceNotBefore = time.Time{} + s.Execute() + if round == 0 { + require.Equal(t, 1, oc.OperatorSize(), "traffic balance is locally limited to one move") + s.Execute() + require.Equal(t, 1, oc.OperatorSize(), "an unfinished move blocks another round") + require.True(t, s.trafficMovePending) + } + for _, op := range oc.GetAllOperators() { + if traffic[op.ID()] > 1 { + hotMoves++ + } + origin := op.Schedule().To + op.Check(origin, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Stopped}) + target := op.Schedule().To + op.Check(target, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working}) + require.True(t, op.IsFinished()) + op.PostFinish() + oc.RemoveOp(op.ID()) + } + if round == 0 { + // Even after the first move finishes, give node sampling time to + // observe it before generating another traffic or count move. + before := time.Now() + s.Execute() + require.Zero(t, oc.OperatorSize()) + require.False(t, s.trafficBalanceNotBefore.Before(before.Add(replica.NodeLoadStaleThreshold))) + } + } + counts, hotCounts := map[node.ID]int{}, map[node.ID]int{} + for _, r := range replicas { + counts[r.GetNodeID()]++ + if traffic[r.ID] > 1 { + hotCounts[r.GetNodeID()]++ + } + require.False(t, r.IsSplitEnabled()) + } + require.Equal(t, 2, hotMoves, "hot tables must not be moved back by count balancing") + for _, id := range nodes { + require.Equal(t, 1, hotCounts[id]) + require.Equal(t, 3, counts[id]) + } +} + +func TestBalanceSchedulerRequiresReliableNodeLoad(t *testing.T) { + for _, tc := range []struct { + name string + status heartbeatpb.NodeLoadStatus + age time.Duration + moves bool + }{ + {"incomplete", heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, 0, false}, + {"stale", heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, replica.NodeLoadStaleThreshold + time.Second, false}, + {"legacy count balance", heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED, 0, true}, + } { + t.Run(tc.name, func(t *testing.T) { + cfID, nm, oc, sc, ds, self := newDrainSchedulerTestHarness(t) + nm.GetAliveNodes()[self] = &node.Info{ID: self} + nm.GetAliveNodes()["dest"] = &node.Info{ID: "dest"} + for i := 1; i <= 6; i++ { + addReplicatingSpan(t, cfID, sc, int64(i), self) + } + tracker := replica.NewNodeLoadTracker() + tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 300}, {NodeId: "dest"}}, tc.status, time.Now().Add(-tc.age)) + sc.SetNodeLoadTracker(tracker) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 2) + s.Execute() + require.Equal(t, tc.moves, oc.OperatorSize() > 0) + }) + } +} + +func TestBalanceSchedulerUsesNodeTotalsAcrossChangefeeds(t *testing.T) { + cfID, nm, oc, sc, ds, self := newDrainSchedulerTestHarness(t) + for _, id := range []node.ID{self, "busy", "idle"} { + nm.GetAliveNodes()[id] = &node.Info{ID: id} + } + for i, id := range []node.ID{self, "busy", "idle"} { + r := addReplicatingSpan(t, cfID, sc, int64(i+1), id) + // This changefeed has equal traffic per node. Other changefeeds make + // self and busy overloaded; only idle is a valid destination. + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: 100}) + } + tracker := replica.NewNodeLoadTracker() + tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 1000}, {NodeId: "busy", BytesPerSecond: 2000}, {NodeId: "idle", BytesPerSecond: 100}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + sc.SetNodeLoadTracker(tracker) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) + s.Execute() + require.Equal(t, 1, oc.OperatorSize()) + op := oc.GetAllOperators()[0] + origin := op.Schedule().To + require.NotEqual(t, node.ID("idle"), origin) + op.Check(origin, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Stopped}) + require.Equal(t, node.ID("idle"), op.Schedule().To) +} + +func TestBalanceSchedulerDoesNotMoveAnIndivisibleHotTable(t *testing.T) { + cfID, nm, oc, sc, ds, self := newDrainSchedulerTestHarness(t) + nm.GetAliveNodes()[self] = &node.Info{ID: self} + nm.GetAliveNodes()["dest"] = &node.Info{ID: "dest"} + r := addReplicatingSpan(t, cfID, sc, 1, self) + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: 100}) + r = addReplicatingSpan(t, cfID, sc, 2, "dest") + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: 1}) + tracker := replica.NewNodeLoadTracker() + tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 100}, {NodeId: "dest"}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + sc.SetNodeLoadTracker(tracker) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) + s.Execute() + require.Zero(t, oc.OperatorSize()) +} diff --git a/maintainer/span/span_controller.go b/maintainer/span/span_controller.go index 83868cbc5b..14da8c6bdf 100644 --- a/maintainer/span/span_controller.go +++ b/maintainer/span/span_controller.go @@ -82,6 +82,8 @@ type Controller struct { enableSplittableCheck bool keyspaceID uint32 + // nodeLoadTracker is shared by local maintainers and set before scheduling starts. + nodeLoadTracker *replica.NodeLoadTracker // maintainerCommittedCheckpointTs is the controller owned monotonic scheduling baseline. // Any created dispatcher in this mode must start from at least this checkpoint. @@ -128,6 +130,15 @@ func (c *Controller) doWithRLock(action func()) { action() } +// SetNodeLoadTracker wires the shared view before this controller is started. +func (c *Controller) SetNodeLoadTracker(tracker *replica.NodeLoadTracker) { + c.nodeLoadTracker = tracker +} + +func (c *Controller) NodeLoadTracker() *replica.NodeLoadTracker { + return c.nodeLoadTracker +} + // ShouldEnableSplit returns whether split is allowed for a table given its splittable flag and controller config. func (c *Controller) ShouldEnableSplit(splitable bool) bool { if !c.enableSplittableCheck { diff --git a/pkg/messaging/message_write_lease_test.go b/pkg/messaging/message_write_lease_test.go index 34274a0474..1ffb46c69a 100644 --- a/pkg/messaging/message_write_lease_test.go +++ b/pkg/messaging/message_write_lease_test.go @@ -47,6 +47,8 @@ func TestNodeHeartbeatResponseRemoteRoundTrip(t *testing.T) { TargetNodeEpoch: 11, RequestSeq: 12, LeaseDurationMs: 5000, + NodeLoads: []*heartbeatpb.NodeLoad{{NodeId: "capture", BytesPerSecond: 1234.5}}, + NodeLoadStatus: heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, } require.NoError(t, sender.SendCommand( NewSingleTargetMessage(receiver.id, MaintainerManagerTopic, response), @@ -69,6 +71,8 @@ func TestNodeHeartbeatResponseIOTypeRoundTrip(t *testing.T) { TargetNodeEpoch: 11, RequestSeq: 12, LeaseDurationMs: 5000, + NodeLoads: []*heartbeatpb.NodeLoad{{NodeId: "capture", BytesPerSecond: 1234.5}}, + NodeLoadStatus: heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, WitnessChallenge: &heartbeatpb.WriteLeaseWitnessChallenge{ CoordinatorVersion: 10, CoordinatorNodeEpoch: 11, @@ -85,6 +89,16 @@ func TestNodeHeartbeatResponseIOTypeRoundTrip(t *testing.T) { decoded, err := decodeIOType(TypeNodeHeartbeatResponse, data) require.NoError(t, err) require.Equal(t, response, decoded) + + heartbeat := &heartbeatpb.NodeHeartbeat{ + NodeEpoch: 11, + NodeLoad: &heartbeatpb.NodeLoad{FlushedEventBytes: 12345}, + } + data, err = heartbeat.Marshal() + require.NoError(t, err) + decoded, err = decodeIOType(TypeNodeHeartbeatRequest, data) + require.NoError(t, err) + require.Equal(t, heartbeat, decoded) } func TestEventBrokerDispatcherCountIOTypeRoundTrip(t *testing.T) { From 8a71717eb44b4d384ff1675da8b7c76160568f57 Mon Sep 17 00:00:00 2001 From: wk989898 Date: Mon, 23 Nov 2026 09:07:40 +0000 Subject: [PATCH 2/7] update Signed-off-by: wk989898 --- coordinator/node_load.go | 59 +- coordinator/node_load_test.go | 108 ++- .../dispatcher/table_progress.go | 17 +- .../dispatcher/table_progress_test.go | 11 +- downstreamadapter/dispatchermanager/task.go | 2 +- heartbeatpb/heartbeat.pb.go | 767 +++++++++++++----- heartbeatpb/heartbeat.proto | 20 +- heartbeatpb/node_load.go | 20 + logservice/eventstore/event_store.go | 5 + logservice/eventstore/event_store_test.go | 45 + maintainer/maintainer_manager_node.go | 4 +- maintainer/node_liveness_test.go | 12 +- maintainer/replica/node_load.go | 40 +- maintainer/replica/node_load_test.go | 24 +- maintainer/replica/replication_span.go | 2 +- maintainer/scheduler/balance.go | 39 +- maintainer/scheduler/balance_test.go | 36 +- maintainer/scheduler/resource_load.go | 80 ++ maintainer/scheduler/resource_load_test.go | 42 + pkg/scheduler/resource/load.go | 135 +++ pkg/scheduler/resource/load_test.go | 84 ++ 21 files changed, 1251 insertions(+), 301 deletions(-) create mode 100644 heartbeatpb/node_load.go create mode 100644 maintainer/scheduler/resource_load.go create mode 100644 maintainer/scheduler/resource_load_test.go create mode 100644 pkg/scheduler/resource/load.go create mode 100644 pkg/scheduler/resource/load_test.go diff --git a/coordinator/node_load.go b/coordinator/node_load.go index 0e545e7335..86093c9e29 100644 --- a/coordinator/node_load.go +++ b/coordinator/node_load.go @@ -14,18 +14,20 @@ package coordinator import ( + "math" "slices" "time" "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/pkg/scheduler/resource" ) const nodeLoadStaleThreshold = 5 * time.Second type nodeLoadState struct { supported bool - bytes uint64 - rate float64 + bytes map[resource.Type]uint64 + rates resource.Load available bool updatedAt time.Time } @@ -39,17 +41,38 @@ func (s *nodeLoadState) observe(load *heartbeatpb.NodeLoad, now time.Time) { if !s.updatedAt.IsZero() && !now.After(s.updatedAt) { return } + counters, valid := resource.Counters(load) + continuous := valid && len(counters) == len(s.bytes) + for kind, value := range counters { + previous, exists := s.bytes[kind] + if !exists || value < previous { + continuous = false + } + } elapsed := now.Sub(s.updatedAt) - if !s.updatedAt.IsZero() && elapsed < time.Second && load.FlushedEventBytes >= s.bytes { + if !s.updatedAt.IsZero() && elapsed < time.Second && continuous { // Witness acknowledgements and drain updates force extra heartbeats. // Keep one sampling window instead of replacing rates with tiny deltas. return } - s.available = !s.updatedAt.IsZero() && elapsed <= nodeLoadStaleThreshold && load.FlushedEventBytes >= s.bytes - if s.available { - s.rate = float64(load.FlushedEventBytes-s.bytes) / elapsed.Seconds() + available := !s.updatedAt.IsZero() && elapsed <= nodeLoadStaleThreshold && continuous + if available { + // Match the dispatcher reporting timescale independently for each + // resource; asynchronous flushes must not look like a new hotspot. + weight := -math.Expm1(-elapsed.Seconds() / heartbeatpb.DispatcherTrafficSampleInterval.Seconds()) + for kind, value := range counters { + rate := float64(value-s.bytes[kind]) / elapsed.Seconds() + if s.available { + s.rates[kind] += weight * (rate - s.rates[kind]) + } else { + s.rates[kind] = rate + } + } + } else { + s.rates = make(resource.Load, len(counters)) } - s.bytes = load.FlushedEventBytes + s.available = available + s.bytes = counters s.updatedAt = now } @@ -68,12 +91,32 @@ func (c *captureWriteLeaseController) nodeLoadSnapshot() ([]*heartbeatpb.NodeLoa ids := slices.Clone(c.activeNodes) slices.Sort(ids) loads := make([]*heartbeatpb.NodeLoad, 0, len(ids)) + var commonResources resource.Load for _, id := range ids { load := &c.nodes[id].load if !load.available || now.Sub(load.updatedAt) > nodeLoadStaleThreshold { return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE } - loads = append(loads, &heartbeatpb.NodeLoad{NodeId: id.String(), BytesPerSecond: load.rate}) + if commonResources == nil { + commonResources = make(resource.Load, len(load.rates)) + for kind := range load.rates { + commonResources[kind] = 0 + } + } + for kind := range commonResources { + if _, supported := load.rates[kind]; !supported { + delete(commonResources, kind) + } + } + } + // Only compare a resource when every active node reports it. Missing + // metrics during an upgrade must not make old captures appear idle. + for _, id := range ids { + rates := make(resource.Load, len(commonResources)) + for kind := range commonResources { + rates[kind] = c.nodes[id].load.rates[kind] + } + loads = append(loads, rates.ToNodeLoad(id.String())) } return loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE } diff --git a/coordinator/node_load_test.go b/coordinator/node_load_test.go index 910bc2a48b..a33c5fdd3b 100644 --- a/coordinator/node_load_test.go +++ b/coordinator/node_load_test.go @@ -19,6 +19,7 @@ import ( "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/stretchr/testify/require" ) @@ -41,7 +42,7 @@ func TestNodeLoadHeartbeatSnapshot(t *testing.T) { response := report("b", 2, 1200) require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, response.NodeLoadStatus) require.Equal(t, []*heartbeatpb.NodeLoad{ - {NodeId: "a", BytesPerSecond: 100}, {NodeId: "b", BytesPerSecond: 200}, + resource.Load{resource.Sink: 100}.ToNodeLoad("a"), resource.Load{resource.Sink: 200}.ToNodeLoad("b"), }, response.NodeLoads) // A new a sample does not turn b's unchanged cumulative counter into zero. @@ -53,7 +54,7 @@ func TestNodeLoadHeartbeatSnapshot(t *testing.T) { hb := newWriteLeaseHeartbeat(1, 3) hb.NodeLoad = &heartbeatpb.NodeLoad{FlushedEventBytes: 9999} require.Empty(t, c.handleHeartbeat("a", hb, nil)) - require.Equal(t, uint64(400), c.nodes["a"].load.bytes) + require.Equal(t, uint64(400), c.nodes["a"].load.bytes[resource.Sink]) now = now.Add(nodeLoadStaleThreshold) require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, report("a", 4, 900).NodeLoadStatus) @@ -84,12 +85,105 @@ func TestNodeLoadKeepsSamplingWindowAcrossForcedHeartbeats(t *testing.T) { state := nodeLoadState{} state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 0}, now) state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 100}, now.Add(time.Second)) - require.Equal(t, float64(100), state.rate) + require.Equal(t, float64(100), state.rates[resource.Sink]) state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 100}, now.Add(time.Second+time.Millisecond)) state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 150}, now.Add(1500*time.Millisecond)) - require.Equal(t, float64(100), state.rate) - require.Equal(t, uint64(100), state.bytes) + require.Equal(t, float64(100), state.rates[resource.Sink]) + require.Equal(t, uint64(100), state.bytes[resource.Sink]) state.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 300}, now.Add(3*time.Second)) - require.Equal(t, float64(100), state.rate) - require.Equal(t, uint64(300), state.bytes) + require.Equal(t, float64(100), state.rates[resource.Sink]) + require.Equal(t, uint64(300), state.bytes[resource.Sink]) +} + +func TestNodeLoadResourceSamplingAndMixedVersions(t *testing.T) { + now := time.Unix(100, 0) + c := newCaptureWriteLeaseController(10, "coordinator") + c.now = func() time.Time { return now } + c.updateClusterMode([]node.ID{"a", "b"}) + c.nodes["a"] = &captureLeaseNodeState{} + c.nodes["b"] = &captureLeaseNodeState{} + vector := func(sink, write, read uint64) *heartbeatpb.NodeLoad { + return &heartbeatpb.NodeLoad{Resources: []*heartbeatpb.ResourceUsage{ + {Resource: resource.Sink, TotalBytes: sink}, + {Resource: resource.EventStoreWrite, TotalBytes: write}, + {Resource: resource.EventStoreRead, TotalBytes: read}, + }} + } + c.nodes["a"].load.observe(vector(0, 0, 0), now) + c.nodes["b"].load.observe(&heartbeatpb.NodeLoad{}, now) // Old capture reports sink only. + now = now.Add(time.Second) + c.nodes["a"].load.observe(vector(100, 200, 300), now) + c.nodes["b"].load.observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 400}, now) + loads, status := c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + require.Equal(t, []*heartbeatpb.NodeLoad{ + resource.Load{resource.Sink: 100}.ToNodeLoad("a"), + resource.Load{resource.Sink: 400}.ToNodeLoad("b"), + }, loads, "missing EventStore metrics must not be interpreted as idle") + + // A capability change needs a fresh baseline, just like a process restart. + c.nodes["b"].load.observe(vector(400, 1000, 2000), now.Add(time.Millisecond)) + _, status = c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) + now = now.Add(2 * time.Second) + c.nodes["a"].load.observe(vector(300, 600, 900), now) + c.nodes["b"].load.observe(vector(1200, 1020, 2040), now) + loads, status = c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + require.Equal(t, resource.Load{resource.Sink: 100, resource.EventStoreWrite: 200, resource.EventStoreRead: 300}.ToNodeLoad("a"), loads[0]) + rates, valid := resource.Rates(loads[1]) + require.True(t, valid) + require.InDelta(t, 10, rates[resource.EventStoreWrite], .01) + require.InDelta(t, 20, rates[resource.EventStoreRead], .02) + + // Resetting only one counter invalidates the whole sample; no negative + // rate or stale pre-reset rate can escape through another resource. + now = now.Add(time.Second) + c.nodes["a"].load.observe(vector(400, 1, 1200), now) + _, status = c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) + now = now.Add(time.Second) + c.nodes["a"].load.observe(vector(500, 51, 1500), now) + loads, status = c.nodeLoadSnapshot() + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + rates, valid = resource.Rates(loads[0]) + require.True(t, valid) + require.Equal(t, resource.Load{resource.Sink: 100, resource.EventStoreWrite: 50, resource.EventStoreRead: 300}, rates) +} + +func TestNodeLoadSmoothsFlushBurstsAndLoadSteps(t *testing.T) { + now := time.Unix(100, 0) + states := [3]nodeLoadState{} + for i := range states { + states[i].observe(&heartbeatpb.NodeLoad{}, now) + states[i].observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 1000}, now.Add(time.Second)) + } + // A resolved-ts flush can deliver several seconds of work in one node's + // sample before the other nodes flush. Keep its rate comparable to the + // ten-second dispatcher sample instead of interpreting this as 3x load. + states[0].observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 4000}, now.Add(2*time.Second)) + require.Greater(t, states[0].rates[resource.Sink], float64(1000)) + require.Less(t, states[0].rates[resource.Sink]-states[1].rates[resource.Sink], float64(1000)) + + // Increase all three equally loaded nodes to 3x traffic. Even while one + // node's heartbeat arrives first, its temporary lead cannot justify moving + // a whole hot dispatcher based on the previous 1000-byte/s detail sample. + counters := [3]uint64{4000, 1000, 1000} + for second := 3; second < 25; second++ { + for i := range states { + counters[i] += 3000 + states[i].observe(&heartbeatpb.NodeLoad{FlushedEventBytes: counters[i]}, now.Add(time.Duration(second)*time.Second)) + for j := range states { + require.Less(t, states[i].rates[resource.Sink]-states[j].rates[resource.Sink], float64(1000)) + } + } + } + for i := range states { + require.Greater(t, states[i].rates[resource.Sink], float64(2700)) + } + // A counter reset invalidates the old smoother and starts a fresh baseline. + states[0].observe(&heartbeatpb.NodeLoad{}, now.Add(25*time.Second)) + require.False(t, states[0].available) + states[0].observe(&heartbeatpb.NodeLoad{FlushedEventBytes: 500}, now.Add(26*time.Second)) + require.Equal(t, float64(500), states[0].rates[resource.Sink]) } diff --git a/downstreamadapter/dispatcher/table_progress.go b/downstreamadapter/dispatcher/table_progress.go index a2d5879058..efe346e531 100644 --- a/downstreamadapter/dispatcher/table_progress.go +++ b/downstreamadapter/dispatcher/table_progress.go @@ -16,23 +16,14 @@ package dispatcher import ( "container/list" "sync" - "sync/atomic" "time" "github.com/pingcap/log" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "go.uber.org/zap" ) -var flushedEventBytes atomic.Uint64 - -// FlushedEventBytes returns the process-wide cumulative event size, in the same -// units as dispatcher EventSizePerSecond reports. Reading it never resets the -// per-dispatcher sampling window. -func FlushedEventBytes() uint64 { - return flushedEventBytes.Load() -} - // TableProgress maintains event timestamp information in the sink. // It provides the ability to: // - Query the current table checkpoint timestamp @@ -142,7 +133,7 @@ func (p *TableProgress) remove(ts Ts, size int64) { } } p.cumulateEventSize += size - flushedEventBytes.Add(uint64(size)) + resource.SinkBytes.Add(uint64(size)) } // Empty checks if the TableProgress is empty. @@ -210,8 +201,8 @@ func (p *TableProgress) GetEventSizePerSecond() float32 { p.lastQueryTime = time.Now() if eventSizePerSecond == 0 { - // The event size will only send to maintainer once per second. - // So if no data is write, we use a tiny value instead of 0 to distinguish it from the status without eventSize + // Use a tiny value for idle dispatchers to distinguish a complete traffic + // sample from a status-only heartbeat without eventSize. return 1 } diff --git a/downstreamadapter/dispatcher/table_progress_test.go b/downstreamadapter/dispatcher/table_progress_test.go index 8c208e33e9..5be959c09a 100644 --- a/downstreamadapter/dispatcher/table_progress_test.go +++ b/downstreamadapter/dispatcher/table_progress_test.go @@ -19,6 +19,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -197,21 +198,21 @@ func TestMultiSameCommitTsStartTsPair(t *testing.T) { assert.Equal(t, 0, tp.Len()) } -func TestFlushedEventBytesPreservesDispatcherSamples(t *testing.T) { - initial := FlushedEventBytes() +func TestResourceCountersPreserveDispatcherSamples(t *testing.T) { + initial := resource.SinkBytes.Load() a, b := NewTableProgress(), NewTableProgress() first := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 2, ApproximateSize: 100} second := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 3, ApproximateSize: 200} a.Add(first) b.Add(second) - require.Equal(t, initial, FlushedEventBytes()) + require.Equal(t, initial, resource.SinkBytes.Load()) first.PostFlush() second.PostFlush() - require.Equal(t, initial+300, FlushedEventBytes()) + require.Equal(t, initial+300, resource.Snapshot().FlushedEventBytes) // Node-level reads never consume the per-dispatcher traffic samples. a.lastQueryTime = time.Now().Add(-time.Second) b.lastQueryTime = a.lastQueryTime require.InDelta(t, float64(100), a.GetEventSizePerSecond(), 1) require.InDelta(t, float64(200), b.GetEventSizePerSecond(), 1) - require.Equal(t, initial+300, FlushedEventBytes()) + require.Equal(t, initial+300, resource.Snapshot().FlushedEventBytes) } diff --git a/downstreamadapter/dispatchermanager/task.go b/downstreamadapter/dispatchermanager/task.go index 32fa728f83..4a4ab352e0 100644 --- a/downstreamadapter/dispatchermanager/task.go +++ b/downstreamadapter/dispatchermanager/task.go @@ -57,7 +57,7 @@ func (t *HeartBeatTask) Execute() time.Time { return time.Time{} } executeInterval := heartbeatInterval(t.manager) - completeStatusInterval := int(time.Second * 10 / executeInterval) + completeStatusInterval := int(heartbeatpb.DispatcherTrafficSampleInterval / executeInterval) t.statusTick++ needCompleteStatus := t.statusTick%completeStatusInterval == 0 message := t.manager.aggregateDispatcherHeartbeats(needCompleteStatus) diff --git a/heartbeatpb/heartbeat.pb.go b/heartbeatpb/heartbeat.pb.go index d87aa7a185..3f102d7c15 100644 --- a/heartbeatpb/heartbeat.pb.go +++ b/heartbeatpb/heartbeat.pb.go @@ -314,6 +314,37 @@ func (ChecksumState) EnumDescriptor() ([]byte, []int) { return fileDescriptor_6d584080fdadb670, []int{8} } +type ResourceType int32 + +const ( + ResourceType_RESOURCE_UNKNOWN ResourceType = 0 + ResourceType_RESOURCE_SINK ResourceType = 1 + ResourceType_RESOURCE_EVENT_STORE_WRITE ResourceType = 2 + ResourceType_RESOURCE_EVENT_STORE_READ ResourceType = 3 +) + +var ResourceType_name = map[int32]string{ + 0: "RESOURCE_UNKNOWN", + 1: "RESOURCE_SINK", + 2: "RESOURCE_EVENT_STORE_WRITE", + 3: "RESOURCE_EVENT_STORE_READ", +} + +var ResourceType_value = map[string]int32{ + "RESOURCE_UNKNOWN": 0, + "RESOURCE_SINK": 1, + "RESOURCE_EVENT_STORE_WRITE": 2, + "RESOURCE_EVENT_STORE_READ": 3, +} + +func (x ResourceType) String() string { + return proto.EnumName(ResourceType_name, int32(x)) +} + +func (ResourceType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6d584080fdadb670, []int{9} +} + type NodeLoadStatus int32 const ( @@ -339,7 +370,7 @@ func (x NodeLoadStatus) String() string { } func (NodeLoadStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6d584080fdadb670, []int{9} + return fileDescriptor_6d584080fdadb670, []int{10} } type TableSpan struct { @@ -4260,19 +4291,82 @@ func (m *DispatcherSetChecksumUpdateRequest) GetChecksum() *DispatcherSetChecksu return nil } -// Requests report a process-wide cumulative counter. Coordinator responses -// identify each node and report its derived rate, without dispatcher details. +// Each resource is sampled independently. Requests carry cumulative byte +// counters; coordinator responses carry smoothed bytes per second. +type ResourceUsage struct { + Resource ResourceType `protobuf:"varint,1,opt,name=resource,proto3,enum=heartbeatpb.ResourceType" json:"resource,omitempty"` + TotalBytes uint64 `protobuf:"varint,2,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + BytesPerSecond float64 `protobuf:"fixed64,3,opt,name=bytes_per_second,json=bytesPerSecond,proto3" json:"bytes_per_second,omitempty"` +} + +func (m *ResourceUsage) Reset() { *m = ResourceUsage{} } +func (m *ResourceUsage) String() string { return proto.CompactTextString(m) } +func (*ResourceUsage) ProtoMessage() {} +func (*ResourceUsage) Descriptor() ([]byte, []int) { + return fileDescriptor_6d584080fdadb670, []int{56} +} +func (m *ResourceUsage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceUsage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceUsage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResourceUsage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceUsage.Merge(m, src) +} +func (m *ResourceUsage) XXX_Size() int { + return m.Size() +} +func (m *ResourceUsage) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceUsage.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceUsage proto.InternalMessageInfo + +func (m *ResourceUsage) GetResource() ResourceType { + if m != nil { + return m.Resource + } + return ResourceType_RESOURCE_UNKNOWN +} + +func (m *ResourceUsage) GetTotalBytes() uint64 { + if m != nil { + return m.TotalBytes + } + return 0 +} + +func (m *ResourceUsage) GetBytesPerSecond() float64 { + if m != nil { + return m.BytesPerSecond + } + return 0 +} + +// Node totals never include dispatcher placement. Keep the scalar sink fields +// for captures that do not support the resource vector during rolling upgrades. type NodeLoad struct { - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - FlushedEventBytes uint64 `protobuf:"varint,2,opt,name=flushed_event_bytes,json=flushedEventBytes,proto3" json:"flushed_event_bytes,omitempty"` - BytesPerSecond float64 `protobuf:"fixed64,3,opt,name=bytes_per_second,json=bytesPerSecond,proto3" json:"bytes_per_second,omitempty"` + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + FlushedEventBytes uint64 `protobuf:"varint,2,opt,name=flushed_event_bytes,json=flushedEventBytes,proto3" json:"flushed_event_bytes,omitempty"` + BytesPerSecond float64 `protobuf:"fixed64,3,opt,name=bytes_per_second,json=bytesPerSecond,proto3" json:"bytes_per_second,omitempty"` + Resources []*ResourceUsage `protobuf:"bytes,4,rep,name=resources,proto3" json:"resources,omitempty"` } func (m *NodeLoad) Reset() { *m = NodeLoad{} } func (m *NodeLoad) String() string { return proto.CompactTextString(m) } func (*NodeLoad) ProtoMessage() {} func (*NodeLoad) Descriptor() ([]byte, []int) { - return fileDescriptor_6d584080fdadb670, []int{56} + return fileDescriptor_6d584080fdadb670, []int{57} } func (m *NodeLoad) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4322,6 +4416,13 @@ func (m *NodeLoad) GetBytesPerSecond() float64 { return 0 } +func (m *NodeLoad) GetResources() []*ResourceUsage { + if m != nil { + return m.Resources + } + return nil +} + func init() { proto.RegisterEnum("heartbeatpb.Action", Action_name, Action_value) proto.RegisterEnum("heartbeatpb.ScheduleAction", ScheduleAction_name, ScheduleAction_value) @@ -4332,6 +4433,7 @@ func init() { proto.RegisterEnum("heartbeatpb.RouteTableAdmissionAction", RouteTableAdmissionAction_name, RouteTableAdmissionAction_value) proto.RegisterEnum("heartbeatpb.ComponentState", ComponentState_name, ComponentState_value) proto.RegisterEnum("heartbeatpb.ChecksumState", ChecksumState_name, ChecksumState_value) + proto.RegisterEnum("heartbeatpb.ResourceType", ResourceType_name, ResourceType_value) proto.RegisterEnum("heartbeatpb.NodeLoadStatus", NodeLoadStatus_name, NodeLoadStatus_value) proto.RegisterType((*TableSpan)(nil), "heartbeatpb.TableSpan") proto.RegisterType((*HeartBeatRequest)(nil), "heartbeatpb.HeartBeatRequest") @@ -4389,228 +4491,237 @@ func init() { proto.RegisterType((*DispatcherSetChecksum)(nil), "heartbeatpb.DispatcherSetChecksum") proto.RegisterType((*DispatcherSetChecksumAckResponse)(nil), "heartbeatpb.DispatcherSetChecksumAckResponse") proto.RegisterType((*DispatcherSetChecksumUpdateRequest)(nil), "heartbeatpb.DispatcherSetChecksumUpdateRequest") + proto.RegisterType((*ResourceUsage)(nil), "heartbeatpb.ResourceUsage") proto.RegisterType((*NodeLoad)(nil), "heartbeatpb.NodeLoad") } func init() { proto.RegisterFile("heartbeatpb/heartbeat.proto", fileDescriptor_6d584080fdadb670) } var fileDescriptor_6d584080fdadb670 = []byte{ - // 3437 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x3a, 0xcd, 0x8f, 0x1c, 0x47, - 0xf5, 0xee, 0x9e, 0xef, 0xb7, 0xbb, 0xb3, 0xbd, 0xb5, 0x6b, 0x7b, 0x6c, 0xaf, 0xd7, 0xeb, 0x4e, - 0x7e, 0x3f, 0x36, 0x93, 0x60, 0x63, 0xc7, 0x46, 0x10, 0x42, 0xcc, 0x78, 0x66, 0x13, 0x8f, 0xbc, - 0x5f, 0xea, 0x19, 0xc7, 0x51, 0x38, 0x0c, 0xbd, 0xdd, 0xe5, 0xd9, 0xce, 0xce, 0x74, 0x8f, 0xbb, - 0x7b, 0xbc, 0xb6, 0x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b, 0x72, 0x3c, 0x16, 0x16, 0x2e, 0x1f, 0xa2, 0xee, - 0x88, 0x0b, 0xea, 0x90, 0x31, 0x2d, 0x11, 0x10, 0xb4, 0xa4, 0xb3, 0xd6, 0xef, 0x1b, 0xa4, 0x11, - 0x6d, 0x03, 0x72, 0xc6, 0x7c, 0x84, 0x5b, 0xe5, 0x4a, 0x52, 0xe3, 0x31, 0x32, 0x23, 0x85, 0x55, - 0xff, 0x44, 0x81, 0x05, 0x29, 0x32, 0x06, 0x03, 0xcf, 0x0d, 0xf0, 0x69, 0x43, 0xe3, 0x26, 0x20, - 0x7b, 0xc4, 0xdc, 0x58, 0xb8, 0xc7, 0x61, 0xc6, 0x10, 0x3a, 0x8e, 0x33, 0x22, 0x04, 0xd9, 0xbe, - 0x67, 0x63, 0xee, 0x23, 0xf4, 0x1f, 0xbd, 0x04, 0x5a, 0xdf, 0x74, 0xdc, 0xd0, 0x74, 0x5c, 0xec, - 0x77, 0xf0, 0xc0, 0xb3, 0xf6, 0x78, 0x60, 0x98, 0x8f, 0xf1, 0xeb, 0x04, 0xad, 0x3f, 0x85, 0xc5, - 0xba, 0x14, 0x81, 0x36, 0x71, 0x10, 0x98, 0xdd, 0x53, 0x8f, 0x71, 0x34, 0xd6, 0xa9, 0xe3, 0xb1, - 0x4e, 0xff, 0x95, 0x02, 0xf3, 0x06, 0xb6, 0xbd, 0x4d, 0x1c, 0x9a, 0x53, 0xea, 0x76, 0x52, 0xf8, - 0x1c, 0x55, 0x2b, 0x93, 0x12, 0x82, 0x4f, 0x60, 0xbb, 0x6f, 0xc3, 0x65, 0x32, 0x00, 0x23, 0xea, - 0x60, 0xc7, 0xf7, 0xba, 0x3e, 0x0e, 0x82, 0xcf, 0x67, 0x38, 0xfa, 0xcf, 0x14, 0x58, 0x4e, 0x2a, - 0xf0, 0xa6, 0xe7, 0x1f, 0x98, 0xbe, 0xfd, 0x39, 0x99, 0x33, 0xcd, 0x54, 0x99, 0x74, 0x53, 0xfd, - 0x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, 0xdd, 0xcb, 0x54, 0x46, 0x9b, 0x89, - 0x58, 0x27, 0x12, 0xa4, 0x66, 0x3b, 0xdd, 0x69, 0x72, 0xe9, 0x4e, 0x63, 0xc2, 0x6a, 0x52, 0x21, - 0x1f, 0xdb, 0xde, 0x88, 0x3e, 0xf9, 0x49, 0xfa, 0x2c, 0xcb, 0xfa, 0x90, 0x1a, 0x55, 0x42, 0x9d, - 0x91, 0x09, 0x2d, 0x1c, 0x6b, 0x42, 0x8b, 0xe9, 0x13, 0xfa, 0xfb, 0x0c, 0x5c, 0x4a, 0x9d, 0xd0, - 0xe9, 0x54, 0x6b, 0x6f, 0x43, 0x8e, 0xd4, 0x9f, 0x44, 0x75, 0x20, 0x59, 0x46, 0x8e, 0x7a, 0x8b, - 0xab, 0x55, 0x8c, 0x5a, 0x9c, 0xcc, 0x32, 0xc7, 0xb9, 0x27, 0x3a, 0xde, 0x59, 0xef, 0x15, 0x40, - 0x74, 0x22, 0x92, 0x94, 0xcc, 0xcb, 0x35, 0xd2, 0x22, 0x97, 0x71, 0x51, 0x03, 0x4a, 0xa2, 0xe2, - 0x22, 0xf2, 0x87, 0xff, 0x4f, 0x2d, 0xf0, 0x8c, 0x95, 0x55, 0x8c, 0x98, 0x31, 0x75, 0x1a, 0x0a, - 0xa9, 0xd3, 0x80, 0x36, 0x60, 0x9e, 0xd6, 0x35, 0x3a, 0x71, 0xb7, 0x45, 0xda, 0xed, 0x0b, 0xc9, - 0x9d, 0x25, 0xb5, 0x94, 0x63, 0x94, 0x29, 0xaf, 0xa8, 0x18, 0x05, 0xfa, 0x9f, 0x54, 0x58, 0x89, - 0x27, 0x75, 0xc7, 0x0b, 0xc2, 0x69, 0xaf, 0xd4, 0x63, 0x2d, 0x3b, 0xf5, 0x94, 0xcb, 0xee, 0x06, - 0x14, 0x58, 0x2d, 0x91, 0xac, 0x7a, 0x62, 0x8c, 0xf3, 0x63, 0x73, 0xd0, 0x37, 0x9b, 0xee, 0x23, - 0xcf, 0x10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c, 0xa5, 0x90, 0xa3, 0x36, 0x19, 0x86, 0x62, 0x94, 0x29, 0x3e, 0x8a, 0xd8, 0xd5, 0xcb, - 0x22, 0x77, 0x43, 0x25, 0xc8, 0xd1, 0x4b, 0x26, 0xed, 0x0c, 0x2a, 0x42, 0x76, 0xc7, 0x0c, 0x02, - 0x4d, 0xa9, 0xae, 0x41, 0x59, 0x94, 0x7a, 0x38, 0x19, 0x40, 0xbe, 0xee, 0x63, 0x93, 0xd2, 0x01, - 0xe4, 0x59, 0x4d, 0x57, 0x53, 0xaa, 0x9b, 0x30, 0x2b, 0x3f, 0xd9, 0x21, 0xe2, 0xb6, 0x3b, 0x35, - 0xdb, 0xd6, 0xce, 0xa0, 0x59, 0x28, 0x6e, 0x77, 0x04, 0x21, 0x61, 0xda, 0xee, 0x90, 0xf7, 0x14, - 0x9a, 0x8a, 0x66, 0xa0, 0xb0, 0xdd, 0xa1, 0xc9, 0xb0, 0x96, 0x61, 0x00, 0xad, 0xf0, 0x68, 0xd9, - 0xea, 0x6d, 0x98, 0x95, 0xaf, 0x68, 0x88, 0xb8, 0xda, 0x46, 0xf3, 0xed, 0x75, 0x26, 0xae, 0x61, - 0xd4, 0x9a, 0x5b, 0xcd, 0xad, 0xb7, 0x34, 0x85, 0x40, 0xad, 0xf6, 0xf6, 0xce, 0x0e, 0x81, 0xd4, - 0xea, 0x6b, 0x00, 0x71, 0x2e, 0x41, 0xc6, 0xb1, 0xb5, 0xbd, 0x45, 0x78, 0x66, 0xa0, 0xf0, 0xb0, - 0xd6, 0x6c, 0x33, 0x16, 0x02, 0x18, 0x0c, 0x50, 0x09, 0x4d, 0x83, 0xd0, 0x64, 0xaa, 0xaf, 0x8c, - 0x9c, 0x30, 0x50, 0x01, 0x32, 0xb5, 0x5e, 0x4f, 0x3b, 0x83, 0xf2, 0xa0, 0x36, 0xee, 0x32, 0xd5, - 0xb7, 0x3c, 0xbf, 0x6f, 0xf6, 0x34, 0xb5, 0xfa, 0x16, 0x5c, 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xda, - 0xdd, 0x8d, 0x75, 0x4d, 0xbd, 0xfb, 0xc6, 0x6f, 0x3f, 0x5d, 0x51, 0x3e, 0xfa, 0x74, 0x45, 0xf9, - 0xe4, 0xd3, 0x15, 0xe5, 0x07, 0x9f, 0xad, 0x9c, 0xf9, 0xe8, 0xb3, 0x95, 0x33, 0x1f, 0x7f, 0xb6, - 0x72, 0xe6, 0xdd, 0x17, 0xbb, 0x4e, 0xb8, 0x37, 0xdc, 0xbd, 0x66, 0x79, 0xfd, 0xeb, 0x03, 0xc7, - 0xed, 0x5a, 0xe6, 0xe0, 0x7a, 0xe8, 0x58, 0xb6, 0x75, 0x5d, 0x5a, 0x6a, 0xbb, 0x79, 0x7a, 0x1f, - 0xf3, 0xea, 0xbf, 0x07, 0x00, 0xe8, 0xb5, 0x08, 0xf1, 0x37, 0x31, 0x00, 0x00, + // 3559 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x3a, 0x4b, 0x6c, 0x24, 0x49, + 0x56, 0x9d, 0x59, 0xff, 0x67, 0x57, 0x39, 0x1d, 0x76, 0x77, 0x57, 0xbb, 0xdd, 0x6e, 0x4f, 0xee, + 0x02, 0xde, 0xda, 0xa1, 0x9b, 0xe9, 0x99, 0x46, 0xcb, 0xb2, 0xcc, 0x50, 0x5d, 0x55, 0x33, 0x5d, + 0xb2, 0x5d, 0x65, 0x65, 0x55, 0x4f, 0xaf, 0x96, 0x43, 0x92, 0xce, 0x8c, 0x2e, 0xe7, 0xba, 0x2a, + 0xb3, 0x26, 0x33, 0xab, 0xdd, 0xdd, 0x12, 0xa0, 0x15, 0xe2, 0xc6, 0x01, 0x24, 0x0e, 0x1c, 0xd8, + 0x0b, 0x27, 0x4e, 0x88, 0x1b, 0x27, 0x04, 0x07, 0x0e, 0x9c, 0xd0, 0x8a, 0x03, 0x5a, 0x2e, 0xb0, + 0x9a, 0x39, 0x72, 0x01, 0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c, 0x88, 0xf8, 0xbb, 0x46, 0x3b, 0xda, 0x1c, 0x7e, 0x18, + 0xa2, 0x21, 0xac, 0x0b, 0x3d, 0xd8, 0xc2, 0x37, 0xe9, 0x2c, 0x57, 0x9e, 0xfc, 0xc2, 0xc5, 0xab, + 0x25, 0x76, 0xe5, 0x58, 0x5f, 0x31, 0x04, 0x7d, 0x04, 0x10, 0xaf, 0x17, 0x92, 0x5e, 0xe6, 0xce, + 0x5f, 0x30, 0x15, 0xb1, 0x60, 0x42, 0xd4, 0x01, 0x2d, 0xa6, 0x32, 0xd9, 0x56, 0x5e, 0x2f, 0x65, + 0xec, 0x38, 0x82, 0x96, 0xef, 0xfa, 0x35, 0x2f, 0xd5, 0xd6, 0x7f, 0x08, 0x77, 0x06, 0x38, 0x4a, + 0xc5, 0x50, 0x9e, 0x71, 0x7d, 0x00, 0x45, 0xa6, 0xcc, 0xe5, 0x51, 0x97, 0x23, 0x2e, 0x89, 0xb9, + 0xfa, 0x04, 0xee, 0x2e, 0x8c, 0xc5, 0x7d, 0xe0, 0x43, 0x28, 0x59, 0xd3, 0xe9, 0xd8, 0xc5, 0xce, + 0xf2, 0xd1, 0x04, 0xe6, 0xb2, 0xe1, 0x7e, 0x08, 0x0f, 0x07, 0x72, 0x66, 0x21, 0x85, 0x5e, 0x31, + 0xc7, 0x9b, 0xca, 0x73, 0xf4, 0x37, 0x70, 0xbf, 0x95, 0x38, 0xea, 0x33, 0xb1, 0xc9, 0x8a, 0x71, + 0xea, 0x50, 0x4a, 0xbb, 0xb5, 0x68, 0x2e, 0x8d, 0xe3, 0xea, 0x92, 0x38, 0xae, 0xff, 0x93, 0x0a, + 0xdb, 0xd9, 0x43, 0x73, 0xd5, 0xfe, 0xef, 0x13, 0x43, 0x12, 0x57, 0xe2, 0xad, 0x3f, 0x4b, 0xac, + 0x4d, 0xb1, 0xcd, 0xa7, 0x76, 0x96, 0xff, 0x33, 0x5b, 0xeb, 0x32, 0xdd, 0x16, 0x96, 0xe9,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 0x1e, 0x9e, 0xab, 0xe0, + 0x9b, 0x59, 0x39, 0x5f, 0x8b, 0x86, 0xaf, 0xb4, 0xce, 0xae, 0x74, 0x2d, 0x02, 0x89, 0x96, 0x53, + 0x77, 0x71, 0xca, 0xdc, 0x5d, 0xdc, 0x8e, 0xc0, 0xec, 0x59, 0x13, 0x51, 0xfa, 0x91, 0x20, 0xe8, + 0x11, 0x14, 0x69, 0x74, 0x10, 0x2e, 0x90, 0x51, 0xe6, 0xa6, 0x96, 0xe4, 0x58, 0x7a, 0x0b, 0x2a, + 0x31, 0xf0, 0x82, 0x87, 0x00, 0xdb, 0x1c, 0x4d, 0x1a, 0x35, 0x01, 0xe8, 0x7f, 0xa5, 0x02, 0x5a, + 0x0c, 0x4e, 0x64, 0x9f, 0x3e, 0xc7, 0x8e, 0x29, 0x9d, 0xab, 0xfc, 0xa1, 0x81, 0x98, 0xb2, 0x3a, + 0x37, 0x65, 0x51, 0xb7, 0xcf, 0x5d, 0xa2, 0x6e, 0xff, 0x29, 0x68, 0xb6, 0x28, 0x70, 0x89, 0x33, + 0x49, 0x7e, 0x79, 0x15, 0x6c, 0xcd, 0x96, 0xdb, 0xb3, 0x70, 0x31, 0x46, 0x16, 0x32, 0x62, 0xe4, + 0x87, 0xb0, 0x72, 0x4c, 0xae, 0xef, 0x78, 0x1d, 0x8e, 0xed, 0x52, 0x28, 0xbd, 0x76, 0x28, 0x7b, + 0x38, 0x16, 0xb7, 0x7c, 0x38, 0xae, 0xbd, 0x96, 0x92, 0xda, 0xab, 0xfe, 0x27, 0x0a, 0xdc, 0x49, + 0x96, 0x47, 0x6b, 0xec, 0xc7, 0x85, 0x96, 0xeb, 0xae, 0x0a, 0x29, 0xcb, 0x51, 0xd3, 0x59, 0xce, + 0x15, 0x6e, 0x53, 0x7e, 0xac, 0xc0, 0xdd, 0x05, 0xf1, 0x6e, 0x66, 0xd5, 0x92, 0x7b, 0x96, 0x99, + 0x6d, 0x93, 0xca, 0x1a, 0x97, 0x8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+ 0xf6, 0x7b, 0xfd, 0x97, 0x3d, 0xed, 0x16, 0xe1, 0x18, 0x43, 0x07, 0xdd, 0xde, 0xbe, 0xa6, 0xa0, + 0x1d, 0xd8, 0x8a, 0x41, 0x9d, 0xcf, 0x3b, 0xbd, 0xa1, 0x39, 0x18, 0xf6, 0x8d, 0x8e, 0x49, 0x8c, + 0xd2, 0xd1, 0x54, 0xf4, 0x00, 0xee, 0x65, 0xf6, 0x1b, 0x9d, 0x66, 0x5b, 0xcb, 0x35, 0xfa, 0x50, + 0x4b, 0xdf, 0xa8, 0x92, 0x91, 0x0f, 0xfa, 0xcd, 0xb6, 0xf9, 0xa2, 0x37, 0x78, 0x71, 0x74, 0xd4, + 0x37, 0x86, 0x54, 0xf0, 0x0d, 0x58, 0xa3, 0xd0, 0x6e, 0xaf, 0xd5, 0x3f, 0x3c, 0x3a, 0xe8, 0x0c, + 0xb9, 0x05, 0x28, 0xb0, 0xf9, 0x79, 0xb3, 0x7b, 0xd0, 0x7c, 0x76, 0xd0, 0xd1, 0xd4, 0x67, 0x1f, + 0xff, 0xdd, 0x97, 0x3b, 0xca, 0x4f, 0xbe, 0xdc, 0x51, 0x7e, 0xf6, 0xe5, 0x8e, 0xf2, 0x07, 0x5f, + 0xed, 0xdc, 0xfa, 0xc9, 0x57, 0x3b, 0xb7, 0x7e, 0xfa, 0xd5, 0xce, 0xad, 0x1f, 0x7c, 0x73, 0xe4, + 0x46, 0x27, 0xb3, 0xe3, 0x47, 0xb6, 0x3f, 0x79, 0x3c, 0x75, 0xbd, 0x91, 0x6d, 0x4d, 0x1f, 0x47, + 0xae, 0xed, 0xd8, 0x8f, 0xa5, 0xc5, 0x75, 0x5c, 0xa4, 0xd7, 0x5a, 0x1f, 0xfe, 0xcf, 0x00, 0x25, + 0x93, 0xb9, 0xc9, 0x7e, 0x32, 0x00, 0x00, } func (m *TableSpan) Marshal() (dAtA []byte, err error) { @@ -7715,6 +7826,45 @@ func (m *DispatcherSetChecksumUpdateRequest) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } +func (m *ResourceUsage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceUsage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceUsage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BytesPerSecond != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.BytesPerSecond)))) + i-- + dAtA[i] = 0x19 + } + if m.TotalBytes != 0 { + i = encodeVarintHeartbeat(dAtA, i, uint64(m.TotalBytes)) + i-- + dAtA[i] = 0x10 + } + if m.Resource != 0 { + i = encodeVarintHeartbeat(dAtA, i, uint64(m.Resource)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *NodeLoad) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -7735,6 +7885,20 @@ func (m *NodeLoad) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Resources) > 0 { + for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Resources[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHeartbeat(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } if m.BytesPerSecond != 0 { i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.BytesPerSecond)))) @@ -9092,6 +9256,24 @@ func (m *DispatcherSetChecksumUpdateRequest) Size() (n int) { return n } +func (m *ResourceUsage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Resource != 0 { + n += 1 + sovHeartbeat(uint64(m.Resource)) + } + if m.TotalBytes != 0 { + n += 1 + sovHeartbeat(uint64(m.TotalBytes)) + } + if m.BytesPerSecond != 0 { + n += 9 + } + return n +} + func (m *NodeLoad) Size() (n int) { if m == nil { return 0 @@ -9108,6 +9290,12 @@ func (m *NodeLoad) Size() (n int) { if m.BytesPerSecond != 0 { n += 9 } + if len(m.Resources) > 0 { + for _, e := range m.Resources { + l = e.Size() + n += 1 + l + sovHeartbeat(uint64(l)) + } + } return n } @@ -17814,6 +18002,105 @@ func (m *DispatcherSetChecksumUpdateRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *ResourceUsage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceUsage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceUsage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) + } + m.Resource = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Resource |= ResourceType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBytes", wireType) + } + m.TotalBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field BytesPerSecond", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.BytesPerSecond = float64(math.Float64frombits(v)) + default: + iNdEx = preIndex + skippy, err := skipHeartbeat(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHeartbeat + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NodeLoad) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -17905,6 +18192,40 @@ func (m *NodeLoad) Unmarshal(dAtA []byte) error { v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 m.BytesPerSecond = float64(math.Float64frombits(v)) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeartbeat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHeartbeat + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHeartbeat + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Resources = append(m.Resources, &ResourceUsage{}) + if err := m.Resources[len(m.Resources)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipHeartbeat(dAtA[iNdEx:]) diff --git a/heartbeatpb/heartbeat.proto b/heartbeatpb/heartbeat.proto index 9259b5a3de..14c6c85894 100644 --- a/heartbeatpb/heartbeat.proto +++ b/heartbeatpb/heartbeat.proto @@ -553,12 +553,28 @@ message DispatcherSetChecksumUpdateRequest { DispatcherSetChecksum checksum = 5; } -// Requests report a process-wide cumulative counter. Coordinator responses -// identify each node and report its derived rate, without dispatcher details. +enum ResourceType { + RESOURCE_UNKNOWN = 0; + RESOURCE_SINK = 1; + RESOURCE_EVENT_STORE_WRITE = 2; + RESOURCE_EVENT_STORE_READ = 3; +} + +// Each resource is sampled independently. Requests carry cumulative byte +// counters; coordinator responses carry smoothed bytes per second. +message ResourceUsage { + ResourceType resource = 1; + uint64 total_bytes = 2; + double bytes_per_second = 3; +} + +// Node totals never include dispatcher placement. Keep the scalar sink fields +// for captures that do not support the resource vector during rolling upgrades. message NodeLoad { string node_id = 1; uint64 flushed_event_bytes = 2; double bytes_per_second = 3; + repeated ResourceUsage resources = 4; } enum NodeLoadStatus { diff --git a/heartbeatpb/node_load.go b/heartbeatpb/node_load.go new file mode 100644 index 0000000000..93cc0613d4 --- /dev/null +++ b/heartbeatpb/node_load.go @@ -0,0 +1,20 @@ +// Copyright 2026 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 heartbeatpb + +import "time" + +// DispatcherTrafficSampleInterval is the complete dispatcher heartbeat period. +// Node load smoothing and sample expiry must account for this reporting window. +const DispatcherTrafficSampleInterval = 10 * time.Second diff --git a/logservice/eventstore/event_store.go b/logservice/eventstore/event_store.go index 79cbb508da..f46f4c32de 100644 --- a/logservice/eventstore/event_store.go +++ b/logservice/eventstore/event_store.go @@ -40,6 +40,7 @@ import ( "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/node" "github.com/pingcap/ticdc/pkg/pdutil" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/ticdc/utils/chann" "github.com/pingcap/ticdc/utils/heap" @@ -1525,6 +1526,9 @@ func (e *eventStore) writeEvents( eventStoreWritePrepareDurationHistogram.Observe(time.Since(prepareStart).Seconds()) start := time.Now() err := batch.Commit(pebble.NoSync) + if err == nil { + resource.EventStoreWriteBytes.Add(uint64(batch.Len())) + } eventStoreWriteDurationHistogram.Observe(time.Since(start).Seconds()) return err } @@ -1620,6 +1624,7 @@ func (iter *eventStoreIter) NextWithScanPosition() (*common.RawKVEntry, ScanPosi } key := iter.innerIter.Key() value := iter.innerIter.Value() + resource.EventStoreReadBytes.Add(uint64(len(key) + len(value))) if KeyUsesEncryptionLayer(key) { if iter.encryptionManager == nil { diff --git a/logservice/eventstore/event_store_test.go b/logservice/eventstore/event_store_test.go index 890c2a6f62..11abe73d1d 100644 --- a/logservice/eventstore/event_store_test.go +++ b/logservice/eventstore/event_store_test.go @@ -35,6 +35,7 @@ import ( cerrors "github.com/pingcap/ticdc/pkg/errors" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/pdutil" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/require" @@ -1658,6 +1659,8 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { }} beforeMetric := testutil.ToFloat64(eventStoreCompressedRowsCount) + beforeWrite := resource.EventStoreWriteBytes.Load() + beforeWriteMetric := testutil.ToFloat64(eventStoreWriteBytes) encoder, err := zstd.NewWriter(nil) require.NoError(t, err) @@ -1668,9 +1671,15 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { require.NoError(t, err) afterMetric := testutil.ToFloat64(eventStoreCompressedRowsCount) require.InDelta(t, float64(len(expectedValues)), afterMetric-beforeMetric, 1e-9) + require.Equal(t, uint64(testutil.ToFloat64(eventStoreWriteBytes)-beforeWriteMetric), resource.EventStoreWriteBytes.Load()-beforeWrite) innerIter, err := store.dbs[0].NewIter(&pebble.IterOptions{}) require.NoError(t, err) + var encodedBytes uint64 + for innerIter.First(); innerIter.Valid(); innerIter.Next() { + encodedBytes += uint64(len(innerIter.Key()) + len(innerIter.Value())) + } + beforeRead := resource.EventStoreReadBytes.Load() decoder := store.decoderPool.Get().(*zstd.Decoder) iter := &eventStoreIter{ tableSpan: &heartbeatpb.TableSpan{ @@ -1708,9 +1717,45 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { } } require.Len(t, records, len(expectedValues)) + require.Equal(t, encodedBytes, resource.EventStoreReadBytes.Load()-beforeRead, "read load must use compressed stored bytes") rowCount, err := iter.Close() require.NoError(t, err) require.Equal(t, int64(len(expectedValues)), rowCount) + + // A shared subscription can scan rows outside the dispatcher's span. + // That work still contributes to EventStore read load. + iter.innerIter, err = store.dbs[0].NewIter(&pebble.IterOptions{}) + require.NoError(t, err) + iter.decoder = store.decoderPool.Get().(*zstd.Decoder) + iter.needCheckSpan = true + iter.tableSpan.StartKey, iter.tableSpan.EndKey = []byte{0xFF}, []byte{0xFF, 0xFF} + require.True(t, iter.innerIter.First()) + beforeRead = resource.EventStoreReadBytes.Load() + entry, _ := iter.Next() + require.Nil(t, entry) + require.Equal(t, encodedBytes, resource.EventStoreReadBytes.Load()-beforeRead) + _, err = iter.Close() + require.NoError(t, err) +} + +func TestEventStoreFailedWriteDoesNotRecordLoad(t *testing.T) { + dir := t.TempDir() + db, err := pebble.Open(dir, &pebble.Options{}) + require.NoError(t, err) + require.NoError(t, db.Close()) + db, err = pebble.Open(dir, &pebble.Options{ReadOnly: true}) + require.NoError(t, err) + defer db.Close() + encoder, err := zstd.NewWriter(nil) + require.NoError(t, err) + defer encoder.Close() + before := resource.EventStoreWriteBytes.Load() + store := &eventStore{} + err = store.writeEvents(db, []eventWithCallback{{subID: 1, tableID: 1, kvs: []common.RawKVEntry{ + {OpType: common.OpTypePut, StartTs: 1, CRTs: 2, Key: []byte("key"), Value: []byte("value")}, + }}}, encoder, nil, nil) + require.ErrorIs(t, err, pebble.ErrReadOnly) + require.Equal(t, before, resource.EventStoreWriteBytes.Load()) } func TestEventStoreKVEntryCount(t *testing.T) { diff --git a/maintainer/maintainer_manager_node.go b/maintainer/maintainer_manager_node.go index 6536ee030c..f7844742c8 100644 --- a/maintainer/maintainer_manager_node.go +++ b/maintainer/maintainer_manager_node.go @@ -18,11 +18,11 @@ import ( "time" "github.com/pingcap/log" - "github.com/pingcap/ticdc/downstreamadapter/dispatcher" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/liveness" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/writelease" "go.uber.org/zap" ) @@ -113,7 +113,7 @@ func (m *Manager) sendNodeHeartbeat(force bool) { WriteLeaseRequestSeq: requestSeq, WriteLeaseProtocolVersion: heartbeatpb.CurrentWriteLeaseProtocolVersion, WriteLeaseWitnessAck: m.node.pendingWitnessAck, - NodeLoad: &heartbeatpb.NodeLoad{FlushedEventBytes: dispatcher.FlushedEventBytes()}, + NodeLoad: resource.Snapshot(), } target := m.newCoordinatorTopicMessage(hb) if err := m.mc.SendCommand(target); err != nil { diff --git a/maintainer/node_liveness_test.go b/maintainer/node_liveness_test.go index e79af8f5c4..a057278e0d 100644 --- a/maintainer/node_liveness_test.go +++ b/maintainer/node_liveness_test.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/ticdc/pkg/liveness" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/writelease" "github.com/stretchr/testify/require" ) @@ -323,6 +324,11 @@ func TestNodeHeartbeatResponseRenewsP2PWriteLease(t *testing.T) { require.Equal(t, heartbeatpb.CurrentWriteLeaseProtocolVersion, heartbeat.WriteLeaseProtocolVersion) require.NotZero(t, heartbeat.WriteLeaseRequestSeq) require.NotNil(t, heartbeat.NodeLoad) + counters, valid := resource.Counters(heartbeat.NodeLoad) + require.True(t, valid) + require.Contains(t, counters, resource.Sink) + require.Contains(t, counters, resource.EventStoreWrite) + require.Contains(t, counters, resource.EventStoreRead) responseMessage := messaging.NewSingleTargetMessage( m.nodeInfo.ID, @@ -342,7 +348,7 @@ func TestNodeHeartbeatResponseRenewsP2PWriteLease(t *testing.T) { require.True(t, gate.IsWritable()) rates, status := m.nodeLoads.Snapshot(map[node.ID]*node.Info{"n1": {ID: "n1"}}, time.Now()) require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) - require.Equal(t, float64(1234), rates["n1"]) + require.Equal(t, float64(1234), rates["n1"][resource.Sink]) // An old coordinator response cannot renew a new request. m.writeGate.InvalidateP2P() @@ -351,14 +357,14 @@ func TestNodeHeartbeatResponseRenewsP2PWriteLease(t *testing.T) { m.onNodeHeartbeatResponse(responseMessage) require.False(t, gate.IsWritable()) rates, _ = m.nodeLoads.Snapshot(map[node.ID]*node.Info{"n1": {ID: "n1"}}, time.Now()) - require.Equal(t, float64(1234), rates["n1"], "stale coordinator cannot replace node load") + require.Equal(t, float64(1234), rates["n1"][resource.Sink], "stale coordinator cannot replace node load") // Replaying an already applied sequence from the current coordinator is also rejected. responseMessage.Message[0].(*heartbeatpb.NodeHeartbeatResponse).CoordinatorVersion = 10 m.onNodeHeartbeatResponse(responseMessage) require.False(t, gate.IsWritable()) rates, _ = m.nodeLoads.Snapshot(map[node.ID]*node.Info{"n1": {ID: "n1"}}, time.Now()) - require.Equal(t, float64(1234), rates["n1"], "replayed response cannot replace node load") + require.Equal(t, float64(1234), rates["n1"][resource.Sink], "replayed response cannot replace node load") } func TestNodeHeartbeatResponseUpdatesClusterP2PMode(t *testing.T) { diff --git a/maintainer/replica/node_load.go b/maintainer/replica/node_load.go index 2eaa4822ed..9b33fb7e79 100644 --- a/maintainer/replica/node_load.go +++ b/maintainer/replica/node_load.go @@ -14,21 +14,25 @@ package replica import ( - "math" "sync" "time" "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" ) -const NodeLoadStaleThreshold = 5 * time.Second +const ( + NodeLoadStaleThreshold = 5 * time.Second + // Allow the next complete heartbeat to refresh an otherwise live dispatcher. + DispatcherTrafficStaleThreshold = 2 * heartbeatpb.DispatcherTrafficSampleInterval +) // NodeLoadTracker shares an immutable coordinator snapshot among all maintainers // on a capture. It contains node totals only, never dispatcher placement. type NodeLoadTracker struct { mu sync.RWMutex - rates map[node.ID]float64 + rates map[node.ID]resource.Load status heartbeatpb.NodeLoadStatus updatedAt time.Time } @@ -41,11 +45,10 @@ func (t *NodeLoadTracker) Replace(loads []*heartbeatpb.NodeLoad, status heartbea if t == nil { return } - rates := make(map[node.ID]float64, len(loads)) + rates := make(map[node.ID]resource.Load, len(loads)) if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { for _, load := range loads { - if load == nil || load.NodeId == "" || load.BytesPerSecond < 0 || - math.IsNaN(load.BytesPerSecond) || math.IsInf(load.BytesPerSecond, 0) { + if load == nil || load.NodeId == "" { status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE break } @@ -54,7 +57,12 @@ func (t *NodeLoadTracker) Replace(loads []*heartbeatpb.NodeLoad, status heartbea status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE break } - rates[id] = load.BytesPerSecond + values, valid := resource.Rates(load) + if !valid { + status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + break + } + rates[id] = values } } else if status != heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED { status = heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE @@ -66,7 +74,7 @@ func (t *NodeLoadTracker) Replace(loads []*heartbeatpb.NodeLoad, status heartbea // Snapshot returns immutable rates. Callers must copy them before projecting // local moves; those projections must not influence other maintainers. -func (t *NodeLoadTracker) Snapshot(nodes map[node.ID]*node.Info, now time.Time) (map[node.ID]float64, heartbeatpb.NodeLoadStatus) { +func (t *NodeLoadTracker) Snapshot(nodes map[node.ID]*node.Info, now time.Time) (map[node.ID]resource.Load, heartbeatpb.NodeLoadStatus) { if t == nil { return nil, heartbeatpb.NodeLoadStatus_LOAD_UNSUPPORTED } @@ -86,5 +94,21 @@ func (t *NodeLoadTracker) Snapshot(nodes map[node.ID]*node.Info, now time.Time) return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE } } + // Reject partial vectors instead of silently assigning zero to a missing + // resource. The coordinator sends the cluster-wide common resource set. + var expected resource.Load + for id := range nodes { + if expected == nil { + expected = t.rates[id] + } + if len(t.rates[id]) != len(expected) { + return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + } + for kind := range expected { + if _, ok := t.rates[id][kind]; !ok { + return nil, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE + } + } + } return t.rates, t.status } diff --git a/maintainer/replica/node_load_test.go b/maintainer/replica/node_load_test.go index 5b2d9c624d..1de494294a 100644 --- a/maintainer/replica/node_load_test.go +++ b/maintainer/replica/node_load_test.go @@ -21,6 +21,7 @@ import ( "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/stretchr/testify/require" ) @@ -34,17 +35,31 @@ func TestNodeLoadTracker(t *testing.T) { tracker.Replace(loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) rates, status := tracker.Snapshot(nodes, now) require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) - require.Equal(t, float64(100), rates["a"]) + require.Equal(t, float64(100), rates["a"][resource.Sink]) // Mutating a protobuf or replacing the tracker never mutates old snapshots. loads[0].BytesPerSecond = 200 tracker.Replace(loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) - require.Equal(t, float64(100), rates["a"]) + require.Equal(t, float64(100), rates["a"][resource.Sink]) _, status = tracker.Snapshot(nodes, now.Add(NodeLoadStaleThreshold+1)) require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) nodes["new"] = &node.Info{ID: "new"} _, status = tracker.Snapshot(nodes, now) require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) delete(nodes, "new") + // Resource vectors must be complete and must not alias incoming protobufs. + loads = []*heartbeatpb.NodeLoad{ + resource.Load{resource.Sink: 100, resource.EventStoreRead: 200}.ToNodeLoad("a"), + resource.Load{resource.Sink: 0, resource.EventStoreRead: 300}.ToNodeLoad("b"), + } + tracker.Replace(loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) + rates, status = tracker.Snapshot(nodes, now) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, status) + loads[0].Resources[1].BytesPerSecond = 999 + require.Equal(t, float64(200), rates["a"][resource.EventStoreRead]) + loads[1] = resource.Load{resource.Sink: 0}.ToNodeLoad("b") + tracker.Replace(loads, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, now) + _, status = tracker.Snapshot(nodes, now) + require.Equal(t, heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE, status) for _, invalid := range [][]*heartbeatpb.NodeLoad{ {nil}, {{NodeId: ""}}, @@ -72,7 +87,10 @@ func TestSpanTrafficSamples(t *testing.T) { r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 12}) r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 9, EventSizePerSecond: 200}) require.Equal(t, float64(100), r.TrafficRate(time.Now())) - require.Zero(t, r.TrafficRate(time.Now().Add(NodeLoadStaleThreshold+time.Second))) + // Complete dispatcher samples arrive every ten seconds, independently of + // the more frequent node heartbeat carrying the shared resource view. + require.Equal(t, float64(100), r.TrafficRate(time.Now().Add(heartbeatpb.DispatcherTrafficSampleInterval))) + require.Zero(t, r.TrafficRate(time.Now().Add(DispatcherTrafficStaleThreshold+time.Second))) r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 12, EventSizePerSecond: 1}) require.Equal(t, float64(1), r.TrafficRate(time.Now())) r.SetNodeID("another") diff --git a/maintainer/replica/replication_span.go b/maintainer/replica/replication_span.go index 0246b3d344..9eb426f134 100644 --- a/maintainer/replica/replication_span.go +++ b/maintainer/replica/replication_span.go @@ -63,7 +63,7 @@ type spanTraffic struct { func (r *SpanReplication) TrafficRate(now time.Time) float64 { r.nodeIDMutex.Lock() defer r.nodeIDMutex.Unlock() - if now.Sub(r.traffic.updatedAt) > NodeLoadStaleThreshold { + if now.Sub(r.traffic.updatedAt) > DispatcherTrafficStaleThreshold { return 0 } return r.traffic.bytesPerSecond diff --git a/maintainer/scheduler/balance.go b/maintainer/scheduler/balance.go index 9ab7d6172d..6893265453 100644 --- a/maintainer/scheduler/balance.go +++ b/maintainer/scheduler/balance.go @@ -15,7 +15,6 @@ package scheduler import ( "context" - "maps" "math/rand" "time" @@ -107,8 +106,10 @@ func (s *balanceScheduler) Execute() time.Time { if s.trafficMovePending { // Start the observation window after the operator finishes, so a slow // move cannot consume the cooldown before its new placement is sampled. + // Three report windows also let the node smoother settle before choosing + // another destination from rates that still include the old placement. s.trafficMovePending = false - s.trafficBalanceNotBefore = now.Add(max(s.checkBalanceInterval, replica.NodeLoadStaleThreshold)) + s.trafficBalanceNotBefore = now.Add(max(s.checkBalanceInterval, 3*heartbeatpb.DispatcherTrafficSampleInterval)) } // 1. check whether we have spans in defaultGroupID need to be splitted. @@ -155,14 +156,12 @@ func (s *balanceScheduler) schedulerDefaultGroup( return 0 } moveSize := pkgScheduler.CheckBalanceStatus(s.spanController.GetTaskSizePerNodeByGroup(group), nodes) - average, overloaded := float64(0), false + var loadView *resourceLoadView + overloaded := false if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + loadView = newResourceLoadView(loads, nodes) for id := range nodes { - average += loads[id] - } - average /= float64(len(nodes)) - for id := range nodes { - if loads[id] > average*1.2 { + if loadView.sinkOverloaded(id) { overloaded = true break } @@ -176,8 +175,7 @@ func (s *balanceScheduler) schedulerDefaultGroup( if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { // Project only this maintainer's accepted moves. Other maintainers keep // using the coordinator snapshot until the next node sample arrives. - loads = maps.Clone(loads) - if overloaded && s.balanceTraffic(nodes, replicas, loads, average, now) { + if overloaded && s.balanceTraffic(nodes, replicas, loadView, now) { s.trafficMovePending = true return 1 } @@ -189,34 +187,29 @@ func (s *balanceScheduler) schedulerDefaultGroup( return pkgScheduler.Balance(maxSize, s.random, nodes, replicas, func(r *replica.SpanReplication, target node.ID) bool { if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { rate := r.TrafficRate(now) - if rate == 0 || (rate > 1 && !improvesNodeLoad(loads[r.GetNodeID()], loads[target], rate)) { + if rate == 0 { return false } if rate == 1 { rate = 0 // The idle sentinel contributes no actual traffic. } + if !loadView.canMove(r.GetNodeID(), target, rate) { + return false + } if !s.doMove(r, target) { return false } - loads[r.GetNodeID()] = max(0, loads[r.GetNodeID()]-rate) - loads[target] += rate + loadView.project(r.GetNodeID(), target, rate) return true } return s.doMove(r, target) }) } -// improvesNodeLoad requires a meaningful reduction in the pair's imbalance. -// A single indivisible hot table must not bounce between otherwise idle nodes. -func improvesNodeLoad(source, target, rate float64) bool { - return rate > 0 && rate < (source-target)*0.9 -} - func (s *balanceScheduler) balanceTraffic( nodes map[node.ID]*node.Info, replicas []*replica.SpanReplication, - loads map[node.ID]float64, - average float64, + loads *resourceLoadView, now time.Time, ) bool { // Randomize both dispatcher and destination choice so independent @@ -224,7 +217,7 @@ func (s *balanceScheduler) balanceTraffic( s.random.Shuffle(len(replicas), func(i, j int) { replicas[i], replicas[j] = replicas[j], replicas[i] }) for _, r := range replicas { source := r.GetNodeID() - if _, alive := nodes[source]; !alive || !r.IsWorking() || loads[source] <= average*1.2 { + if _, alive := nodes[source]; !alive || !r.IsWorking() || !loads.sinkOverloaded(source) { continue } rate := r.TrafficRate(now) @@ -234,7 +227,7 @@ func (s *balanceScheduler) balanceTraffic( var target node.ID candidates := 0 for id := range nodes { - if id == source || loads[id] >= average || !improvesNodeLoad(loads[source], loads[id], rate) { + if id == source || !loads.sinkUnderloaded(id) || !loads.canMove(source, id, rate) { continue } candidates++ diff --git a/maintainer/scheduler/balance_test.go b/maintainer/scheduler/balance_test.go index 1de653cff5..37e49840bb 100644 --- a/maintainer/scheduler/balance_test.go +++ b/maintainer/scheduler/balance_test.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/ticdc/maintainer/replica" "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/stretchr/testify/require" ) @@ -227,7 +228,7 @@ func TestBalanceSchedulerBalancesWholeTableTraffic(t *testing.T) { before := time.Now() s.Execute() require.Zero(t, oc.OperatorSize()) - require.False(t, s.trafficBalanceNotBefore.Before(before.Add(replica.NodeLoadStaleThreshold))) + require.False(t, s.trafficBalanceNotBefore.Before(before.Add(3*heartbeatpb.DispatcherTrafficSampleInterval))) } } counts, hotCounts := map[node.ID]int{}, map[node.ID]int{} @@ -285,7 +286,7 @@ func TestBalanceSchedulerUsesNodeTotalsAcrossChangefeeds(t *testing.T) { r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: 100}) } tracker := replica.NewNodeLoadTracker() - tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 1000}, {NodeId: "busy", BytesPerSecond: 2000}, {NodeId: "idle", BytesPerSecond: 100}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 1500}, {NodeId: "busy", BytesPerSecond: 2000}, {NodeId: "idle", BytesPerSecond: 100}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) sc.SetNodeLoadTracker(tracker) s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) s.Execute() @@ -312,3 +313,34 @@ func TestBalanceSchedulerDoesNotMoveAnIndivisibleHotTable(t *testing.T) { s.Execute() require.Zero(t, oc.OperatorSize()) } + +func TestBalanceSchedulerAvoidsBusyEventStoreTargets(t *testing.T) { + for _, kind := range []resource.Type{resource.EventStoreWrite, resource.EventStoreRead, resource.Type(100)} { + t.Run(kind.String(), func(t *testing.T) { + cfID, nm, oc, sc, ds, self := newDrainSchedulerTestHarness(t) + for i, id := range []node.ID{self, "busy-store", "idle"} { + nm.GetAliveNodes()[id] = &node.Info{ID: id} + r := addReplicatingSpan(t, cfID, sc, int64(i+1), id) + rate := float32(1) + if id == self { + rate = 100 + } + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: rate}) + } + tracker := replica.NewNodeLoadTracker() + tracker.Replace([]*heartbeatpb.NodeLoad{ + resource.Load{resource.Sink: 1000, kind: 100}.ToNodeLoad(self.String()), + resource.Load{resource.Sink: 0, kind: 2000}.ToNodeLoad("busy-store"), + resource.Load{resource.Sink: 0, kind: 0}.ToNodeLoad("idle"), + }, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + sc.SetNodeLoadTracker(tracker) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) + s.Execute() + require.Equal(t, 1, oc.OperatorSize()) + op := oc.GetAllOperators()[0] + require.Equal(t, self, op.Schedule().To) + op.Check(self, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Stopped}) + require.Equal(t, node.ID("idle"), op.Schedule().To) + }) + } +} diff --git a/maintainer/scheduler/resource_load.go b/maintainer/scheduler/resource_load.go new file mode 100644 index 0000000000..f610736024 --- /dev/null +++ b/maintainer/scheduler/resource_load.go @@ -0,0 +1,80 @@ +// Copyright 2026 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, +// 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 scheduler + +import ( + "maps" + + "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" +) + +const resourceOverloadRatio = 1.2 + +// resourceLoadView owns this round's projections. Moving a dispatcher relocates +// its sink work. EventStore subscriptions can be shared or remote, so their +// traffic screens destinations without assuming any immediate relief. +type resourceLoadView struct { + loads map[node.ID]resource.Load + average resource.Load +} + +func newResourceLoadView(loads map[node.ID]resource.Load, nodes map[node.ID]*node.Info) *resourceLoadView { + v := &resourceLoadView{loads: make(map[node.ID]resource.Load, len(nodes)), average: make(resource.Load)} + for id := range nodes { + v.loads[id] = maps.Clone(loads[id]) + for kind, rate := range loads[id] { + v.average[kind] += rate / float64(len(nodes)) + } + } + return v +} + +func (v *resourceLoadView) sinkOverloaded(id node.ID) bool { + return v.loads[id][resource.Sink] > v.average[resource.Sink]*resourceOverloadRatio +} + +func (v *resourceLoadView) sinkUnderloaded(id node.ID) bool { + return v.loads[id][resource.Sink] < v.average[resource.Sink] +} + +func (v *resourceLoadView) canMove(source, target node.ID, sinkRate float64) bool { + if sinkRate > 0 && !improvesNodeLoad(v.loads[source][resource.Sink], v.loads[target][resource.Sink], sinkRate) { + return false + } + for kind, average := range v.average { + if kind == resource.Sink { + continue + } + // A sink-idle node can still be busy serving EventStore reads/writes + // for other captures. Do not choose it when this would move work toward + // a node with greater, already overloaded pressure on another resource. + if v.loads[target][kind] > average*resourceOverloadRatio && v.loads[target][kind] > v.loads[source][kind] { + return false + } + } + return true +} + +func (v *resourceLoadView) project(source, target node.ID, sinkRate float64) { + v.loads[source][resource.Sink] = max(0, v.loads[source][resource.Sink]-sinkRate) + v.loads[target][resource.Sink] += sinkRate +} + +// improvesNodeLoad requires a meaningful reduction in the pair's imbalance. +// A single indivisible hot table must not bounce between otherwise idle nodes. +func improvesNodeLoad(source, target, rate float64) bool { + return rate > 0 && rate < (source-target)*0.9 +} diff --git a/maintainer/scheduler/resource_load_test.go b/maintainer/scheduler/resource_load_test.go new file mode 100644 index 0000000000..1567684fb4 --- /dev/null +++ b/maintainer/scheduler/resource_load_test.go @@ -0,0 +1,42 @@ +// Copyright 2026 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, +// 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 scheduler + +import ( + "testing" + + "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" + "github.com/stretchr/testify/require" +) + +func TestResourceLoadMoveProjection(t *testing.T) { + loads := map[node.ID]resource.Load{ + "source": {resource.Sink: 300, resource.EventStoreWrite: 100, resource.EventStoreRead: 200}, + "target": {resource.Sink: 0, resource.EventStoreWrite: 100, resource.EventStoreRead: 200}, + } + nodes := map[node.ID]*node.Info{"source": {ID: "source"}, "target": {ID: "target"}} + v := newResourceLoadView(loads, nodes) + require.True(t, v.sinkOverloaded("source")) + require.True(t, v.canMove("source", "target", 100)) + v.project("source", "target", 100) + require.Equal(t, resource.Load{resource.Sink: 300, resource.EventStoreWrite: 100, resource.EventStoreRead: 200}, loads["source"], "projection is private to this maintainer") + require.Equal(t, resource.Load{resource.Sink: 200, resource.EventStoreWrite: 100, resource.EventStoreRead: 200}, v.loads["source"], "shared or remote EventStore work must not be subtracted") + require.False(t, v.canMove("source", "target", 100), "another hot move would not improve balance") + + // Count balancing must apply the same target guards even to idle tables. + v.loads["target"][resource.EventStoreRead] = 1000 + require.False(t, v.canMove("source", "target", 0)) +} diff --git a/pkg/scheduler/resource/load.go b/pkg/scheduler/resource/load.go new file mode 100644 index 0000000000..ea7024937a --- /dev/null +++ b/pkg/scheduler/resource/load.go @@ -0,0 +1,135 @@ +// Copyright 2026 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, +// 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 resource defines process-wide scheduling resource measurements. +package resource + +import ( + "math" + "slices" + "sync/atomic" + + "github.com/pingcap/ticdc/heartbeatpb" +) + +type Type = heartbeatpb.ResourceType + +const ( + Sink = heartbeatpb.ResourceType_RESOURCE_SINK + EventStoreWrite = heartbeatpb.ResourceType_RESOURCE_EVENT_STORE_WRITE + EventStoreRead = heartbeatpb.ResourceType_RESOURCE_EVENT_STORE_READ +) + +// Load keeps resource rates separate: byte counts from different stages are +// not interchangeable and must never be added into one raw traffic score. +type Load map[Type]float64 + +var ( + // SinkBytes counts flushed DML event sizes, matching dispatcher samples. + SinkBytes atomic.Uint64 + // EventStoreWriteBytes counts successfully committed Pebble batch bytes. + EventStoreWriteBytes atomic.Uint64 + // EventStoreReadBytes counts encoded keys and values visited by iterators, + // including rows filtered by a shared subscription's span. Cache hits count + // as reads; these counters do not represent physical disk IO or compaction. + EventStoreReadBytes atomic.Uint64 + + counters = []struct { + resource Type + total *atomic.Uint64 + }{ + {Sink, &SinkBytes}, + {EventStoreWrite, &EventStoreWriteBytes}, + {EventStoreRead, &EventStoreReadBytes}, + } +) + +// Snapshot never consumes counters or per-dispatcher sampling windows. Add a +// resource to the protocol and this list when wiring another byte counter; +// coordinator sampling and target screening operate on the vector generically. +func Snapshot() *heartbeatpb.NodeLoad { + load := &heartbeatpb.NodeLoad{Resources: make([]*heartbeatpb.ResourceUsage, 0, len(counters))} + for _, counter := range counters { + value := counter.total.Load() + load.Resources = append(load.Resources, &heartbeatpb.ResourceUsage{Resource: counter.resource, TotalBytes: value}) + if counter.resource == Sink { + load.FlushedEventBytes = value + } + } + return load +} + +// Counters accepts legacy sink-only reports. A missing resource is unsupported, +// not an observed zero. Invalid vectors cannot be used for scheduling. +func Counters(load *heartbeatpb.NodeLoad) (map[Type]uint64, bool) { + if load == nil { + return nil, false + } + if len(load.Resources) == 0 { + return map[Type]uint64{Sink: load.FlushedEventBytes}, true + } + values := make(map[Type]uint64, len(load.Resources)) + for _, usage := range load.Resources { + if usage == nil || usage.Resource <= heartbeatpb.ResourceType_RESOURCE_UNKNOWN { + return nil, false + } + if _, exists := values[usage.Resource]; exists { + return nil, false + } + values[usage.Resource] = usage.TotalBytes + } + _, hasSink := values[Sink] + return values, hasSink +} + +func Rates(load *heartbeatpb.NodeLoad) (Load, bool) { + if load == nil { + return nil, false + } + if len(load.Resources) == 0 { + if !validRate(load.BytesPerSecond) { + return nil, false + } + return Load{Sink: load.BytesPerSecond}, true + } + rates := make(Load, len(load.Resources)) + for _, usage := range load.Resources { + if usage == nil || usage.Resource <= heartbeatpb.ResourceType_RESOURCE_UNKNOWN || !validRate(usage.BytesPerSecond) { + return nil, false + } + if _, exists := rates[usage.Resource]; exists { + return nil, false + } + rates[usage.Resource] = usage.BytesPerSecond + } + _, hasSink := rates[Sink] + return rates, hasSink +} + +func validRate(rate float64) bool { + return rate >= 0 && !math.IsNaN(rate) && !math.IsInf(rate, 0) +} + +func (l Load) ToNodeLoad(id string) *heartbeatpb.NodeLoad { + kinds := make([]Type, 0, len(l)) + for kind := range l { + kinds = append(kinds, kind) + } + slices.Sort(kinds) + load := &heartbeatpb.NodeLoad{NodeId: id, BytesPerSecond: l[Sink]} + for _, kind := range kinds { + load.Resources = append(load.Resources, &heartbeatpb.ResourceUsage{Resource: kind, BytesPerSecond: l[kind]}) + } + return load +} diff --git a/pkg/scheduler/resource/load_test.go b/pkg/scheduler/resource/load_test.go new file mode 100644 index 0000000000..4546ca9e20 --- /dev/null +++ b/pkg/scheduler/resource/load_test.go @@ -0,0 +1,84 @@ +// Copyright 2026 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, +// 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 resource + +import ( + "math" + "testing" + + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/stretchr/testify/require" +) + +func TestResourceLoadProtocol(t *testing.T) { + // Unknown positive resource types remain separate and round-trip so that + // the view and screening policy do not need a new branch for each metric. + expected := Load{Sink: 100, EventStoreWrite: 300, EventStoreRead: 500, Type(100): 700} + encoded, err := expected.ToNodeLoad("node").Marshal() + require.NoError(t, err) + decoded := &heartbeatpb.NodeLoad{} + require.NoError(t, decoded.Unmarshal(encoded)) + rates, valid := Rates(decoded) + require.True(t, valid) + require.Equal(t, expected, rates) + require.Equal(t, float64(100), decoded.BytesPerSecond, "legacy readers still see sink rate") + + before, valid := Counters(Snapshot()) + require.True(t, valid) + SinkBytes.Add(10) + EventStoreWriteBytes.Add(20) + EventStoreReadBytes.Add(30) + snapshot := Snapshot() + after, valid := Counters(snapshot) + require.True(t, valid) + require.Equal(t, before[Sink]+10, after[Sink]) + require.Equal(t, before[EventStoreWrite]+20, after[EventStoreWrite]) + require.Equal(t, before[EventStoreRead]+30, after[EventStoreRead]) + require.Equal(t, after[Sink], snapshot.FlushedEventBytes) + again, valid := Counters(Snapshot()) + require.True(t, valid) + require.Equal(t, after, again, "sampling must not reset process counters") + + rates, valid = Rates(&heartbeatpb.NodeLoad{BytesPerSecond: 42}) + require.True(t, valid) + require.Equal(t, Load{Sink: 42}, rates) + counters, valid := Counters(&heartbeatpb.NodeLoad{FlushedEventBytes: 99}) + require.True(t, valid) + require.Equal(t, map[Type]uint64{Sink: 99}, counters) +} + +func TestResourceLoadRejectsInvalidVectors(t *testing.T) { + for _, load := range []*heartbeatpb.NodeLoad{ + nil, + {Resources: []*heartbeatpb.ResourceUsage{nil}}, + {Resources: []*heartbeatpb.ResourceUsage{{Resource: heartbeatpb.ResourceType_RESOURCE_UNKNOWN}}}, + {Resources: []*heartbeatpb.ResourceUsage{{Resource: Sink}, {Resource: Sink}}}, + {Resources: []*heartbeatpb.ResourceUsage{{Resource: EventStoreRead}}}, + } { + _, valid := Rates(load) + require.False(t, valid) + _, valid = Counters(load) + require.False(t, valid) + } + for _, rate := range []float64{-1, math.NaN(), math.Inf(1)} { + for _, load := range []*heartbeatpb.NodeLoad{ + {BytesPerSecond: rate}, + {Resources: []*heartbeatpb.ResourceUsage{{Resource: Sink}, {Resource: EventStoreRead, BytesPerSecond: rate}}}, + } { + _, valid := Rates(load) + require.False(t, valid) + } + } +} From 09c351f60baf69368b952ede11677fbfa4dfd317 Mon Sep 17 00:00:00 2001 From: wk989898 Date: Mon, 23 Nov 2026 10:18:04 +0000 Subject: [PATCH 3/7] update Signed-off-by: wk989898 --- logservice/eventstore/event_store.go | 8 ++- logservice/eventstore/event_store_test.go | 27 ++++++++ maintainer/scheduler.go | 3 + maintainer/scheduler/balance.go | 28 ++++---- maintainer/scheduler/balance_test.go | 73 +++++++++++++++++--- maintainer/scheduler/traffic_balance.go | 49 ++++++++++++++ maintainer/scheduler_test.go | 81 +++++++++++++++++++++++ pkg/scheduler/balance.go | 32 ++++++--- pkg/scheduler/scheduler_test.go | 52 +++++++++++++-- 9 files changed, 311 insertions(+), 42 deletions(-) create mode 100644 maintainer/scheduler/traffic_balance.go create mode 100644 maintainer/scheduler_test.go diff --git a/logservice/eventstore/event_store.go b/logservice/eventstore/event_store.go index f46f4c32de..ba4886afe4 100644 --- a/logservice/eventstore/event_store.go +++ b/logservice/eventstore/event_store.go @@ -1517,9 +1517,11 @@ func (e *eventStore) writeEvents( insertKVEntryCount.Add(float64(insertCount)) updateKVEntryCount.Add(float64(updateCount)) deleteKVEntryCount.Add(float64(deleteCount)) + // A large Pebble commit transfers ownership and clears the batch data. + batchBytes := batch.Len() eventStoreWriteBatchEventsCountHist.Observe(float64(kvCount)) - eventStoreWriteBatchSizeHist.Observe(float64(batch.Len())) - eventStoreWriteBytes.Add(float64(batch.Len())) + eventStoreWriteBatchSizeHist.Observe(float64(batchBytes)) + eventStoreWriteBytes.Add(float64(batchBytes)) if totalValueBytesAfter > 0 { eventStoreCompressionRatioHistogram.Observe(float64(totalValueBytesBefore) / float64(totalValueBytesAfter)) } @@ -1527,7 +1529,7 @@ func (e *eventStore) writeEvents( start := time.Now() err := batch.Commit(pebble.NoSync) if err == nil { - resource.EventStoreWriteBytes.Add(uint64(batch.Len())) + resource.EventStoreWriteBytes.Add(uint64(batchBytes)) } eventStoreWriteDurationHistogram.Observe(time.Since(start).Seconds()) return err diff --git a/logservice/eventstore/event_store_test.go b/logservice/eventstore/event_store_test.go index 11abe73d1d..890101fb45 100644 --- a/logservice/eventstore/event_store_test.go +++ b/logservice/eventstore/event_store_test.go @@ -1758,6 +1758,33 @@ func TestEventStoreFailedWriteDoesNotRecordLoad(t *testing.T) { require.Equal(t, before, resource.EventStoreWriteBytes.Load()) } +func TestEventStoreLargeBatchWriteLoad(t *testing.T) { + // A small memtable exercises Pebble's flushable-batch path without a + // production-sized allocation. Commit transfers ownership of batch data. + db, err := pebble.Open(t.TempDir(), &pebble.Options{MemTableSize: 64 << 10}) + require.NoError(t, err) + defer db.Close() + entry := common.RawKVEntry{ + OpType: common.OpTypePut, StartTs: 1, CRTs: 2, + Key: []byte("k"), Value: bytes.Repeat([]byte("v"), 40<<10), + } + batch := db.NewBatch() + require.NoError(t, batch.Set(EncodeKey(1, 1, &entry, CompressionNone), entry.Encode(), pebble.NoSync)) + expectedBytes := uint64(batch.Len()) + require.Greater(t, expectedBytes, uint64(40<<10)) + require.NoError(t, batch.Close()) + + encoder, err := zstd.NewWriter(nil) + require.NoError(t, err) + defer encoder.Close() + before := resource.EventStoreWriteBytes.Load() + store := &eventStore{} + require.NoError(t, store.writeEvents(db, []eventWithCallback{{ + subID: 1, tableID: 1, kvs: []common.RawKVEntry{entry}, + }}, encoder, nil, nil)) + require.Equal(t, expectedBytes, resource.EventStoreWriteBytes.Load()-before) +} + func TestEventStoreKVEntryCount(t *testing.T) { dir := t.TempDir() _, storeInt := newEventStoreForTest(dir) diff --git a/maintainer/scheduler.go b/maintainer/scheduler.go index fa3bdb930a..9dce0d1b1e 100644 --- a/maintainer/scheduler.go +++ b/maintainer/scheduler.go @@ -39,6 +39,7 @@ func NewScheduleController(changefeedID common.ChangeFeedID, drainState *scheduler.DrainState, balanceMoveBatchSize int, ) *pkgscheduler.Controller { + trafficBalance := scheduler.NewTrafficBalanceState(balanceInterval) schedulers := map[string]pkgscheduler.Scheduler{ pkgscheduler.BasicScheduler: scheduler.NewBasicScheduler( changefeedID, @@ -66,6 +67,7 @@ func NewScheduleController(changefeedID common.ChangeFeedID, common.DefaultMode, drainState, balanceMoveBatchSize, + trafficBalance, ), } if splitter != nil { @@ -106,6 +108,7 @@ func NewScheduleController(changefeedID common.ChangeFeedID, common.RedoMode, drainState, balanceMoveBatchSize, + trafficBalance, ) if splitter != nil { schedulers[pkgscheduler.RedoBalanceSplitScheduler] = scheduler.NewBalanceSplitsScheduler( diff --git a/maintainer/scheduler/balance.go b/maintainer/scheduler/balance.go index 6893265453..04c324c772 100644 --- a/maintainer/scheduler/balance.go +++ b/maintainer/scheduler/balance.go @@ -53,8 +53,7 @@ type balanceScheduler struct { drainState *DrainState drainBalanceBlockedUntil time.Time - trafficMovePending bool - trafficBalanceNotBefore time.Time + trafficBalance *TrafficBalanceState } func NewBalanceScheduler( @@ -66,7 +65,11 @@ func NewBalanceScheduler( mode int64, drainState *DrainState, moveBatchSize int, + trafficBalance *TrafficBalanceState, ) *balanceScheduler { + if trafficBalance == nil { + trafficBalance = NewTrafficBalanceState(checkBalanceInterval) + } return &balanceScheduler{ changefeedID: changefeedID, batchSize: moveBatchSize, @@ -78,6 +81,7 @@ func NewBalanceScheduler( checkBalanceInterval: checkBalanceInterval, mode: mode, drainState: drainState, + trafficBalance: trafficBalance, } } @@ -103,15 +107,6 @@ func (s *balanceScheduler) Execute() time.Time { // not in stable schedule state, skip balance return nextCheckTime } - if s.trafficMovePending { - // Start the observation window after the operator finishes, so a slow - // move cannot consume the cooldown before its new placement is sampled. - // Three report windows also let the node smoother settle before choosing - // another destination from rates that still include the old placement. - s.trafficMovePending = false - s.trafficBalanceNotBefore = now.Add(max(s.checkBalanceInterval, 3*heartbeatpb.DispatcherTrafficSampleInterval)) - } - // 1. check whether we have spans in defaultGroupID need to be splitted. // we only consider the not splitted span here. checkResults := s.spanController.CheckByGroup(pkgReplica.DefaultGroupID, s.batchSize) @@ -141,7 +136,8 @@ func (s *balanceScheduler) schedulerDefaultGroup( maxSize int, state drainStateSnapshot, ) int { - if maxSize <= 0 || time.Now().Before(s.trafficBalanceNotBefore) { + now := time.Now() + if maxSize <= 0 || !s.trafficBalance.ready(now) { return 0 } nodes := s.nodeManager.GetAliveNodes() @@ -150,7 +146,6 @@ func (s *balanceScheduler) schedulerDefaultGroup( return 0 } group := pkgreplica.DefaultGroupID - now := time.Now() loads, status := s.spanController.NodeLoadTracker().Snapshot(nodes, now) if status == heartbeatpb.NodeLoadStatus_LOAD_INCOMPLETE { return 0 @@ -176,7 +171,7 @@ func (s *balanceScheduler) schedulerDefaultGroup( // Project only this maintainer's accepted moves. Other maintainers keep // using the coordinator snapshot until the next node sample arrives. if overloaded && s.balanceTraffic(nodes, replicas, loadView, now) { - s.trafficMovePending = true + s.trafficBalance.pending = s.operatorController return 1 } } @@ -186,6 +181,7 @@ func (s *balanceScheduler) schedulerDefaultGroup( } return pkgScheduler.Balance(maxSize, s.random, nodes, replicas, func(r *replica.SpanReplication, target node.ID) bool { if status == heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE { + source := r.GetNodeID() rate := r.TrafficRate(now) if rate == 0 { return false @@ -193,13 +189,13 @@ func (s *balanceScheduler) schedulerDefaultGroup( if rate == 1 { rate = 0 // The idle sentinel contributes no actual traffic. } - if !loadView.canMove(r.GetNodeID(), target, rate) { + if !loadView.canMove(source, target, rate) { return false } if !s.doMove(r, target) { return false } - loadView.project(r.GetNodeID(), target, rate) + loadView.project(source, target, rate) return true } return s.doMove(r, target) diff --git a/maintainer/scheduler/balance_test.go b/maintainer/scheduler/balance_test.go index 37e49840bb..1b3b5091b9 100644 --- a/maintainer/scheduler/balance_test.go +++ b/maintainer/scheduler/balance_test.go @@ -50,6 +50,7 @@ func TestBalanceSchedulerUsesCheckBalanceInterval(t *testing.T) { tc.mode, drainState, testDefaultBalanceMoveBatchSize, + nil, ) beforeExecute := time.Now() @@ -86,6 +87,7 @@ func TestBalanceSchedulerSkipsWhenDrainActive(t *testing.T) { common.DefaultMode, drainState, testDefaultBalanceMoveBatchSize, + nil, ) _ = s.Execute() @@ -115,6 +117,7 @@ func TestBalanceSchedulerUsesConfiguredMoveBatchSize(t *testing.T) { common.DefaultMode, drainState, 5, + nil, ) _ = s.Execute() @@ -145,6 +148,7 @@ func TestBalanceSchedulerSkipsDuringDrainCooldown(t *testing.T) { common.DefaultMode, drainState, testDefaultBalanceMoveBatchSize, + nil, ) s.drainBalanceBlockedUntil = time.Time{} @@ -184,7 +188,7 @@ func TestBalanceSchedulerBalancesWholeTableTraffic(t *testing.T) { } } } - s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, drainState, 5) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, drainState, 5, nil) s.random = rand.New(rand.NewSource(1)) hotMoves := 0 for round := range 40 { @@ -201,14 +205,14 @@ func TestBalanceSchedulerBalancesWholeTableTraffic(t *testing.T) { } tracker.Replace(reports, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) // Advance the observation window without sleeping in the unit test. - s.trafficMovePending = false - s.trafficBalanceNotBefore = time.Time{} + s.trafficBalance.pending = nil + s.trafficBalance.notBefore = time.Time{} s.Execute() if round == 0 { require.Equal(t, 1, oc.OperatorSize(), "traffic balance is locally limited to one move") s.Execute() require.Equal(t, 1, oc.OperatorSize(), "an unfinished move blocks another round") - require.True(t, s.trafficMovePending) + require.Same(t, oc, s.trafficBalance.pending) } for _, op := range oc.GetAllOperators() { if traffic[op.ID()] > 1 { @@ -228,7 +232,7 @@ func TestBalanceSchedulerBalancesWholeTableTraffic(t *testing.T) { before := time.Now() s.Execute() require.Zero(t, oc.OperatorSize()) - require.False(t, s.trafficBalanceNotBefore.Before(before.Add(3*heartbeatpb.DispatcherTrafficSampleInterval))) + require.False(t, s.trafficBalance.notBefore.Before(before.Add(3*heartbeatpb.DispatcherTrafficSampleInterval))) } } counts, hotCounts := map[node.ID]int{}, map[node.ID]int{} @@ -267,7 +271,7 @@ func TestBalanceSchedulerRequiresReliableNodeLoad(t *testing.T) { tracker := replica.NewNodeLoadTracker() tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 300}, {NodeId: "dest"}}, tc.status, time.Now().Add(-tc.age)) sc.SetNodeLoadTracker(tracker) - s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 2) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 2, nil) s.Execute() require.Equal(t, tc.moves, oc.OperatorSize() > 0) }) @@ -288,7 +292,7 @@ func TestBalanceSchedulerUsesNodeTotalsAcrossChangefeeds(t *testing.T) { tracker := replica.NewNodeLoadTracker() tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 1500}, {NodeId: "busy", BytesPerSecond: 2000}, {NodeId: "idle", BytesPerSecond: 100}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) sc.SetNodeLoadTracker(tracker) - s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5, nil) s.Execute() require.Equal(t, 1, oc.OperatorSize()) op := oc.GetAllOperators()[0] @@ -309,7 +313,7 @@ func TestBalanceSchedulerDoesNotMoveAnIndivisibleHotTable(t *testing.T) { tracker := replica.NewNodeLoadTracker() tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 100}, {NodeId: "dest"}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) sc.SetNodeLoadTracker(tracker) - s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5, nil) s.Execute() require.Zero(t, oc.OperatorSize()) } @@ -334,7 +338,7 @@ func TestBalanceSchedulerAvoidsBusyEventStoreTargets(t *testing.T) { resource.Load{resource.Sink: 0, kind: 0}.ToNodeLoad("idle"), }, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) sc.SetNodeLoadTracker(tracker) - s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5, nil) s.Execute() require.Equal(t, 1, oc.OperatorSize()) op := oc.GetAllOperators()[0] @@ -344,3 +348,54 @@ func TestBalanceSchedulerAvoidsBusyEventStoreTargets(t *testing.T) { }) } } + +func TestCountBalanceSkipsRejectedEmptyNode(t *testing.T) { + cfID, nm, oc, sc, ds, self := newDrainSchedulerTestHarness(t) + for _, id := range []node.ID{self, "busy", "eligible"} { + nm.GetAliveNodes()[id] = &node.Info{ID: id} + } + for i, id := range []node.ID{self, self, self, self, self, "eligible"} { + r := addReplicatingSpan(t, cfID, sc, int64(i+1), id) + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: 1}) + } + tracker := replica.NewNodeLoadTracker() + tracker.Replace([]*heartbeatpb.NodeLoad{ + resource.Load{resource.Sink: 0, resource.EventStoreWrite: 0}.ToNodeLoad(self.String()), + resource.Load{resource.Sink: 0, resource.EventStoreWrite: 2000}.ToNodeLoad("busy"), + resource.Load{resource.Sink: 0, resource.EventStoreWrite: 0}.ToNodeLoad("eligible"), + }, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + sc.SetNodeLoadTracker(tracker) + s := NewBalanceScheduler(cfID, nil, oc, sc, time.Second, common.DefaultMode, ds, 5, nil) + s.Execute() + require.Equal(t, 1, oc.OperatorSize()) + op := oc.GetAllOperators()[0] + op.Check(self, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Stopped}) + require.Equal(t, node.ID("eligible"), op.Schedule().To) +} + +func TestTrafficBalanceObservationStartsAfterCompletion(t *testing.T) { + for _, interval := range []time.Duration{time.Second, time.Minute} { + t.Run(interval.String(), func(t *testing.T) { + cfID, nm, oc, sc, _, self := newDrainSchedulerTestHarness(t) + nm.GetAliveNodes()[self] = &node.Info{ID: self} + nm.GetAliveNodes()["target"] = &node.Info{ID: "target"} + r := addReplicatingSpan(t, cfID, sc, 1, self) + op := oc.NewMoveOperator(r, self, "target") + require.True(t, oc.AddOperator(op)) + state := NewTrafficBalanceState(interval) + state.pending = oc + now := time.Unix(100, 0) + require.False(t, state.ready(now)) + // Even a long move must keep both modes blocked until completion. + now = now.Add(time.Hour) + require.False(t, state.ready(now)) + require.True(t, state.notBefore.IsZero()) + oc.RemoveOp(op.ID()) + require.False(t, state.ready(now)) + expected := now.Add(max(interval, 3*heartbeatpb.DispatcherTrafficSampleInterval)) + require.Equal(t, expected, state.notBefore) + require.False(t, state.ready(expected.Add(-time.Nanosecond))) + require.True(t, state.ready(expected)) + }) + } +} diff --git a/maintainer/scheduler/traffic_balance.go b/maintainer/scheduler/traffic_balance.go new file mode 100644 index 0000000000..77b8021eea --- /dev/null +++ b/maintainer/scheduler/traffic_balance.go @@ -0,0 +1,49 @@ +// Copyright 2026 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 scheduler + +import ( + "time" + + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/maintainer/operator" +) + +// TrafficBalanceState limits traffic migrations across one maintainer's normal +// and redo schedulers. Both run in the schedule controller's checker goroutine. +type TrafficBalanceState struct { + pending *operator.Controller + notBefore time.Time + observationInterval time.Duration +} + +func NewTrafficBalanceState(checkInterval time.Duration) *TrafficBalanceState { + return &TrafficBalanceState{ + observationInterval: max(checkInterval, 3*heartbeatpb.DispatcherTrafficSampleInterval), + } +} + +func (s *TrafficBalanceState) ready(now time.Time) bool { + if s.pending != nil { + if s.pending.OperatorSize() > 0 { + return false + } + // Either mode may observe completion. Start the shared window only + // after the owner finishes, so a slow move cannot consume its cooldown. + // Three report windows also let node smoothing reflect the new placement. + s.pending = nil + s.notBefore = now.Add(s.observationInterval) + } + return !now.Before(s.notBefore) +} diff --git a/maintainer/scheduler_test.go b/maintainer/scheduler_test.go new file mode 100644 index 0000000000..d17e111364 --- /dev/null +++ b/maintainer/scheduler_test.go @@ -0,0 +1,81 @@ +// Copyright 2026 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 maintainer + +import ( + "testing" + "time" + + "github.com/pingcap/ticdc/heartbeatpb" + "github.com/pingcap/ticdc/maintainer/operator" + "github.com/pingcap/ticdc/maintainer/replica" + "github.com/pingcap/ticdc/maintainer/scheduler" + "github.com/pingcap/ticdc/maintainer/span" + "github.com/pingcap/ticdc/maintainer/testutil" + "github.com/pingcap/ticdc/pkg/common" + appcontext "github.com/pingcap/ticdc/pkg/common/context" + "github.com/pingcap/ticdc/pkg/node" + pkgscheduler "github.com/pingcap/ticdc/pkg/scheduler" + "github.com/pingcap/ticdc/server/watcher" + "github.com/stretchr/testify/require" +) + +func TestScheduleControllerSharesTrafficMoveLimit(t *testing.T) { + for _, first := range []int{0, 1} { + names := []string{pkgscheduler.BalanceScheduler, pkgscheduler.RedoBalanceScheduler} + t.Run(names[first]+" first", func(t *testing.T) { + m, self := newMaintainerForRedoCheckpointCalculationTest(t) + c := m.controller + nm := appcontext.GetService[*watcher.NodeManager](watcher.NodeManagerName) + nm.GetAliveNodes()[self] = &node.Info{ID: self} + nm.GetAliveNodes()["target"] = &node.Info{ID: "target"} + tracker := replica.NewNodeLoadTracker() + tracker.Replace([]*heartbeatpb.NodeLoad{{NodeId: self.String(), BytesPerSecond: 400}, {NodeId: "target"}}, heartbeatpb.NodeLoadStatus_LOAD_AVAILABLE, time.Now()) + controllers := []*span.Controller{c.spanController, c.redoSpanController} + operators := []*operator.Controller{c.operatorController, c.redoOperatorController} + for i, sc := range controllers { + sc.SetNodeLoadTracker(tracker) + mode := []int64{common.DefaultMode, common.RedoMode}[i] + for j, id := range []node.ID{self, self, "target"} { + rate := float32(100) + if id == "target" { + rate = 1 + } + r := replica.NewWorkingSpanReplication(m.changefeedID, common.NewDispatcherID(), 1, + testutil.GetTableSpanByID(int64(j+1)), &heartbeatpb.TableSpanStatus{CheckpointTs: 1, Mode: mode}, id, false) + r.UpdateStatus(&heartbeatpb.TableSpanStatus{CheckpointTs: 1, Mode: mode, ComponentStatus: heartbeatpb.ComponentState_Working, EventSizePerSecond: rate}) + sc.AddReplicatingSpan(r) + } + } + sc := NewScheduleController(m.changefeedID, 10, operators[0], operators[1], controllers[0], controllers[1], time.Second, nil, nil, scheduler.NewDrainState(), 10) + sc.GetScheduler(names[first]).Execute() + require.Equal(t, 1, operators[first].OperatorSize()) + sc.GetScheduler(names[1-first]).Execute() + require.Zero(t, operators[1-first].OperatorSize(), "normal and redo must share the in-flight traffic move limit") + + op := operators[first].GetAllOperators()[0] + op.Check(op.Schedule().To, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Stopped}) + op.Check(op.Schedule().To, &heartbeatpb.TableSpanStatus{CheckpointTs: 1, ComponentStatus: heartbeatpb.ComponentState_Working}) + require.True(t, op.IsFinished()) + op.PostFinish() + operators[first].RemoveOp(op.ID()) + // Either mode can first observe completion. Both must honor the same + // observation period before acting on the unchanged node snapshot. + sc.GetScheduler(names[1-first]).Execute() + sc.GetScheduler(names[first]).Execute() + require.Zero(t, operators[0].OperatorSize()) + require.Zero(t, operators[1].OperatorSize()) + }) + } +} diff --git a/pkg/scheduler/balance.go b/pkg/scheduler/balance.go index a1ce6ff039..e6ac709057 100644 --- a/pkg/scheduler/balance.go +++ b/pkg/scheduler/balance.go @@ -115,23 +115,35 @@ func Balance[T replica.ReplicationID, R replica.Replication[T]]( return 0 } + tryMove := func() (victim, target *item[T, R], taskIndex int) { + // The first entries retain the usual most/least loaded fast path. + // Rejections can be specific to a task, source, or destination, so try + // the other pairs before declaring this round unable to make progress. + for _, source := range maxPriorityQueue.h.All() { + if source.Load <= lowerLimitPerCapture { + continue + } + for i, task := range source.Tasks { + for _, dest := range minPriorityQueue.h.All() { + if dest.Load < lowerLimitPerCapture && move(task, dest.Node) { + return source, dest, i + } + } + } + } + return nil, nil, -1 + } + movedSize = 0 for { - target, _ := minPriorityQueue.PeekTop() - if target.Load >= lowerLimitPerCapture { - // the minimum workload has reached the lower limit - break - } - victim, _ := maxPriorityQueue.PeekTop() - task := victim.Tasks[0] - if !move(task, target.Node) { - // A rejected move leaves both queues unchanged, so retrying would pick - // the same pair forever. End the round; the next one reshuffles tasks. + victim, target, taskIndex := tryMove() + if taskIndex < 0 { break } // update the task size priority queue target.Load++ victim.Load-- + victim.Tasks[taskIndex] = victim.Tasks[0] clear(victim.Tasks[:1]) victim.Tasks = victim.Tasks[1:] movedSize++ diff --git a/pkg/scheduler/scheduler_test.go b/pkg/scheduler/scheduler_test.go index 4746df87a4..19609550d3 100644 --- a/pkg/scheduler/scheduler_test.go +++ b/pkg/scheduler/scheduler_test.go @@ -37,7 +37,7 @@ func (r *testReplication) GetNodeID() node.ID { return r.nodeID } func (r *testReplication) SetNodeID(nodeID node.ID) { r.nodeID = nodeID } func (r *testReplication) ShouldRun() bool { return true } -func TestBalanceStopsWhenMoveIsRejected(t *testing.T) { +func TestBalanceStopsAfterAllMovesAreRejected(t *testing.T) { nodes := map[node.ID]*node.Info{ "node1": {ID: "node1"}, "node2": {ID: "node2"}, @@ -53,14 +53,17 @@ func TestBalanceStopsWhenMoveIsRejected(t *testing.T) { // Simulates a quiescing operator controller that rejects every move. calls := 0 + attempted := make(map[testReplicationID]bool) moved := Balance(10, rand.New(rand.NewSource(1)), nodes, replicating, - func(*testReplication, node.ID) bool { + func(r *testReplication, target node.ID) bool { calls++ - require.Equal(t, 1, calls, "rejected move was retried") + require.Equal(t, node.ID("node3"), target) + require.False(t, attempted[r.id], "rejected pair must not be retried without progress") + attempted[r.id] = true return false }) require.Equal(t, 0, moved) - require.Equal(t, 1, calls) + require.Equal(t, len(replicating), calls) } func TestBalanceMovesTasksToEmptyNode(t *testing.T) { @@ -85,6 +88,47 @@ func TestBalanceMovesTasksToEmptyNode(t *testing.T) { require.Equal(t, 2, moved) } +func TestBalanceTriesOtherTargets(t *testing.T) { + nodes := map[node.ID]*node.Info{ + "source": {ID: "source"}, "busy": {ID: "busy"}, "eligible": {ID: "eligible"}, + } + var replicating []*testReplication + for i, id := range []node.ID{"source", "source", "source", "source", "source", "eligible"} { + replicating = append(replicating, &testReplication{id: testReplicationID(rune('a' + i)), nodeID: id}) + } + rejected := 0 + moved := Balance(10, rand.New(rand.NewSource(1)), nodes, replicating, func(r *testReplication, target node.ID) bool { + if target == "busy" { + rejected++ + return false + } + require.Equal(t, node.ID("eligible"), target) + r.SetNodeID(target) + return true + }) + require.Positive(t, rejected) + require.Equal(t, 1, moved, "a rejected empty node must not hide another underloaded node") +} + +func TestBalanceTriesOtherTasksAndSources(t *testing.T) { + for _, eligible := range []testReplicationID{"c", "e"} { + t.Run(eligible.String(), func(t *testing.T) { + nodes := map[node.ID]*node.Info{ + "source1": {ID: "source1"}, "source2": {ID: "source2"}, "target": {ID: "target"}, + } + var replicating []*testReplication + for i, id := range []node.ID{"source1", "source1", "source1", "source1", "source2", "source2", "source2"} { + replicating = append(replicating, &testReplication{id: testReplicationID(rune('a' + i)), nodeID: id}) + } + moved := Balance(10, rand.New(rand.NewSource(1)), nodes, replicating, func(r *testReplication, target node.ID) bool { + require.Equal(t, node.ID("target"), target) + return r.id == eligible + }) + require.Equal(t, 1, moved) + }) + } +} + func TestCheckBalanceStatus(t *testing.T) { require.Equal(t, 0, CheckBalanceStatus(map[node.ID]int{ "node1": 2, From e0e9c8cee07ae6ea72cb62f29f5ab1b51635f167 Mon Sep 17 00:00:00 2001 From: wk989898 Date: Tue, 24 Nov 2026 09:55:33 +0000 Subject: [PATCH 4/7] add design doc Signed-off-by: wk989898 --- ...026-11-24-ticdc-node-resource-balancing.md | 477 ++++++++++++++++++ 1 file changed, 477 insertions(+) create mode 100644 docs/design/2026-11-24-ticdc-node-resource-balancing.md diff --git a/docs/design/2026-11-24-ticdc-node-resource-balancing.md b/docs/design/2026-11-24-ticdc-node-resource-balancing.md new file mode 100644 index 0000000000..596cc24bd2 --- /dev/null +++ b/docs/design/2026-11-24-ticdc-node-resource-balancing.md @@ -0,0 +1,477 @@ +# Shared Node Resource View for Dispatcher Balancing + +## 1. Problem and decision + +Equal dispatcher counts do not imply equal node load. Consider nine tables +distributed as three dispatchers per capture. If three hot tables happen to +share one capture, count balancing sees `3 / 3 / 3`, while traffic is concentrated +on that capture. This is especially visible when each table remains an +indivisible dispatcher. A per-changefeed view also misses work from other +changefeeds on the same node. + +The Coordinator publishes a shared view of total node resource usage. Each +Maintainer combines that view with the traffic and placement of its own +dispatchers, chooses a source and destination, and creates its own move +operator. There is no Coordinator request or approval for each migration. +Subsequent node samples report the actual effect of accepted moves. + +The initial resource vector contains EventStore write traffic, EventStore read +traffic, and aggregate sink traffic. Sink traffic estimates the benefit of +moving a dispatcher. EventStore traffic constrains destination selection: +subscriptions can be shared or remote, so moving a dispatcher does not imply +that the corresponding EventStore work immediately moves with it. + +### Goals + +- Improve placement even when dispatcher counts are already balanced. +- Include other changefeeds' work when evaluating node load. +- Keep dispatcher ownership and migration decisions local to each Maintainer. +- Reuse one sampling and publication path for additional traffic resources. +- Reduce oscillation while retaining count balancing and mixed-version progress. + +### Scope + +The new decision path operates on the default replication group, including +whole-table dispatchers. Existing split-group balancing remains separate. +Basic scheduling, drain scheduling, operator safety, and downstream write +admission retain their existing responsibilities. + +The current design does not relocate EventStore subscriptions independently, +measure physical disk utilization, or balance CPU and memory. It assumes +comparable node capacity and provides a feedback heuristic rather than a global +optimizer or a bounded convergence time. + +## 2. Ownership and data flow + +```mermaid +flowchart LR + subgraph Capture[Each capture] + ES[EventStore reads and writes] --> Counters[Atomic resource counters] + Sink[Successful sink flushes] --> Counters + Counters --> Manager[Maintainer Manager] + Manager --> Tracker[Shared immutable node view] + Tracker --> Maintainers[Maintainers for local changefeeds] + Details[Per-dispatcher complete heartbeats] --> Maintainers + Maintainers --> Operators[Local operator controllers] + end + Manager -->|NodeHeartbeat: cumulative counters| Coordinator + Coordinator -->|NodeHeartbeatResponse: node rates| Manager + Operators -->|Move owned dispatcher| Placement[Dispatcher placement] +``` + +The next resource samples and dispatcher heartbeats reflect the new placement. +The arrows represent logical responsibilities; the Coordinator itself also +runs on a capture. + +| Owner | State and responsibility | +| --- | --- | +| Resource producers | Process-wide cumulative counters; updates do not consume dispatcher samples. | +| Maintainer Manager | Reports local counters even when no changefeed Maintainer is hosted locally; validates Coordinator responses. | +| Coordinator | Stores counter baselines and smoothed rates by capture, then publishes node totals and availability. | +| `NodeLoadTracker` | Shares one immutable view among local Maintainers and their normal/redo span controllers. | +| Maintainer | Owns its changefeed's dispatcher details and temporary migration projections. | +| Operator controller | Admits and executes moves using the existing operator lifecycle. | + +### Publication membership and local eligibility + +The Coordinator's publication set `P` is its bootstrapper's `GetAllNodeIDs()`: +the captures currently tracked by membership. It can include a capture still +bootstrapping or being drained; membership does not mean that a capture is a +valid migration destination. The common resource set and Coordinator-side +completeness/freshness checks cover all of `P` until a member is removed. + +Each Maintainer constructs its local eligible set `E` from the node watcher's +`GetAliveNodes()`, with the active dispatcher-drain target removed. Resource +averages are computed over `E`, and the local tracker requires a consistent +vector for every member of `E`. Being in `E` does not mean that a node has +passed the per-move load constraints. Regular balancing also pauses during an +active drain and its existing cooldown before these decisions run. + +Local exclusion does not remove a capture from `P`. A member without supported +load reporting can therefore downgrade the published view even if it would +not be a local target. An unobserved member makes support unconfirmed and +selects `LOAD_UNSUPPORTED`; once all members report support, an unusable or +stale sample selects `LOAD_INCOMPLETE`. + +Node observations are asynchronously collected. A published cluster view is not +an atomic measurement of all nodes at one instant. Local projections are not +reservations and are not published back to the Coordinator. Other Maintainers +continue using observations until the next accepted sample. + +## 3. Resource model and measurement + +`pkg/scheduler/resource.Load` maps `ResourceType` to a nonnegative rate. Each +dimension is evaluated independently against its own cluster average; raw byte +rates from different pipeline stages are never added into one traffic score. + +| Resource type | Measurement point | Meaning | +| --- | --- | --- | +| `RESOURCE_SINK` | `TableProgress` after a successful DML flush | Flushed event size across all changefeeds and modes on the process, in the same event-size units as dispatcher traffic reports. | +| `RESOURCE_EVENT_STORE_WRITE` | Successful `writeEvents` batch commit | Encoded Pebble batch bytes, including batch framing. | +| `RESOURCE_EVENT_STORE_READ` | Iterator visits before decryption and decompression | Stored encoded key and value bytes, including records subsequently filtered by a shared subscription's span. | + +EventStore reads include cache hits and repeated scans. These are logical +access counters, not physical device IO, WAL, or compaction measurements. Sink +event-size accounting is also distinct from downstream protocol or socket +bytes. Existing Prometheus byte metrics can have different accounting +boundaries and should not be substituted without checking their definitions. + +### Batch lifetime and dispatcher sample lifetime + +Pebble can transfer ownership of a large batch's backing data during `Commit`. +The write path therefore saves `batch.Len()` before committing and increments +the scheduling counter with that saved value only after success. Failed writes +do not contribute to the successful-write counter. + +Reading the node's cumulative sink counter does not reset a dispatcher's +sampling window. Complete dispatcher heartbeats report +`TableSpanStatus.EventSizePerSecond`; status-only updates omit the sample. +`SpanReplication` retains the latest complete sample across status-only +updates, expires it separately from the node view, and clears it on rebinding. + +The existing dispatcher contract distinguishes: + +| Value returned by `TrafficRate` | Interpretation | +| --- | --- | +| `0` | No usable recent sample; reject resource-aware count moves for this dispatcher. | +| `1` | Idle sentinel; use zero traffic cost for count moves and exclude it from traffic-initiated moves. | +| `> 1` | Sampled sink event-size rate used as migration cost. | + +### Wire representation + +`heartbeatpb/heartbeat.proto` defines a repeated `ResourceUsage` vector within +`NodeLoad`. Requests carry `total_bytes`; responses carry smoothed +`bytes_per_second` and a node ID. Legacy scalar fields remain populated: + +| Field | Purpose | +| --- | --- | +| `NodeLoad.flushed_event_bytes` | Sink cumulative counter for older readers. | +| `NodeLoad.bytes_per_second` | Sink rate for older readers. | +| `NodeLoad.resources` | Typed resource counters or rates for the current reader. | +| `NodeHeartbeatResponse.node_load_status` | Distinguishes unsupported, incomplete, and usable views. | + +No dispatcher inventory is included in the node resource vector. The transport +reuses capture heartbeats and their existing identity, epoch, sequence, and +Coordinator-version checks; it does not add a migration-approval protocol. + +## 4. Sampling, smoothing, and freshness + +For cumulative counter `C[n,r]`, the Coordinator derives the instantaneous rate +for resource `r` on node `n` from two accepted observations: + +```text +instantaneous_rate = (current_counter - previous_counter) / elapsed_seconds +weight = 1 - exp(-elapsed_seconds / 10 seconds) +smoothed_rate = previous_rate + weight * (instantaneous_rate - previous_rate) +``` + +The first usable interval initializes the rate directly. Later intervals apply +the time-weighted EWMA independently to each resource. Matching the ten-second +dispatcher reporting timescale reduces misleading differences caused by +asynchronous flushes and workload steps. + +| Timing | Current value | Role | +| --- | --- | --- | +| Capture heartbeat cadence | 500 ms | Existing heartbeat throttle; execution and transport can delay actual arrival. | +| Minimum accepted counter interval | 1 s | Extra witness/drain heartbeats do not replace a useful rate window with tiny deltas. | +| Coordinator node-sample freshness | 5 s | Reject stale baselines and cluster views. | +| Local node-view freshness | 5 s | A Maintainer stops resource-aware balancing when responses stop arriving. | +| Complete dispatcher traffic period | 10 s | Shared `DispatcherTrafficSampleInterval` constant. | +| Dispatcher traffic freshness | 20 s | Allows the next complete heartbeat to refresh a live dispatcher. | +| Configured balance interval `T` | 15 s by default | Existing `check-balance-interval`. | +| Requested balance wakeup | `T + U(0, T/2)` | Staggers independent Maintainers. | +| Post-traffic-move observation | `max(T, 30 s)` | Shared by normal and redo modes. | + +The checker controller executes its checker schedulers together and uses the +earliest requested wakeup. Another checker can therefore cause an earlier +invocation. Jitter is a scheduling request, not a hard execution-rate limit; +the in-flight check and observation deadline enforce migration pacing. + +A counter decrease, resource-set change, or stale baseline invalidates the +sample and requires a new baseline before rates become available. Out-of-order +or replayed heartbeat sequences cannot replace a newer observation. Node +removal discards the baseline, and a new process must establish its own sample. + +The Coordinator publishes only resource dimensions supported by every member +of `P`. Missing metrics are unsupported, not observed zeros. The local tracker +also rejects malformed rates, duplicate nodes/resources, missing eligible +nodes, inconsistent vectors, and stale views. + +## 5. Local scheduling decisions + +### Eligibility and availability + +A balance scheduler first honors drain state and its existing drain cooldown. +It waits while its own operator controller has work or its span controller has +absent dispatchers. Split work retains priority within the configured default +group budget. Migration selection then requires at least two eligible nodes. + +| Shared-view status | Default-group balancing behavior | +| --- | --- | +| `LOAD_AVAILABLE` | Use resource-aware traffic balancing, then guarded count balancing. | +| `LOAD_INCOMPLETE` | Wait for a complete, fresh view; do not infer that unobserved nodes are idle. | +| `LOAD_UNSUPPORTED` | Retain legacy count balancing without resource guards. | + +When neither sink traffic nor dispatcher counts are imbalanced, the default +group move path returns before retrieving and scanning every dispatcher. Other +split-checking work remains independent of that fast path. + +### Traffic-initiated moves + +Let `L[n,r]` be the node rate and `A[r]` the average across eligible nodes. A +node is sink-overloaded when: + +```text +L[source, sink] > 1.2 * A[sink] +``` + +The Maintainer shuffles its own default-group dispatchers. For a working +dispatcher with a fresh rate `q > 1` on an overloaded source, a target must: + +1. Be an eligible node other than the source. +2. Have sink traffic below `A[sink]`. +3. Satisfy `0 < q < 0.9 * (L[source,sink] - L[target,sink])`. +4. Pass every other available resource constraint. + +For each non-sink resource `r`, reject the target if both conditions hold: + +```text +L[target,r] > 1.2 * A[r] +L[target,r] > L[source,r] +``` + +This prevents a sink-idle node from appearing attractive while already serving +more EventStore traffic than the source. It still permits moving toward a node +with lower pressure when both nodes are above the average. + +The pairwise sink condition reduces the projected source/target gap and leaves +headroom against moving too much traffic. For example, a 1,000-unit dispatcher +can move from a 3,000-unit source to an idle target. A sole 1,000-unit hot +dispatcher cannot move from a 1,000-unit source to an idle target merely to +exchange which node is busy. + +Targets are chosen uniformly among eligible candidates using reservoir +sampling. The Maintainer admits at most one traffic-initiated move, records +its operator controller in shared pacing state, and ends that traffic round. +It does not wait for Coordinator approval. + +### Count balancing and projection + +If no traffic move is admitted, count balancing can fill count-underloaded +nodes toward the floor of the average dispatcher count, within the remaining +batch budget. With a usable resource view, each attempted move follows these +guards: + +1. Reject a missing traffic sample (`TrafficRate == 0`). Convert the complete + idle sentinel (`TrafficRate == 1`) into projected cost `q = 0`. +2. For positive cost, require the same pairwise sink improvement: + `q < 0.9 * (L[source,sink] - L[target,sink])`. A zero-cost idle move skips + this strictly positive sink-cost condition. +3. For every non-sink dimension, apply the destination constraint above, + including for zero-cost moves. +4. Admit the operator before applying any projection. + +Count moves do not require a source above `1.2 * A[sink]` or a target below +`A[sink]`. Those are traffic-initiated selection conditions. Resource-aware +count moves still require a count deficit at the target and a surplus at the +source; legacy unsupported-view count moves retain their existing behavior. + +A rejected pair does not end the round. The search checks other destinations, +dispatchers, and sources. It ends when no pair is accepted or the move budget +is exhausted. The candidate scans are finite; after each success, counts and +candidate lists advance. The search has no fixed wall-clock budget and can +still be expensive for a large imbalanced changefeed with many rejected pairs. + +Before admission, the callback captures the origin node ID. The same origin is +used for `canMove` and the accepted move's projection, even if operator status +processing rebinds the span before projection executes: + +```text +projected_source_sink = max(0, source_sink - q) +projected_target_sink = target_sink + q +``` + +Only this Maintainer's temporary sink view changes. EventStore rates are not +subtracted from the source or added to the target, because subscription sharing +and remote service make that prediction unreliable. Subsequent samples report +the real changes. + +### Shared normal/redo pacing + +`NewScheduleController` creates one `TrafficBalanceState` for both normal and +redo balance schedulers. If either admits a traffic move, both default-group +move paths wait while the initiating operator controller still has operators. +The first eligible check after that controller becomes empty starts the shared +`max(T, 30 s)` observation window. A slow migration cannot consume this window +before its new placement is observable. + +The one-move limit applies to traffic-initiated moves. Count balancing retains +its configured batch behavior, and count moves do not start a traffic cooldown. +Basic scheduling and drain operations retain their own limits and are not +globally serialized by this state. The existing `balance-move-batch-size` +defaults to 1,024 and covers split and move work for a default-group invocation. + +## 6. Concurrency and failure boundaries + +| State | Access discipline | +| --- | --- | +| Process resource counters | Atomic increments and loads; sampling never resets counters. | +| Coordinator baselines and rates | Owned by its single event-handling goroutine. | +| Local node resource view | `Replace` constructs fresh maps and publishes them with status/timestamp under `RWMutex`; returned snapshots are immutable by contract. | +| Migration projection | Clones both the node map and each resource map before updates. | +| Dispatcher node binding and retained traffic | Protected by `nodeIDMutex`; status pointers are published atomically. | +| `TrafficBalanceState` and scheduler random generator | Confined to the schedule controller's single checker goroutine. | + +Concurrent direct calls to the same scheduler are outside this execution +contract. Adding a lock only around shared pacing state would not establish +thread safety for the rest of a scheduler. If checkers are parallelized later, +admission, random selection, pacing, and projection ownership must be reviewed +together. + +Coordinator failover invalidates pending response sequences and the local view +until the new Coordinator supplies usable observations. Delayed or replayed +responses cannot refresh the tracker. Missing dispatcher samples defer the +affected move rather than guessing its cost. These decisions trade balancing +speed for avoiding moves based on unreliable data. + +Multiple Maintainers can still act on the same observation and choose the same +target. Random selection, requested jitter, and local observation windows reduce +this effect without eliminating it. The next samples provide correction; +there is no cluster-wide reservation or guarantee that each intermediate +placement improves total load. + +## 7. Compatibility and extension + +Resource information is advisory and does not change the existing write-lease +protocol version. Keep its legacy scalar fields and protobuf field numbers. + +| Peer combination | Behavior | +| --- | --- | +| New peers | Exchange resource vectors and use all common dimensions. | +| Sink-only capture with a new Coordinator | Accept its scalar counter and distribute the common sink dimension. | +| Capture without node-load reporting | The cluster resource view is unsupported; count balancing remains available. | +| New capture with a sink-only Coordinator | Read scalar sink rates; EventStore dimensions remain unsupported. | +| Coordinator without load response fields | Protobuf defaults select `LOAD_UNSUPPORTED`; retain count balancing. | +| Coordinator without the supported heartbeat/write-lease protocol | Bootstrap explicitly selects the unsupported resource path instead of waiting forever for responses. | +| Malformed or stale supported data | Select `LOAD_INCOMPLETE` and wait for a usable view. | + +Unknown positive resource types can be carried by the vector. A current reader +still validates rate values, uniqueness, and the required sink dimension. A +resource participates only when every member of `P` supports it; older readers +can ignore the new vector while retaining the scalar sink fields. + +To add another cumulative traffic resource: + +1. Append a stable `ResourceType` value and regenerate the protobuf code. +2. Add a counter and register it in the resource snapshot list. +3. Instrument a defined measurement boundary, checking buffer ownership and + failure semantics before choosing when to increment it. +4. Reuse generic Coordinator rate sampling and common-dimension publication. +5. Verify destination screening, resets, stale data, mixed peers, and resource + ownership with focused tests. + +The current wire sampling semantics describe cumulative bytes and byte rates. +CPU, memory, capacities, or gauges need an explicit sampling/normalization +contract before being added. A resource that should actively initiate moves +also needs a cost model for the work being moved; registering a new counter +alone does not provide one. + +The Coordinator stores `O(N * R)` state for `N` nodes and `R` resources. Each +reply carries that node view, giving approximately `O(N^2 * R)` aggregate +distribution volume across all nodes per reporting round. Local checks copy +`O(N * R)` resource state, while dispatcher scans remain local to a changefeed. +This avoids central dispatcher-level planning but does not remove the cost of +broadcasting a cluster-wide view or scanning an imbalanced large changefeed. + +## 8. Validation and observed results + +### Committed regression coverage + +Source and test paths below refer to the implementation snapshot in this +document. The following existing tests cover the main contracts: + +| Contract | Test location / example | +| --- | --- | +| Nine whole tables with initially concentrated hotspots | `maintainer/scheduler/balance_test.go`: `TestBalanceSchedulerBalancesWholeTableTraffic` | +| Other changefeeds affect node totals | `TestBalanceSchedulerUsesNodeTotalsAcrossChangefeeds` | +| Busy EventStore destinations are screened | `TestBalanceSchedulerAvoidsBusyEventStoreTargets` | +| Rejected empty node does not hide another target | `TestCountBalanceSkipsRejectedEmptyNode`; `pkg/scheduler/scheduler_test.go` | +| Large batch bytes survive Pebble ownership transfer | `logservice/eventstore/event_store_test.go`: `TestEventStoreLargeBatchWriteLoad` | +| Normal and redo share pacing | `maintainer/scheduler_test.go`: `TestScheduleControllerSharesTrafficMoveLimit` | +| Observation starts after completion | `TestTrafficBalanceObservationStartsAfterCompletion` | +| Counter windows, mixed versions, and reset | `coordinator/node_load_test.go` | +| Snapshot ownership and dispatcher sample expiry | `maintainer/replica/node_load_test.go`; `maintainer/scheduler/resource_load_test.go` | +| Legacy scalars and future resource dimensions | `pkg/scheduler/resource/load_test.go` | + +For a focused run on a checkout containing the implementation, the repository +test target enables failpoints and uses race detection plus `intest`: + +```bash +make unit_test_pkg PKG='./coordinator/... ./maintainer/... ./logservice/eventstore ./pkg/scheduler/...' +``` + +See [the validation guide](../agents/validation.md) for the repository test +commands. The recorded totals below describe particular runs, not a fixed +expected test count for this command. + +A real-chain run of the multi-resource implementation at `8a71717eb` used one +PD, one TiKV, one TiDB, three independent TiCDC processes, and MySQL 8.0.46 on +one physical host. It retained default scheduling settings, disabled table +splitting, used a non-failpoint runtime, and did not manually migrate tables. + +The workload had nine tables with 4,096 rows each and 1 KiB payloads, using +50-row UPDATE transactions. After natural count balance, three tables on one +capture became hot. The offered per-table rate was 1,000 row updates/s for +180 seconds, then 3,000 for another 420 seconds. + +| Observation | Recorded result | +| --- | --- | +| Committed row updates | 4,310,450 over 600 seconds | +| Hot placement reached `1 / 1 / 1` | About 62 seconds | +| Dispatcher counts returned to `3 / 3 / 3` | About 112 seconds | +| Observed migrations | Two hot-table moves and two cold-table moves | +| Hot returns to the original node | Zero during this run | +| Final correctness | All nine tables matched by full ordered-row SHA-256 and additional count/sequence checks. | + +The later review corrections in `09c351f60` were checked with regression tests. +A subsequent validation of that snapshot passed 857 tests with race detection, +`intest`, and failpoints. That count includes two additional concurrency probes +in an isolated copy, not extra tests committed to the repository. The probes +covered concurrent snapshot publication/private projections and concurrent +dispatcher binding/traffic updates. + +Twenty-seven protocol assertions used regenerated codecs from `9d8506167` +(sink-only load reporting), `b7e1a7058` (before node-load fields), and the current +snapshot. They checked both request/response directions, scalar compatibility, +lease/witness metadata, missing load fields, and unknown resource dimensions. +The namespace was changed only to load historical and current codecs in the +same test process. + +The ten-minute real-chain run predates those review corrections and was not +repeated on `09c351f60`. The runs establish the stated scheduling and correctness +cases; they do not establish multi-host capacity, live mixed-version rolling +upgrade safety, fault recovery, or convergence under arbitrary concurrent load. + +Useful additional acceptance scenarios are two changefeeds with one indivisible +hot table each initially colocated, independently busy EventStore nodes, and +node/Coordinator churn while snapshots are stale. Record actual placement and +committed source work, stop writers, drain replication, and compare complete +rows rather than relying only on metric slopes or final dispatcher counts. + +## 9. Source navigation + +Inspect these paths at `09c351f60` using `git show :`: + +| Area | Source | +| --- | --- | +| Resource types, counters, and conversion | `pkg/scheduler/resource/load.go`; `heartbeatpb/heartbeat.proto` | +| Complete traffic period | `heartbeatpb/node_load.go`; `downstreamadapter/dispatchermanager/task.go` | +| Sink flush accounting | `downstreamadapter/dispatcher/table_progress.go` | +| EventStore accounting | `logservice/eventstore/event_store.go` | +| Capture report/response validation | `maintainer/maintainer_manager_node.go` | +| Coordinator samples and publication | `coordinator/node_load.go`; `coordinator/capture_write_lease.go` | +| Shared tracker and retained dispatcher samples | `maintainer/replica/node_load.go`; `maintainer/replica/replication_span.go` | +| Local decision and projection | `maintainer/scheduler/balance.go`; `maintainer/scheduler/resource_load.go` | +| Normal/redo pacing and wiring | `maintainer/scheduler/traffic_balance.go`; `maintainer/scheduler.go` | +| Count candidate search and checker execution | `pkg/scheduler/balance.go`; `pkg/scheduler/scheduler.go` | +| Existing interval and batch configuration | `pkg/config/scheduler_config.go` | From f58c11908217dc0a1a863a44b42f390cdd7cc14f Mon Sep 17 00:00:00 2001 From: wk989898 Date: Wed, 25 Nov 2026 09:07:11 +0000 Subject: [PATCH 5/7] refactor Signed-off-by: wk989898 --- coordinator/node_load_test.go | 24 +++ .../dispatcher/basic_dispatcher.go | 1 + .../dispatcher/basic_dispatcher_info.go | 3 + .../dispatcher/table_progress.go | 5 +- .../dispatcher/table_progress_test.go | 29 +++- .../dispatchermanager/dispatcher_manager.go | 7 + logservice/eventstore/event_store.go | 55 ++++++- logservice/eventstore/event_store_test.go | 68 ++++++-- maintainer/maintainer_manager.go | 3 + maintainer/maintainer_manager_node.go | 3 +- maintainer/node_liveness_test.go | 1 + pkg/common/context/app_context.go | 1 + pkg/scheduler/resource/load.go | 36 ----- pkg/scheduler/resource/load_test.go | 15 +- pkg/scheduler/resource/stats.go | 153 ++++++++++++++++++ pkg/scheduler/resource/stats_test.go | 124 ++++++++++++++ server/server.go | 5 +- 17 files changed, 465 insertions(+), 68 deletions(-) create mode 100644 pkg/scheduler/resource/stats.go create mode 100644 pkg/scheduler/resource/stats_test.go diff --git a/coordinator/node_load_test.go b/coordinator/node_load_test.go index a33c5fdd3b..29fbeaf5c9 100644 --- a/coordinator/node_load_test.go +++ b/coordinator/node_load_test.go @@ -14,6 +14,7 @@ package coordinator import ( + "math" "testing" "time" @@ -23,6 +24,29 @@ import ( "github.com/stretchr/testify/require" ) +func TestNodeLoadReestablishesBaselineAfterStatsRollover(t *testing.T) { + stats := resource.NewNodeStats() + recorder := stats.NewCounter(resource.Sink).Recorder() + now := time.Now() + var state nodeLoadState + recorder.Add(math.MaxUint64 - 7) + state.observe(stats.Snapshot(now), now) + recorder.Add(3) + now = now.Add(resource.SampleInterval) + state.observe(stats.Snapshot(now), now) + require.True(t, state.available) + require.Equal(t, float64(3), state.rates[resource.Sink]) + recorder.Add(8) + now = now.Add(resource.SampleInterval) + state.observe(stats.Snapshot(now), now) + require.False(t, state.available, "rollover must not look idle or produce an enormous rate") + recorder.Add(5) + now = now.Add(resource.SampleInterval) + state.observe(stats.Snapshot(now), now) + require.True(t, state.available) + require.Equal(t, float64(5), state.rates[resource.Sink]) +} + func TestNodeLoadHeartbeatSnapshot(t *testing.T) { now := time.Unix(100, 0) c := newCaptureWriteLeaseController(10, "coordinator") diff --git a/downstreamadapter/dispatcher/basic_dispatcher.go b/downstreamadapter/dispatcher/basic_dispatcher.go index 0941ad8dbd..a3b2c294fc 100644 --- a/downstreamadapter/dispatcher/basic_dispatcher.go +++ b/downstreamadapter/dispatcher/basic_dispatcher.go @@ -280,6 +280,7 @@ func NewBasicDispatcher( if dispatcher.IsTableTriggerDispatcher() { dispatcher.addTableCheckpointBlocker = newCheckpointBlocker() } + dispatcher.tableProgress.sinkLoad = sharedInfo.SinkLoad.Recorder() dispatcher.resolvedTs.Store(startTs) return dispatcher diff --git a/downstreamadapter/dispatcher/basic_dispatcher_info.go b/downstreamadapter/dispatcher/basic_dispatcher_info.go index 6d102197f7..8d79bf574f 100644 --- a/downstreamadapter/dispatcher/basic_dispatcher_info.go +++ b/downstreamadapter/dispatcher/basic_dispatcher_info.go @@ -24,6 +24,7 @@ import ( "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/ticdc/pkg/routing" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/prometheus/client_golang/prometheus" ) @@ -31,6 +32,8 @@ import ( // that are common across all dispatchers within a DispatcherManager. // This eliminates the need to pass these parameters individually to each dispatcher. type SharedInfo struct { + // SinkLoad is owned by the DispatcherManager and retired after sink shutdown. + SinkLoad *resource.Counter // Basic configuration changefeedID common.ChangeFeedID lowLatencyMode bool diff --git a/downstreamadapter/dispatcher/table_progress.go b/downstreamadapter/dispatcher/table_progress.go index efe346e531..ad5421098c 100644 --- a/downstreamadapter/dispatcher/table_progress.go +++ b/downstreamadapter/dispatcher/table_progress.go @@ -45,6 +45,7 @@ type TableProgress struct { // cumulate dml event size for a period of time, // it will be cleared after once query cumulateEventSize int64 + sinkLoad *resource.Recorder // it used to calculate the sum-dml-event-size/s for each dispatcher lastQueryTime time.Time } @@ -133,7 +134,9 @@ func (p *TableProgress) remove(ts Ts, size int64) { } } p.cumulateEventSize += size - resource.SinkBytes.Add(uint64(size)) + if size > 0 { + p.sinkLoad.Add(uint64(size)) + } } // Empty checks if the TableProgress is empty. diff --git a/downstreamadapter/dispatcher/table_progress_test.go b/downstreamadapter/dispatcher/table_progress_test.go index 5be959c09a..e2dc2b1a08 100644 --- a/downstreamadapter/dispatcher/table_progress_test.go +++ b/downstreamadapter/dispatcher/table_progress_test.go @@ -17,6 +17,7 @@ import ( "testing" "time" + "github.com/pingcap/ticdc/heartbeatpb" "github.com/pingcap/ticdc/pkg/common" commonEvent "github.com/pingcap/ticdc/pkg/common/event" "github.com/pingcap/ticdc/pkg/scheduler/resource" @@ -199,20 +200,40 @@ func TestMultiSameCommitTsStartTsPair(t *testing.T) { } func TestResourceCountersPreserveDispatcherSamples(t *testing.T) { - initial := resource.SinkBytes.Load() + stats := resource.NewNodeStats() + counter := stats.NewCounter(resource.Sink) + now := time.Now() a, b := NewTableProgress(), NewTableProgress() + a.sinkLoad, b.sinkLoad = counter.Recorder(), counter.Recorder() first := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 2, ApproximateSize: 100} second := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 3, ApproximateSize: 200} a.Add(first) b.Add(second) - require.Equal(t, initial, resource.SinkBytes.Load()) + require.Zero(t, stats.Snapshot(now).FlushedEventBytes) first.PostFlush() second.PostFlush() - require.Equal(t, initial+300, resource.Snapshot().FlushedEventBytes) + require.Equal(t, uint64(300), stats.Snapshot(now.Add(resource.SampleInterval)).FlushedEventBytes) // Node-level reads never consume the per-dispatcher traffic samples. a.lastQueryTime = time.Now().Add(-time.Second) b.lastQueryTime = a.lastQueryTime require.InDelta(t, float64(100), a.GetEventSizePerSecond(), 1) require.InDelta(t, float64(200), b.GetEventSizePerSecond(), 1) - require.Equal(t, initial+300, resource.Snapshot().FlushedEventBytes) + require.Equal(t, uint64(300), stats.Snapshot(now.Add(resource.SampleInterval)).FlushedEventBytes) +} + +func TestDispatcherModesShareComponentResourceCounter(t *testing.T) { + stats := resource.NewNodeStats() + shared := newTestSharedInfo(false, false, nil) + defer shared.Close() + shared.SinkLoad = stats.NewCounter(resource.Sink) + testSink := newDispatcherTestSink(t, common.KafkaSinkType) + for _, mode := range []int64{common.DefaultMode, common.RedoMode} { + d := NewBasicDispatcher(common.NewDispatcherID(), &heartbeatpb.TableSpan{TableID: 1}, + 0, 0, NewSchemaIDToDispatchers(), false, false, 0, 0, 0, mode, testSink.Sink(), shared) + event := &commonEvent.DMLEvent{StartTs: 1, CommitTs: 2, ApproximateSize: 100} + d.tableProgress.Add(event) + event.PostFlush() + } + shared.SinkLoad.Close() + require.Equal(t, uint64(200), stats.Snapshot(time.Now()).FlushedEventBytes) } diff --git a/downstreamadapter/dispatchermanager/dispatcher_manager.go b/downstreamadapter/dispatchermanager/dispatcher_manager.go index 17a5e0de5c..bbe0350a32 100644 --- a/downstreamadapter/dispatchermanager/dispatcher_manager.go +++ b/downstreamadapter/dispatchermanager/dispatcher_manager.go @@ -37,6 +37,7 @@ import ( "github.com/pingcap/ticdc/pkg/node" "github.com/pingcap/ticdc/pkg/pdutil" "github.com/pingcap/ticdc/pkg/routing" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/util" "github.com/pingcap/ticdc/pkg/writelease" "github.com/pingcap/ticdc/utils/threadpool" @@ -85,6 +86,7 @@ Architecture: - Each DispatcherManager has exactly one backend sink */ type DispatcherManager struct { + sinkLoad *resource.Counter ctx context.Context changefeedID common.ChangeFeedID keyspaceID uint32 @@ -263,6 +265,9 @@ func NewDispatcherManager( metricRedoEventDispatcherCount: eventDispatcherGauge.WithLabelValues(changefeedID.Keyspace(), changefeedID.Name(), "redoDispatcher"), metricRedoCreateDispatcherDuration: createDispatcherDuration.WithLabelValues(changefeedID.Keyspace(), changefeedID.Name(), "redoDispatcher"), } + if stats, ok := appcontext.TryGetService[*resource.NodeStats](appcontext.NodeResourceStats); ok { + manager.sinkLoad = stats.NewCounter(resource.Sink) + } // Trust only the explicit request maintainer epoch for receiver fencing. The // config epoch may be newer than an old rolling-upgrade request and must not @@ -364,6 +369,7 @@ func NewDispatcherManager( sharedInfo.Close() return nil, newWritePathClosedError() } + sharedInfo.SinkLoad = manager.sinkLoad manager.sharedInfo = sharedInfo manager.writePathMu.Unlock() @@ -1203,6 +1209,7 @@ func (e *DispatcherManager) finishClose() { if !e.closed.CompareAndSwap(false, true) { return } + e.sinkLoad.Close() e.removeTaskHandles.Range(func(key, value interface{}) bool { handle := value.(*threadpool.TaskHandle) diff --git a/logservice/eventstore/event_store.go b/logservice/eventstore/event_store.go index ba4886afe4..746806b04a 100644 --- a/logservice/eventstore/event_store.go +++ b/logservice/eventstore/event_store.go @@ -247,6 +247,9 @@ type eventStore struct { tableCache *pebble.TableCache chs []*chann.UnlimitedChannel[eventWithCallback, uint64] writeTaskPools []*writeTaskPool + writeLoad *resource.Counter + readLoad *resource.Counter + nodeStats *resource.NodeStats gcManager *gcManager @@ -292,6 +295,7 @@ const ( func New( root string, subClient logpuller.SubscriptionClient, + nodeStats *resource.NodeStats, ) EventStore { dbPath := fmt.Sprintf("%s/%s", root, dataDir) @@ -307,6 +311,9 @@ func New( store := &eventStore{ pdClock: appcontext.GetService[pdutil.Clock](appcontext.DefaultPDClock), subClient: subClient, + writeLoad: nodeStats.NewCounter(resource.EventStoreWrite), + readLoad: nodeStats.NewCounter(resource.EventStoreRead), + nodeStats: nodeStats, dbs: dbs, pebbleCache: pebbleCache, @@ -367,6 +374,7 @@ func (p *writeTaskPool) run(ctx context.Context) { for i := 0; i < p.workerNum; i++ { go func(workerID int) { defer p.store.wg.Done() + writeLoad := p.store.writeLoad.Recorder() var compressionBuf []byte var rawValueBuf []byte encodeOpt := zstd.WithEncoderLevel(zstd.SpeedFastest) @@ -394,7 +402,7 @@ func (p *writeTaskPool) run(ctx context.Context) { queueDuration.Observe(float64(time.Now().UnixNano()-events[0].enqueueTimeNano) / float64(time.Second)) } start := time.Now() - if err = p.store.writeEvents(p.db, events, encoder, &compressionBuf, &rawValueBuf); err != nil { + if err = p.store.writeEvents(p.db, events, encoder, &compressionBuf, &rawValueBuf, writeLoad); err != nil { log.Panic("write events failed", zap.Error(err)) } ioWriteDuration.Observe(time.Since(start).Seconds()) @@ -465,6 +473,8 @@ func (e *eventStore) Close(_ context.Context) error { defer log.Info("event store closed") e.closed.Store(true) + defer e.writeLoad.Close() + defer e.readLoad.Close() for _, db := range e.dbs { if err := db.Close(); err != nil { @@ -1016,6 +1026,7 @@ func (e *eventStore) GetIterator(dispatcherID common.DispatcherID, request ScanR needCheckSpan := !stat.tableSpan.Equal(subStat.tableSpan) return &eventStoreIter{ + readLoad: e.readLoad.Recorder(), dispatcherID: dispatcherID, tableSpan: stat.tableSpan, needCheckSpan: needCheckSpan, @@ -1396,6 +1407,7 @@ func (e *eventStore) writeEvents( encoder *zstd.Encoder, compressionBuf *[]byte, rawValueBuf *[]byte, + writeLoad ...*resource.Recorder, ) error { eventStoreWriteRequestsCount.Inc() prepareStart := time.Now() @@ -1529,7 +1541,13 @@ func (e *eventStore) writeEvents( start := time.Now() err := batch.Commit(pebble.NoSync) if err == nil { - resource.EventStoreWriteBytes.Add(uint64(batchBytes)) + var recorder *resource.Recorder + if len(writeLoad) > 0 { + recorder = writeLoad[0] + } else { + recorder = e.writeLoad.Recorder() + } + recorder.Add(uint64(batchBytes)) } eventStoreWriteDurationHistogram.Observe(time.Since(start).Seconds()) return err @@ -1590,8 +1608,10 @@ func encodeDeferredEventKey( } type eventStoreIter struct { - dispatcherID common.DispatcherID - tableSpan *heartbeatpb.TableSpan + readLoad *resource.Recorder + pendingReadBytes uint64 + dispatcherID common.DispatcherID + tableSpan *heartbeatpb.TableSpan // true when need check whether data from `innerIter` is in `tableSpan` // (e.g. subscription span is not the same as dispatcher span) needCheckSpan bool @@ -1622,11 +1642,12 @@ func (iter *eventStoreIter) NextWithScanPosition() (*common.RawKVEntry, ScanPosi var scanPosition ScanPosition for { if !iter.innerIter.Valid() { + iter.flushReadLoad() return nil, nil, false } key := iter.innerIter.Key() value := iter.innerIter.Value() - resource.EventStoreReadBytes.Add(uint64(len(key) + len(value))) + iter.recordReadLoad(uint64(len(key)) + uint64(len(value))) if KeyUsesEncryptionLayer(key) { if iter.encryptionManager == nil { @@ -1694,10 +1715,34 @@ func (iter *eventStoreIter) NextWithScanPosition() (*common.RawKVEntry, ScanPosi startTime := time.Now() iter.innerIter.Next() metricEventStoreNextReadDurationHistogram.Observe(time.Since(startTime).Seconds()) + iter.flushReadLoad() return rawKV, scanPosition, isNewTxn } +// Batch read accounting locally; do not contend on a node-wide atomic per row. +// The remainder is bounded below 64 KiB and flushed when Next returns or closes. +func (iter *eventStoreIter) recordReadLoad(bytes uint64) { + const batchBytes = 64 << 10 + if bytes >= batchBytes { + iter.flushReadLoad() + iter.readLoad.Add(bytes) + return + } + iter.pendingReadBytes += bytes // Both operands are below batchBytes. + if iter.pendingReadBytes >= batchBytes { + iter.flushReadLoad() + } +} + +func (iter *eventStoreIter) flushReadLoad() { + if iter.pendingReadBytes != 0 { + iter.readLoad.Add(iter.pendingReadBytes) + iter.pendingReadBytes = 0 + } +} + func (iter *eventStoreIter) Close() (int64, error) { + iter.flushReadLoad() if iter.innerIter == nil { log.Info("event store close nil iter", zap.Uint64("tableID", uint64(iter.tableSpan.TableID)), diff --git a/logservice/eventstore/event_store_test.go b/logservice/eventstore/event_store_test.go index 890101fb45..5389195001 100644 --- a/logservice/eventstore/event_store_test.go +++ b/logservice/eventstore/event_store_test.go @@ -153,7 +153,7 @@ func newEventStoreForTest(path string) (logpuller.SubscriptionClient, EventStore mc := messaging.NewMockMessageCenter() appcontext.SetService(appcontext.MessageCenter, mc) subClient := NewMockSubscriptionClient() - store := New(path, subClient) + store := New(path, subClient, resource.NewNodeStats()) return subClient, store } @@ -1659,7 +1659,10 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { }} beforeMetric := testutil.ToFloat64(eventStoreCompressedRowsCount) - beforeWrite := resource.EventStoreWriteBytes.Load() + sampleTime := time.Now() + beforeLoad, valid := resource.Counters(store.nodeStats.Snapshot(sampleTime)) + require.True(t, valid) + beforeWrite := beforeLoad[resource.EventStoreWrite] beforeWriteMetric := testutil.ToFloat64(eventStoreWriteBytes) encoder, err := zstd.NewWriter(nil) @@ -1671,7 +1674,7 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { require.NoError(t, err) afterMetric := testutil.ToFloat64(eventStoreCompressedRowsCount) require.InDelta(t, float64(len(expectedValues)), afterMetric-beforeMetric, 1e-9) - require.Equal(t, uint64(testutil.ToFloat64(eventStoreWriteBytes)-beforeWriteMetric), resource.EventStoreWriteBytes.Load()-beforeWrite) + require.Equal(t, uint64(testutil.ToFloat64(eventStoreWriteBytes)-beforeWriteMetric), eventStoreLoad(t, store.nodeStats, sampleTime.Add(resource.SampleInterval), resource.EventStoreWrite)-beforeWrite) innerIter, err := store.dbs[0].NewIter(&pebble.IterOptions{}) require.NoError(t, err) @@ -1679,9 +1682,11 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { for innerIter.First(); innerIter.Valid(); innerIter.Next() { encodedBytes += uint64(len(innerIter.Key()) + len(innerIter.Value())) } - beforeRead := resource.EventStoreReadBytes.Load() + sampleTime = sampleTime.Add(2 * resource.SampleInterval) + beforeRead := eventStoreLoad(t, store.nodeStats, sampleTime, resource.EventStoreRead) decoder := store.decoderPool.Get().(*zstd.Decoder) iter := &eventStoreIter{ + readLoad: store.readLoad.Recorder(), tableSpan: &heartbeatpb.TableSpan{ TableID: 1, StartKey: []byte{}, @@ -1693,6 +1698,7 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { decoderPool: store.decoderPool, } require.True(t, iter.innerIter.First()) + firstReadBytes := uint64(len(iter.innerIter.Key()) + len(iter.innerIter.Value())) type readRecord struct { entry *common.RawKVEntry @@ -1704,6 +1710,11 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { if !ok { break } + if len(records) == 0 { + require.Equal(t, firstReadBytes, + eventStoreLoad(t, store.nodeStats, sampleTime.Add(resource.SampleInterval), resource.EventStoreRead)-beforeRead, + "a returned row must be visible without waiting for iterator close") + } for key, rec := range records { require.Equal(t, rec.expected, rec.entry.Value, "value mutated for %s", key) } @@ -1717,7 +1728,7 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { } } require.Len(t, records, len(expectedValues)) - require.Equal(t, encodedBytes, resource.EventStoreReadBytes.Load()-beforeRead, "read load must use compressed stored bytes") + require.Equal(t, encodedBytes, eventStoreLoad(t, store.nodeStats, sampleTime.Add(2*resource.SampleInterval), resource.EventStoreRead)-beforeRead, "read load must use compressed stored bytes") rowCount, err := iter.Close() require.NoError(t, err) require.Equal(t, int64(len(expectedValues)), rowCount) @@ -1730,14 +1741,37 @@ func TestEventStoreCompressionAndIterDecodeBufferReuse(t *testing.T) { iter.needCheckSpan = true iter.tableSpan.StartKey, iter.tableSpan.EndKey = []byte{0xFF}, []byte{0xFF, 0xFF} require.True(t, iter.innerIter.First()) - beforeRead = resource.EventStoreReadBytes.Load() + sampleTime = sampleTime.Add(3 * resource.SampleInterval) + beforeRead = eventStoreLoad(t, store.nodeStats, sampleTime, resource.EventStoreRead) entry, _ := iter.Next() require.Nil(t, entry) - require.Equal(t, encodedBytes, resource.EventStoreReadBytes.Load()-beforeRead) + require.Equal(t, encodedBytes, eventStoreLoad(t, store.nodeStats, sampleTime.Add(resource.SampleInterval), resource.EventStoreRead)-beforeRead) _, err = iter.Close() require.NoError(t, err) } +func TestEventStoreReadLoadBatchAndClose(t *testing.T) { + stats := resource.NewNodeStats() + counter := stats.NewCounter(resource.EventStoreRead) + iter := &eventStoreIter{readLoad: counter.Recorder(), tableSpan: &heartbeatpb.TableSpan{}} + now := time.Now() + for range 63 { + iter.recordReadLoad(1024) + } + require.Zero(t, eventStoreLoad(t, stats, now, resource.EventStoreRead)) + iter.recordReadLoad(1024) + now = now.Add(resource.SampleInterval) + require.Equal(t, uint64(64<<10), eventStoreLoad(t, stats, now, resource.EventStoreRead)) + iter.recordReadLoad(123) + _, err := iter.Close() + require.NoError(t, err) + _, err = iter.Close() + require.NoError(t, err) + counter.Close() + now = now.Add(resource.SampleInterval) + require.Equal(t, uint64(64<<10)+123, eventStoreLoad(t, stats, now, resource.EventStoreRead)) +} + func TestEventStoreFailedWriteDoesNotRecordLoad(t *testing.T) { dir := t.TempDir() db, err := pebble.Open(dir, &pebble.Options{}) @@ -1749,13 +1783,13 @@ func TestEventStoreFailedWriteDoesNotRecordLoad(t *testing.T) { encoder, err := zstd.NewWriter(nil) require.NoError(t, err) defer encoder.Close() - before := resource.EventStoreWriteBytes.Load() - store := &eventStore{} + stats := resource.NewNodeStats() + store := &eventStore{writeLoad: stats.NewCounter(resource.EventStoreWrite)} err = store.writeEvents(db, []eventWithCallback{{subID: 1, tableID: 1, kvs: []common.RawKVEntry{ {OpType: common.OpTypePut, StartTs: 1, CRTs: 2, Key: []byte("key"), Value: []byte("value")}, }}}, encoder, nil, nil) require.ErrorIs(t, err, pebble.ErrReadOnly) - require.Equal(t, before, resource.EventStoreWriteBytes.Load()) + require.Zero(t, eventStoreLoad(t, stats, time.Now(), resource.EventStoreWrite)) } func TestEventStoreLargeBatchWriteLoad(t *testing.T) { @@ -1777,12 +1811,12 @@ func TestEventStoreLargeBatchWriteLoad(t *testing.T) { encoder, err := zstd.NewWriter(nil) require.NoError(t, err) defer encoder.Close() - before := resource.EventStoreWriteBytes.Load() - store := &eventStore{} + stats := resource.NewNodeStats() + store := &eventStore{writeLoad: stats.NewCounter(resource.EventStoreWrite)} require.NoError(t, store.writeEvents(db, []eventWithCallback{{ subID: 1, tableID: 1, kvs: []common.RawKVEntry{entry}, }}, encoder, nil, nil)) - require.Equal(t, expectedBytes, resource.EventStoreWriteBytes.Load()-before) + require.Equal(t, expectedBytes, eventStoreLoad(t, stats, time.Now(), resource.EventStoreWrite)) } func TestEventStoreKVEntryCount(t *testing.T) { @@ -1858,6 +1892,7 @@ func TestEventStoreIterReadsLegacyCompressedValuesWithEncryptionManager(t *testi require.NoError(t, err) decoder := store.decoderPool.Get().(*zstd.Decoder) iter := &eventStoreIter{ + readLoad: store.readLoad.Recorder(), tableSpan: &heartbeatpb.TableSpan{ TableID: 1, StartKey: []byte{}, @@ -2238,3 +2273,10 @@ func TestEventStoreIter_NextWithFiltering(t *testing.T) { require.NoError(t, os.RemoveAll(dir)) } } + +func eventStoreLoad(t *testing.T, stats *resource.NodeStats, now time.Time, kind resource.Type) uint64 { + t.Helper() + counters, valid := resource.Counters(stats.Snapshot(now)) + require.True(t, valid) + return counters[kind] +} diff --git a/maintainer/maintainer_manager.go b/maintainer/maintainer_manager.go index 801faae116..1a701936dd 100644 --- a/maintainer/maintainer_manager.go +++ b/maintainer/maintainer_manager.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/ticdc/pkg/liveness" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/node" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/writelease" "github.com/pingcap/ticdc/server/watcher" "go.uber.org/zap" @@ -56,6 +57,7 @@ type Manager struct { // node holds node-scoped liveness and drain state that applies to the whole capture. node *managerNodeState nodeLoads *replica.NodeLoadTracker + nodeStats *resource.NodeStats // maintainers holds changefeed-scoped state and lifecycle operations. maintainers *managerMaintainerSet writeGate *writelease.Gate @@ -103,6 +105,7 @@ func NewMaintainerManager( return nil }, } + m.nodeStats, _ = appcontext.TryGetService[*resource.NodeStats](appcontext.NodeResourceStats) m.maintainers.nodeLoads = m.nodeLoads mc.RegisterHandler(messaging.MaintainerManagerTopic, m.recvMessages) diff --git a/maintainer/maintainer_manager_node.go b/maintainer/maintainer_manager_node.go index f7844742c8..f26cfac88c 100644 --- a/maintainer/maintainer_manager_node.go +++ b/maintainer/maintainer_manager_node.go @@ -22,7 +22,6 @@ import ( "github.com/pingcap/ticdc/pkg/liveness" "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/node" - "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/writelease" "go.uber.org/zap" ) @@ -113,7 +112,7 @@ func (m *Manager) sendNodeHeartbeat(force bool) { WriteLeaseRequestSeq: requestSeq, WriteLeaseProtocolVersion: heartbeatpb.CurrentWriteLeaseProtocolVersion, WriteLeaseWitnessAck: m.node.pendingWitnessAck, - NodeLoad: resource.Snapshot(), + NodeLoad: m.nodeStats.Snapshot(now), } target := m.newCoordinatorTopicMessage(hb) if err := m.mc.SendCommand(target); err != nil { diff --git a/maintainer/node_liveness_test.go b/maintainer/node_liveness_test.go index a057278e0d..140c40d89a 100644 --- a/maintainer/node_liveness_test.go +++ b/maintainer/node_liveness_test.go @@ -313,6 +313,7 @@ func TestNodeHeartbeatResponseRenewsP2PWriteLease(t *testing.T) { var nodeLiveness liveness.Liveness m := NewMaintainerManager(&node.Info{ID: node.ID("n1")}, &config.SchedulerConfig{}, &nodeLiveness) + m.nodeStats = resource.NewNodeStats() m.coordinatorID = node.ID("coordinator") m.coordinatorVersion = 10 gate.SetP2PRequired(true) diff --git a/pkg/common/context/app_context.go b/pkg/common/context/app_context.go index 26c7b5c142..e4f008190d 100644 --- a/pkg/common/context/app_context.go +++ b/pkg/common/context/app_context.go @@ -40,6 +40,7 @@ const ( RegionCache = "RegionCache" KeyspaceManager = "keyspaceManager" CaptureWriteGate = "CaptureWriteGate" + NodeResourceStats = "NodeResourceStats" ) // Put all the global instances here. diff --git a/pkg/scheduler/resource/load.go b/pkg/scheduler/resource/load.go index ea7024937a..172f2898f9 100644 --- a/pkg/scheduler/resource/load.go +++ b/pkg/scheduler/resource/load.go @@ -18,7 +18,6 @@ package resource import ( "math" "slices" - "sync/atomic" "github.com/pingcap/ticdc/heartbeatpb" ) @@ -35,41 +34,6 @@ const ( // not interchangeable and must never be added into one raw traffic score. type Load map[Type]float64 -var ( - // SinkBytes counts flushed DML event sizes, matching dispatcher samples. - SinkBytes atomic.Uint64 - // EventStoreWriteBytes counts successfully committed Pebble batch bytes. - EventStoreWriteBytes atomic.Uint64 - // EventStoreReadBytes counts encoded keys and values visited by iterators, - // including rows filtered by a shared subscription's span. Cache hits count - // as reads; these counters do not represent physical disk IO or compaction. - EventStoreReadBytes atomic.Uint64 - - counters = []struct { - resource Type - total *atomic.Uint64 - }{ - {Sink, &SinkBytes}, - {EventStoreWrite, &EventStoreWriteBytes}, - {EventStoreRead, &EventStoreReadBytes}, - } -) - -// Snapshot never consumes counters or per-dispatcher sampling windows. Add a -// resource to the protocol and this list when wiring another byte counter; -// coordinator sampling and target screening operate on the vector generically. -func Snapshot() *heartbeatpb.NodeLoad { - load := &heartbeatpb.NodeLoad{Resources: make([]*heartbeatpb.ResourceUsage, 0, len(counters))} - for _, counter := range counters { - value := counter.total.Load() - load.Resources = append(load.Resources, &heartbeatpb.ResourceUsage{Resource: counter.resource, TotalBytes: value}) - if counter.resource == Sink { - load.FlushedEventBytes = value - } - } - return load -} - // Counters accepts legacy sink-only reports. A missing resource is unsupported, // not an observed zero. Invalid vectors cannot be used for scheduling. func Counters(load *heartbeatpb.NodeLoad) (map[Type]uint64, bool) { diff --git a/pkg/scheduler/resource/load_test.go b/pkg/scheduler/resource/load_test.go index 4546ca9e20..f2243dd0cf 100644 --- a/pkg/scheduler/resource/load_test.go +++ b/pkg/scheduler/resource/load_test.go @@ -17,6 +17,7 @@ package resource import ( "math" "testing" + "time" "github.com/pingcap/ticdc/heartbeatpb" "github.com/stretchr/testify/require" @@ -35,19 +36,21 @@ func TestResourceLoadProtocol(t *testing.T) { require.Equal(t, expected, rates) require.Equal(t, float64(100), decoded.BytesPerSecond, "legacy readers still see sink rate") - before, valid := Counters(Snapshot()) + stats := NewNodeStats() + now := time.Now() + before, valid := Counters(stats.Snapshot(now)) require.True(t, valid) - SinkBytes.Add(10) - EventStoreWriteBytes.Add(20) - EventStoreReadBytes.Add(30) - snapshot := Snapshot() + stats.NewCounter(Sink).Recorder().Add(10) + stats.NewCounter(EventStoreWrite).Recorder().Add(20) + stats.NewCounter(EventStoreRead).Recorder().Add(30) + snapshot := stats.Snapshot(now.Add(SampleInterval)) after, valid := Counters(snapshot) require.True(t, valid) require.Equal(t, before[Sink]+10, after[Sink]) require.Equal(t, before[EventStoreWrite]+20, after[EventStoreWrite]) require.Equal(t, before[EventStoreRead]+30, after[EventStoreRead]) require.Equal(t, after[Sink], snapshot.FlushedEventBytes) - again, valid := Counters(Snapshot()) + again, valid := Counters(stats.Snapshot(now.Add(2 * SampleInterval))) require.True(t, valid) require.Equal(t, after, again, "sampling must not reset process counters") diff --git a/pkg/scheduler/resource/stats.go b/pkg/scheduler/resource/stats.go new file mode 100644 index 0000000000..3db7b16eb7 --- /dev/null +++ b/pkg/scheduler/resource/stats.go @@ -0,0 +1,153 @@ +// Copyright 2026 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, +// 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 resource + +import ( + "slices" + "sync" + "sync/atomic" + "time" + + "github.com/pingcap/ticdc/heartbeatpb" +) + +const ( + // SampleInterval bounds full-node aggregation, including forced heartbeats. + SampleInterval = time.Second + counterShards = 16 +) + +// NodeStats belongs to one capture. Components own counters; heartbeats reuse +// a cached aggregate instead of scanning dispatchers or recalculating per send. +type NodeStats struct { + mu sync.Mutex + counters map[*Counter]struct{} + totals map[Type]uint64 + kinds []Type + cached []uint64 + sampledAt time.Time +} + +// NewNodeStats creates isolated resource accounting for one capture. +func NewNodeStats() *NodeStats { + return &NodeStats{ + counters: make(map[*Counter]struct{}), + totals: map[Type]uint64{Sink: 0, EventStoreWrite: 0, EventStoreRead: 0}, + kinds: []Type{Sink, EventStoreWrite, EventStoreRead}, + } +} + +// Counter is one component's resource counter, with a fixed number of shards. +// Register components, not individual dispatchers or short-lived iterators. +type Counter struct { + node *NodeStats + kind Type + next atomic.Uint64 + closed atomic.Bool + shards [counterShards]Recorder +} + +// Recorder is selected once when a writer is created. Padding keeps independent +// writers from contending on one cache line on common 64-byte-line platforms. +type Recorder struct { + value atomic.Uint64 + previous uint64 // only accessed under NodeStats.mu + _ [48]byte +} + +// NewCounter registers a component's counter for one resource dimension. +func (s *NodeStats) NewCounter(kind Type) *Counter { + if s == nil { + return nil + } + counter := &Counter{node: s, kind: kind} + s.mu.Lock() + defer s.mu.Unlock() + if _, exists := s.totals[kind]; !exists { + s.totals[kind] = 0 + s.kinds = append(s.kinds, kind) + slices.Sort(s.kinds) + // A newly added dimension needs a new complete sample. + s.sampledAt = time.Time{} + } + s.counters[counter] = struct{}{} + return counter +} + +// Recorder assigns a writer to a shard without registering the writer itself. +func (c *Counter) Recorder() *Recorder { + if c == nil || c.closed.Load() { + return nil + } + return &c.shards[(c.next.Add(1)-1)%counterShards] +} + +// Add records bytes in the writer's component shard. +func (r *Recorder) Add(bytes uint64) { + if r != nil { + r.value.Add(bytes) + } +} + +// Close preserves the component's final contribution and unregisters its shards. +// The owner must stop its writers before closing, as with its other resources. +func (c *Counter) Close() { + if c == nil || !c.closed.CompareAndSwap(false, true) { + return + } + c.node.mu.Lock() + defer c.node.mu.Unlock() + c.node.collect(c) + delete(c.node.counters, c) +} + +func (s *NodeStats) collect(c *Counter) { + for i := range c.shards { + shard := &c.shards[i] + current := shard.value.Load() + // Subtract integers before conversion to floating-point rates, preserving + // small deltas above 2^53. + s.totals[c.kind] += current - shard.previous + shard.previous = current + } +} + +// Snapshot returns independent wire data, reusing totals sampled within a second. +func (s *NodeStats) Snapshot(now time.Time) *heartbeatpb.NodeLoad { + if s == nil { + return nil + } + s.mu.Lock() + defer s.mu.Unlock() + if s.sampledAt.IsZero() || now.Sub(s.sampledAt) >= SampleInterval { + for counter := range s.counters { + s.collect(counter) + } + s.cached = s.cached[:0] + for _, kind := range s.kinds { + s.cached = append(s.cached, s.totals[kind]) + } + s.sampledAt = now + } + load := &heartbeatpb.NodeLoad{Resources: make([]*heartbeatpb.ResourceUsage, 0, len(s.kinds))} + for i, kind := range s.kinds { + value := s.cached[i] + load.Resources = append(load.Resources, &heartbeatpb.ResourceUsage{Resource: kind, TotalBytes: value}) + if kind == Sink { + load.FlushedEventBytes = value + } + } + return load +} diff --git a/pkg/scheduler/resource/stats_test.go b/pkg/scheduler/resource/stats_test.go new file mode 100644 index 0000000000..42a7cd87ec --- /dev/null +++ b/pkg/scheduler/resource/stats_test.go @@ -0,0 +1,124 @@ +// Copyright 2026 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, +// 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 resource + +import ( + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestNodeStatsLifecycleAndSampling(t *testing.T) { + stats, other := NewNodeStats(), NewNodeStats() + counter := stats.NewCounter(Sink) + first, second := counter.Recorder(), counter.Recorder() + now := time.Now() + require.Zero(t, stats.Snapshot(now).FlushedEventBytes) + first.Add(100) + second.Add(200) + require.Zero(t, stats.Snapshot(now.Add(SampleInterval-time.Nanosecond)).FlushedEventBytes) + load := stats.Snapshot(now.Add(SampleInterval)) + require.Equal(t, uint64(300), load.FlushedEventBytes) + load.FlushedEventBytes, load.Resources[0].TotalBytes = 999, 999 + require.Equal(t, uint64(300), stats.Snapshot(now.Add(SampleInterval)).FlushedEventBytes) + require.Zero(t, other.Snapshot(now).FlushedEventBytes, "captures must be isolated") + + first.Add(50) + counter.Close() + counter.Close() + require.Empty(t, stats.counters) + require.Nil(t, counter.Recorder()) + require.Equal(t, uint64(300), stats.Snapshot(now.Add(SampleInterval)).FlushedEventBytes, + "retirement must not force extra sampling") + require.Equal(t, uint64(350), stats.Snapshot(now.Add(2*SampleInterval)).FlushedEventBytes) + replacement := stats.NewCounter(Sink) + replacement.Recorder().Add(25) + require.Equal(t, uint64(375), stats.Snapshot(now.Add(3*SampleInterval)).FlushedEventBytes) +} + +func TestNodeStatsIntegerPrecision(t *testing.T) { + stats := NewNodeStats() + recorder := stats.NewCounter(Sink).Recorder() + now := time.Now() + recorder.Add(1 << 54) + require.Equal(t, uint64(1<<54), stats.Snapshot(now).FlushedEventBytes) + recorder.Add(1) + require.Equal(t, uint64(1<<54)+1, stats.Snapshot(now.Add(SampleInterval)).FlushedEventBytes) +} + +func TestNodeStatsConcurrentCollection(t *testing.T) { + stats := NewNodeStats() + counter := stats.NewCounter(Sink) + const writers, iterations = 32, 2000 + var wg sync.WaitGroup + for range writers { + recorder := counter.Recorder() + wg.Go(func() { + for range iterations { + recorder.Add(7) + } + }) + } + now := time.Now() + for i := range 100 { + stats.Snapshot(now.Add(time.Duration(i) * SampleInterval)) + } + wg.Wait() + counter.Close() + require.Equal(t, uint64(writers*iterations*7), stats.Snapshot(now.Add(101*SampleInterval)).FlushedEventBytes) +} + +func BenchmarkResourceRecord(b *testing.B) { + b.Run("sharedAtomic", func(b *testing.B) { + var counter atomic.Uint64 + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + counter.Add(100) + } + }) + }) + b.Run("componentShards", func(b *testing.B) { + counter := NewNodeStats().NewCounter(Sink) + b.RunParallel(func(pb *testing.PB) { + recorder := counter.Recorder() + for pb.Next() { + recorder.Add(100) + } + }) + }) +} + +func BenchmarkNodeStatsSnapshot(b *testing.B) { + stats := NewNodeStats() + for range 1000 { + stats.NewCounter(Sink).Recorder().Add(100) + } + now := time.Now() + stats.Snapshot(now) + b.Run("cached", func(b *testing.B) { + for i := 0; i < b.N; i++ { + stats.Snapshot(now) + } + }) + b.Run("collect1000Components", func(b *testing.B) { + for i := 0; i < b.N; i++ { + now = now.Add(SampleInterval) + stats.Snapshot(now) + } + }) +} diff --git a/server/server.go b/server/server.go index 0128522081..752a29e2bb 100644 --- a/server/server.go +++ b/server/server.go @@ -42,6 +42,7 @@ import ( "github.com/pingcap/ticdc/pkg/messaging" "github.com/pingcap/ticdc/pkg/node" "github.com/pingcap/ticdc/pkg/pdutil" + "github.com/pingcap/ticdc/pkg/scheduler/resource" "github.com/pingcap/ticdc/pkg/security" tiserver "github.com/pingcap/ticdc/pkg/server" "github.com/pingcap/ticdc/pkg/tcpserver" @@ -215,7 +216,8 @@ func (c *server) initialize(ctx context.Context) error { txnutil.NewLockerResolver(), c.security, ) - eventStore := eventstore.New(conf.DataDir, subscriptionClient) + eventStore := eventstore.New(conf.DataDir, subscriptionClient, + appctx.GetService[*resource.NodeStats](appctx.NodeResourceStats)) eventService := eventservice.New(eventStore, schemaStore, &c.liveness) c.upstreamManager = upstream.NewManager(ctx, upstream.NodeTopologyCfg{ Info: c.info, @@ -262,6 +264,7 @@ func (c *server) initialize(ctx context.Context) error { func (c *server) setPreServices(ctx context.Context) error { // Set ID to Global Context appctx.SetID(c.info.ID.String()) + appctx.SetService(appctx.NodeResourceStats, resource.NewNodeStats()) c.writeGate = writelease.NewGate() appctx.SetService(appctx.CaptureWriteGate, c.writeGate) From d92790ab69b438ddee5a4b25b7eb500b712ec899 Mon Sep 17 00:00:00 2001 From: wk989898 Date: Wed, 25 Nov 2026 09:07:43 +0000 Subject: [PATCH 6/7] . Signed-off-by: wk989898 --- coordinator/node_load_test.go | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/coordinator/node_load_test.go b/coordinator/node_load_test.go index 29fbeaf5c9..a33c5fdd3b 100644 --- a/coordinator/node_load_test.go +++ b/coordinator/node_load_test.go @@ -14,7 +14,6 @@ package coordinator import ( - "math" "testing" "time" @@ -24,29 +23,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestNodeLoadReestablishesBaselineAfterStatsRollover(t *testing.T) { - stats := resource.NewNodeStats() - recorder := stats.NewCounter(resource.Sink).Recorder() - now := time.Now() - var state nodeLoadState - recorder.Add(math.MaxUint64 - 7) - state.observe(stats.Snapshot(now), now) - recorder.Add(3) - now = now.Add(resource.SampleInterval) - state.observe(stats.Snapshot(now), now) - require.True(t, state.available) - require.Equal(t, float64(3), state.rates[resource.Sink]) - recorder.Add(8) - now = now.Add(resource.SampleInterval) - state.observe(stats.Snapshot(now), now) - require.False(t, state.available, "rollover must not look idle or produce an enormous rate") - recorder.Add(5) - now = now.Add(resource.SampleInterval) - state.observe(stats.Snapshot(now), now) - require.True(t, state.available) - require.Equal(t, float64(5), state.rates[resource.Sink]) -} - func TestNodeLoadHeartbeatSnapshot(t *testing.T) { now := time.Unix(100, 0) c := newCaptureWriteLeaseController(10, "coordinator") From 784bfb26ae39f40adf0ad6092174a0407c5f7c60 Mon Sep 17 00:00:00 2001 From: wk989898 Date: Wed, 25 Nov 2026 10:26:04 +0000 Subject: [PATCH 7/7] update doc Signed-off-by: wk989898 --- ...026-11-24-ticdc-node-resource-balancing.md | 145 ++++++++++++++++-- 1 file changed, 131 insertions(+), 14 deletions(-) diff --git a/docs/design/2026-11-24-ticdc-node-resource-balancing.md b/docs/design/2026-11-24-ticdc-node-resource-balancing.md index 596cc24bd2..e4b7b7e9d1 100644 --- a/docs/design/2026-11-24-ticdc-node-resource-balancing.md +++ b/docs/design/2026-11-24-ticdc-node-resource-balancing.md @@ -46,9 +46,10 @@ optimizer or a bounded convergence time. ```mermaid flowchart LR subgraph Capture[Each capture] - ES[EventStore reads and writes] --> Counters[Atomic resource counters] + ES[EventStore reads and writes] --> Counters[Component counters: 16 shards each] Sink[Successful sink flushes] --> Counters - Counters --> Manager[Maintainer Manager] + Counters --> Stats[NodeStats: cached node totals] + Stats --> Manager[Maintainer Manager] Manager --> Tracker[Shared immutable node view] Tracker --> Maintainers[Maintainers for local changefeeds] Details[Per-dispatcher complete heartbeats] --> Maintainers @@ -65,8 +66,9 @@ runs on a capture. | Owner | State and responsibility | | --- | --- | -| Resource producers | Process-wide cumulative counters; updates do not consume dispatcher samples. | -| Maintainer Manager | Reports local counters even when no changefeed Maintainer is hosted locally; validates Coordinator responses. | +| Resource producers | Component-owned cumulative counters; writers select a shard once and update it at the measurement boundary. | +| `NodeStats` | One capture-owned registry, integer aggregation baselines, node totals, and a cached sample; retains retired components' contributions. | +| Maintainer Manager | Reports cached node totals even when no changefeed Maintainer is hosted locally; validates Coordinator responses. | | Coordinator | Stores counter baselines and smoothed rates by capture, then publishes node totals and availability. | | `NodeLoadTracker` | Shares one immutable view among local Maintainers and their normal/redo span controllers. | | Maintainer | Owns its changefeed's dispatcher details and temporary migration projections. | @@ -103,6 +105,8 @@ continue using observations until the next accepted sample. `pkg/scheduler/resource.Load` maps `ResourceType` to a nonnegative rate. Each dimension is evaluated independently against its own cluster average; raw byte rates from different pipeline stages are never added into one traffic score. +`load.go` defines types and wire conversions. `stats.go` owns local collection; +there are no exported package-global byte counters. | Resource type | Measurement point | Meaning | | --- | --- | --- | @@ -116,6 +120,60 @@ event-size accounting is also distinct from downstream protocol or socket bytes. Existing Prometheus byte metrics can have different accounting boundaries and should not be substituted without checking their definitions. +### Capture ownership and component shards + +Server creates one `NodeStats` per capture in `setPreServices` and registers it +as `NodeResourceStats` in the existing application service context. It is passed +explicitly to EventStore; Maintainer Manager and DispatcherManager obtain the +same instance during construction. Hot paths retain their recorder pointers +instead of looking up a service on each event. + +Each DispatcherManager registers one sink `Counter`, shared by its normal and +redo dispatchers. EventStore registers separate write and read counters. Each +counter has 16 fixed shards. A write worker, dispatcher, or iterator chooses a +recorder once at creation; writers can share a shard when their count exceeds +16. Shard padding reduces contention between independent shard updates on common +64-byte-cache-line platforms. + +The node registry contains component counters, not every dispatcher or +short-lived iterator. EventStore reads first accumulate in the iterator's own +goroutine, then update its recorder at 64 KiB, when `Next` returns, or at close. +Filtered records can be combined without delaying a successfully returned row +until iterator shutdown. Writes record the committed batch size; sink updates +occur in the existing successful-flush callback. + +### On-demand aggregation and retirement + +For component `c`, shard `s`, and resource `r`, local aggregation uses integer +deltas: + +```text +delta[c,s] = current[c,s] - previously_collected[c,s] +node_total[r] += sum(delta[c,s] for counters of resource r) +``` + +Reading a shard never clears it. Integer subtraction precedes conversion to +floating-point rates, preserving small increments in large cumulative values. + +`NodeStats.Snapshot(now)` performs a full collection on the first call, after +cache invalidation, or when at least one second has elapsed since the last +collection. Other calls reuse the cached totals and construct independent +protobuf objects. There is +no separate sampling goroutine and no promise of refresh at each wall-clock +second: aggregation is driven by heartbeat requests. Registering an already +known resource or retiring a component does not force a full collection. Adding +a previously unknown resource dimension invalidates the cache so that the next +snapshot includes a complete vector. + +The component owner must stop its writers and flush iterator remainders before +calling `Counter.Close`. Retirement collects that component's final delta and +removes its shards under the node lock. The accumulated node total retains its +contribution without keeping a registry entry for every retired component. +Repeated close is harmless; the cached wire sample reflects the contribution +at the next normal refresh. DispatcherManager retires its counter after its +shutdown wait, while EventStore defers retirement to its close path. These +calls do not themselves join arbitrary outstanding recorder writers. + ### Batch lifetime and dispatcher sample lifetime Pebble can transfer ownership of a large batch's backing data during `Commit`. @@ -135,7 +193,7 @@ The existing dispatcher contract distinguishes: | --- | --- | | `0` | No usable recent sample; reject resource-aware count moves for this dispatcher. | | `1` | Idle sentinel; use zero traffic cost for count moves and exclude it from traffic-initiated moves. | -| `> 1` | Sampled sink event-size rate used as migration cost. | +| Other positive values | Sampled sink event-size rate; traffic-initiated moves require the raw value to exceed one. | ### Wire representation @@ -156,6 +214,11 @@ Coordinator-version checks; it does not add a migration-approval protocol. ## 4. Sampling, smoothing, and freshness +There are three calculation stages: `NodeStats` aggregates local integer +counters, Coordinator derives node rates and smoothing, and each Maintainer +computes resource averages and migration constraints. The resource package +does not run the balancing policy or compute node rates. + For cumulative counter `C[n,r]`, the Coordinator derives the instantaneous rate for resource `r` on node `n` from two accepted observations: @@ -173,6 +236,7 @@ asynchronous flushes and workload steps. | Timing | Current value | Role | | --- | --- | --- | | Capture heartbeat cadence | 500 ms | Existing heartbeat throttle; execution and transport can delay actual arrival. | +| Full local component aggregation | At least 1 s between collections | Heartbeat-driven cache refresh for a stable resource set; extra sends reuse totals. | | Minimum accepted counter interval | 1 s | Extra witness/drain heartbeats do not replace a useful rate window with tiny deltas. | | Coordinator node-sample freshness | 5 s | Reject stale baselines and cluster views. | | Local node-view freshness | 5 s | A Maintainer stops resource-aware balancing when responses stop arriving. | @@ -308,14 +372,16 @@ before its new placement is observable. The one-move limit applies to traffic-initiated moves. Count balancing retains its configured batch behavior, and count moves do not start a traffic cooldown. Basic scheduling and drain operations retain their own limits and are not -globally serialized by this state. The existing `balance-move-batch-size` +globally serialized by this state. Split-group balancing is also separate; +default-group split checks run before the shared move-state check. The existing `balance-move-batch-size` defaults to 1,024 and covers split and move work for a default-group invocation. ## 6. Concurrency and failure boundaries | State | Access discipline | | --- | --- | -| Process resource counters | Atomic increments and loads; sampling never resets counters. | +| Component shard counters | Atomic increments and loads; iterator accumulation stays in its scan goroutine. | +| `NodeStats` registry, collection baselines, totals, and cache | Protected by a node mutex; wire snapshots own their protobuf objects. Retirement requires writers to have stopped first. | | Coordinator baselines and rates | Owned by its single event-handling goroutine. | | Local node resource view | `Replace` constructs fresh maps and publishes them with status/timestamp under `RWMutex`; returned snapshots are immutable by contract. | | Migration projection | Clones both the node map and each resource map before updates. | @@ -363,9 +429,11 @@ can ignore the new vector while retaining the scalar sink fields. To add another cumulative traffic resource: 1. Append a stable `ResourceType` value and regenerate the protobuf code. -2. Add a counter and register it in the resource snapshot list. +2. Declare its support in `NodeStats` initialization when idle captures must + advertise a zero value; create component counters with `NewCounter`. 3. Instrument a defined measurement boundary, checking buffer ownership and - failure semantics before choosing when to increment it. + failure semantics before choosing when to increment a recorder. Retire the + component counter only after its writers stop. 4. Reuse generic Coordinator rate sampling and common-dimension publication. 5. Verify destination screening, resets, stale data, mixed peers, and resource ownership with focused tests. @@ -376,6 +444,13 @@ contract before being added. A resource that should actively initiate moves also needs a cost model for the work being moved; registering a new counter alone does not provide one. +For `K` registered component-resource counters and `S = 16` shards per counter, +full local aggregation costs `O(K * S + R)` with `O(K * S + R)` stored state. +Cached wire snapshots cost `O(R)` to construct; retirement collects only the +closing counter's `S` shards. This work does not scale with the number of +dispatcher or iterator objects. Recorder assignment and byte updates are +constant-time operations, but concurrent writers can still share a shard. + The Coordinator stores `O(N * R)` state for `N` nodes and `R` resources. Each reply carries that node view, giving approximately `O(N^2 * R)` aggregate distribution volume across all nodes per reporting round. Local checks copy @@ -392,6 +467,9 @@ document. The following existing tests cover the main contracts: | Contract | Test location / example | | --- | --- | +| Capture isolation, cache cadence, retirement, precision, and concurrent collection | `pkg/scheduler/resource/stats_test.go`: `TestNodeStatsLifecycleAndSampling`, `TestNodeStatsIntegerPrecision`, `TestNodeStatsConcurrentCollection` | +| Normal/redo dispatchers share the component sink counter without consuming individual samples | `downstreamadapter/dispatcher/table_progress_test.go`: `TestDispatcherModesShareComponentResourceCounter`, `TestResourceCountersPreserveDispatcherSamples` | +| Iterator batching and final remainder accounting | `logservice/eventstore/event_store_test.go`: `TestEventStoreReadLoadBatchAndClose`, `TestEventStoreCompressionAndIterDecodeBufferReuse` | | Nine whole tables with initially concentrated hotspots | `maintainer/scheduler/balance_test.go`: `TestBalanceSchedulerBalancesWholeTableTraffic` | | Other changefeeds affect node totals | `TestBalanceSchedulerUsesNodeTotalsAcrossChangefeeds` | | Busy EventStore destinations are screened | `TestBalanceSchedulerAvoidsBusyEventStoreTargets` | @@ -407,13 +485,48 @@ For a focused run on a checkout containing the implementation, the repository test target enables failpoints and uses race detection plus `intest`: ```bash -make unit_test_pkg PKG='./coordinator/... ./maintainer/... ./logservice/eventstore ./pkg/scheduler/...' +make unit_test_pkg PKG='./pkg/scheduler/... ./coordinator/... ./maintainer/... ./downstreamadapter/dispatcher ./downstreamadapter/dispatchermanager ./logservice/eventstore ./server' ``` See [the validation guide](../agents/validation.md) for the repository test commands. The recorded totals below describe particular runs, not a fixed expected test count for this command. +### Collection validation and microbenchmarks + +The final collection simplification was checked with +`make unit_test_pkg PKG='./pkg/scheduler/resource ./downstreamadapter/dispatcher' P=2`: +82 tests passed with race detection, `intest`, and failpoints; incremental lint +reported zero issues. The Go source tree of that validated working copy matches +`d92790ab6`; the run preceded the commit. Earlier collection-refactor runs +covered the broader component set, EventStore regression cases, and a +successful `make cdc` build. +These are recorded implementation runs; this documentation update did not +rerun them or a live replication workload. + +A recorded collection microbenchmark on Linux/amd64, Intel Xeon Gold 6240, +used `GOMAXPROCS=8`, a 300 ms benchmark duration, and three repetitions: + +| Operation | Recorded range | +| --- | --- | +| Shared atomic update, comparison baseline | 18.8-21.9 ns/op | +| Component-shard update | 0.98-0.99 ns/op | +| Cached node snapshot | 147-179 ns/op | +| Full collection of 1,000 component counters | 193-203 microseconds/collection | + +These measurements were collected during the refactor, before its final +simplification, and have not been repeated at the documented commit. They +measure synthetic accounting cost and parallel throughput, not end-to-end CDC +performance or a guarantee for other CPUs and writer counts. Reproduce with: + +```bash +GOMAXPROCS=8 go test ./pkg/scheduler/resource -run '^$' \ + -bench 'Benchmark(ResourceRecord|NodeStatsSnapshot)$' \ + -benchmem -benchtime=300ms -count=3 +``` + +### Historical real-chain and protocol validation + A real-chain run of the multi-resource implementation at `8a71717eb` used one PD, one TiKV, one TiDB, three independent TiCDC processes, and MySQL 8.0.46 on one physical host. It retained default scheduling settings, disabled table @@ -441,8 +554,8 @@ covered concurrent snapshot publication/private projections and concurrent dispatcher binding/traffic updates. Twenty-seven protocol assertions used regenerated codecs from `9d8506167` -(sink-only load reporting), `b7e1a7058` (before node-load fields), and the current -snapshot. They checked both request/response directions, scalar compatibility, +(sink-only load reporting), `b7e1a7058` (before node-load fields), and +`09c351f60`. They checked both request/response directions, scalar compatibility, lease/witness metadata, missing load fields, and unknown resource dimensions. The namespace was changed only to load historical and current codecs in the same test process. @@ -451,6 +564,8 @@ The ten-minute real-chain run predates those review corrections and was not repeated on `09c351f60`. The runs establish the stated scheduling and correctness cases; they do not establish multi-host capacity, live mixed-version rolling upgrade safety, fault recovery, or convergence under arbitrary concurrent load. +The real-chain run also predates `NodeStats`; no equivalent live run was +recorded for the component-shard implementation described here. Useful additional acceptance scenarios are two changefeeds with one indivisible hot table each initially colocated, independently busy EventStore nodes, and @@ -460,11 +575,13 @@ rows rather than relying only on metric slopes or final dispatcher counts. ## 9. Source navigation -Inspect these paths at `09c351f60` using `git show :`: +Inspect these paths at `d92790ab6` using `git show :`: | Area | Source | | --- | --- | -| Resource types, counters, and conversion | `pkg/scheduler/resource/load.go`; `heartbeatpb/heartbeat.proto` | +| Resource types and conversion | `pkg/scheduler/resource/load.go`; `heartbeatpb/heartbeat.proto` | +| Capture-owned counters, shards, caching, and retirement | `pkg/scheduler/resource/stats.go` | +| Capture initialization and shared statistics wiring | `server/server.go`; `pkg/common/context/app_context.go`; `downstreamadapter/dispatchermanager/dispatcher_manager.go` | | Complete traffic period | `heartbeatpb/node_load.go`; `downstreamadapter/dispatchermanager/task.go` | | Sink flush accounting | `downstreamadapter/dispatcher/table_progress.go` | | EventStore accounting | `logservice/eventstore/event_store.go` |