Skip to content

Commit e66e2be

Browse files
wenyihu6tbg
authored andcommitted
asim: fix bug with missing ticket in controller
Previously, tickets were incorrectly deleted immediately after checking for their existence, even if they weren't completed yet. This caused tickets to be missing on subsequent checks. This commit fixes the issue by keeping the tickets around. Epic: none Release note: none
1 parent fefbcd1 commit e66e2be

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

pkg/kv/kvserver/asim/op/controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ func (c *controller) Tick(ctx context.Context, tick time.Time, state state.State
115115
// If the ticket exists, it returns the operation and true, else false.
116116
func (c *controller) Check(ticket DispatchedTicket) (op ControlledOperation, ok bool) {
117117
op, ok = c.tickets[ticket]
118-
if ok {
119-
delete(c.tickets, ticket)
120-
}
121118
return op, ok
122119
}
123120

pkg/kv/kvserver/asim/storerebalancer/store_rebalancer_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ func TestStoreRebalancer(t *testing.T) {
136136
rebalancerSleeping,
137137
rangeRebalancing,
138138
rangeRebalancing,
139-
rebalancerSleeping,
140-
rebalancerSleeping,
139+
rangeRebalancing,
140+
rangeRebalancing,
141141
rebalancerSleeping,
142142
rebalancerSleeping,
143143
},
@@ -146,7 +146,7 @@ func TestStoreRebalancer(t *testing.T) {
146146
{1: 3200, 2: 3000, 3: 3000, 4: 0, 5: 0, 6: 0},
147147
{1: 2400, 2: 3000, 3: 3000, 4: 0, 5: 0, 6: 800},
148148
{1: 2400, 2: 3000, 3: 3000, 4: 0, 5: 0, 6: 800},
149-
{1: 1600, 2: 3000, 3: 3000, 4: 800, 5: 0, 6: 800},
149+
{1: 2400, 2: 3000, 3: 3000, 4: 0, 5: 0, 6: 800},
150150
{1: 1600, 2: 3000, 3: 3000, 4: 800, 5: 0, 6: 800},
151151
{1: 1600, 2: 3000, 3: 3000, 4: 800, 5: 0, 6: 800},
152152
},

0 commit comments

Comments
 (0)