Skip to content

Commit 5220bdd

Browse files
committed
server: drive-by style fixup
Epic: none Release note: none
1 parent c61a28d commit 5220bdd

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

pkg/server/node.go

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,29 +1158,23 @@ func (n *Node) startPeriodicLivenessCompaction(
11581158
_ = n.stores.VisitStores(func(store *kvserver.Store) error {
11591159
store.VisitReplicas(func(repl *kvserver.Replica) bool {
11601160
span := repl.Desc().KeySpan().AsRawSpanWithNoLocals()
1161-
if keys.NodeLivenessSpan.Overlaps(span) {
1162-
1163-
// The CompactRange() method expects the start and end keys to be
1164-
// encoded.
1165-
startEngineKey :=
1166-
storage.EngineKey{
1167-
Key: span.Key,
1168-
}.Encode()
1169-
1170-
endEngineKey :=
1171-
storage.EngineKey{
1172-
Key: span.EndKey,
1173-
}.Encode()
1174-
1175-
timeBeforeCompaction := timeutil.Now()
1176-
if err := store.StateEngine().CompactRange(
1177-
context.Background(), startEngineKey, endEngineKey); err != nil {
1178-
log.Dev.Errorf(ctx, "failed compacting liveness replica: %+v with error: %s", repl, err)
1179-
}
1180-
1181-
log.Dev.Infof(ctx, "finished compacting liveness replica: %+v and it took: %+v",
1182-
repl, timeutil.Since(timeBeforeCompaction))
1161+
if !keys.NodeLivenessSpan.Overlaps(span) {
1162+
return true
11831163
}
1164+
1165+
// CompactRange() expects the start and end keys to be encoded.
1166+
startEngineKey := storage.EngineKey{Key: span.Key}.Encode()
1167+
endEngineKey := storage.EngineKey{Key: span.EndKey}.Encode()
1168+
1169+
timeBeforeCompaction := timeutil.Now()
1170+
if err := store.StateEngine().CompactRange(
1171+
context.Background(), startEngineKey, endEngineKey,
1172+
); err != nil {
1173+
log.Dev.Errorf(ctx, "failed compacting liveness replica: %+v with error: %s", repl, err)
1174+
}
1175+
1176+
log.Dev.Infof(ctx, "finished compacting liveness replica: %+v and it took: %+v",
1177+
repl, timeutil.Since(timeBeforeCompaction))
11841178
return true
11851179
})
11861180
return nil

0 commit comments

Comments
 (0)