From 82d4d19337f88b9633b243eca8bc978d3337892a Mon Sep 17 00:00:00 2001 From: XuanYang-cn Date: Fri, 17 Sep 2021 16:25:55 +0800 Subject: [PATCH] Remove not in use segmentCheckPoints (#8039) Resolves: #8037 Signed-off-by: yangxuan --- .../datanode/flow_graph_insert_buffer_node.go | 15 ++++++--------- .../flow_graph_insert_buffer_node_test.go | 15 --------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/internal/datanode/flow_graph_insert_buffer_node.go b/internal/datanode/flow_graph_insert_buffer_node.go index 99f5ece02a..7568c9f66d 100644 --- a/internal/datanode/flow_graph_insert_buffer_node.go +++ b/internal/datanode/flow_graph_insert_buffer_node.go @@ -65,9 +65,7 @@ type insertBufferNode struct { timeTickStream msgstream.MsgStream segmentStatisticsStream msgstream.MsgStream - dsSaveBinlog func(fu *segmentFlushUnit) error - segmentCheckPoints map[UniqueID]segmentCheckPoint - segmentCheckPointLock sync.Mutex + dsSaveBinlog func(fu *segmentFlushUnit) error } type segmentCheckPoint struct { @@ -891,11 +889,10 @@ func newInsertBufferNode( timeTickStream: wTtMsgStream, segmentStatisticsStream: segStatisticsMsgStream, - replica: replica, - flushMap: sync.Map{}, - flushChan: flushCh, - idAllocator: idAllocator, - dsSaveBinlog: saveBinlog, - segmentCheckPoints: make(map[UniqueID]segmentCheckPoint), + replica: replica, + flushMap: sync.Map{}, + flushChan: flushCh, + idAllocator: idAllocator, + dsSaveBinlog: saveBinlog, }, nil } diff --git a/internal/datanode/flow_graph_insert_buffer_node_test.go b/internal/datanode/flow_graph_insert_buffer_node_test.go index 4832f364ec..e5ea2a7c1d 100644 --- a/internal/datanode/flow_graph_insert_buffer_node_test.go +++ b/internal/datanode/flow_graph_insert_buffer_node_test.go @@ -469,13 +469,6 @@ func TestFlowGraphInsertBufferNode_AutoFlush(t *testing.T) { inMsg.startPositions = []*internalpb.MsgPosition{{Timestamp: 234}} inMsg.endPositions = []*internalpb.MsgPosition{{Timestamp: 345}} iBNode.Operate([]flowgraph.Msg{iMsg}) - assert.Equal(t, len(iBNode.segmentCheckPoints), 3) - assert.Equal(t, iBNode.segmentCheckPoints[1].numRows, int64(50+16000+100+32000)) - assert.Equal(t, iBNode.segmentCheckPoints[2].numRows, int64(100+32000)) - assert.Equal(t, iBNode.segmentCheckPoints[3].numRows, int64(0)) - assert.Equal(t, iBNode.segmentCheckPoints[1].pos.Timestamp, Timestamp(345)) - assert.Equal(t, iBNode.segmentCheckPoints[2].pos.Timestamp, Timestamp(234)) - assert.Equal(t, iBNode.segmentCheckPoints[3].pos.Timestamp, Timestamp(123)) assert.Equal(t, len(flushUnit), 2) assert.Equal(t, flushUnit[1].segID, int64(1)) @@ -511,11 +504,6 @@ func TestFlowGraphInsertBufferNode_AutoFlush(t *testing.T) { assert.Equal(t, len(flushSeg), 1) assert.Equal(t, flushSeg[0].FieldID, int64(1)) assert.NotNil(t, flushSeg[0].Binlogs) - assert.Equal(t, len(iBNode.segmentCheckPoints), 2) - assert.Equal(t, iBNode.segmentCheckPoints[2].numRows, int64(100+32000)) - assert.Equal(t, iBNode.segmentCheckPoints[3].numRows, int64(0)) - assert.Equal(t, iBNode.segmentCheckPoints[2].pos.Timestamp, Timestamp(234)) - assert.Equal(t, iBNode.segmentCheckPoints[3].pos.Timestamp, Timestamp(123)) assert.Equal(t, len(flushUnit), 3) assert.Equal(t, flushUnit[2].segID, int64(1)) @@ -545,9 +533,6 @@ func TestFlowGraphInsertBufferNode_AutoFlush(t *testing.T) { assert.Equal(t, len(flushSeg), 1) assert.Equal(t, flushSeg[0].FieldID, int64(3)) assert.NotNil(t, flushSeg[0].Binlogs) - assert.Equal(t, len(iBNode.segmentCheckPoints), 1) - assert.Equal(t, iBNode.segmentCheckPoints[2].numRows, int64(100+32000)) - assert.Equal(t, iBNode.segmentCheckPoints[2].pos.Timestamp, Timestamp(234)) assert.Equal(t, len(flushUnit), 4) assert.Equal(t, flushUnit[3].segID, int64(3)) assert.Equal(t, len(flushUnit[3].checkPoint), 2)