Skip to content

Commit 44124a9

Browse files
craig[bot]tbg
andcommitted
Merge #153949
153949: kvserver: assign some Dev logs to KvExec/KvDistribution r=tbg a=tbg See individual commits. Epic: none Co-authored-by: Tobias Grieger <[email protected]>
2 parents f12d6f1 + 7238c6a commit 44124a9

File tree

83 files changed

+552
-549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+552
-549
lines changed

pkg/kv/kvserver/addressing_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,16 @@ func TestUpdateRangeAddressing(t *testing.T) {
210210

211211
if test.split {
212212
if log.V(1) {
213-
log.Dev.Infof(ctx, "test case %d: split %q-%q at %q", i, left.StartKey, right.EndKey, left.EndKey)
213+
log.KvExec.Infof(ctx, "test case %d: split %q-%q at %q", i, left.StartKey, right.EndKey, left.EndKey)
214214
}
215215
} else {
216216
if log.V(1) {
217-
log.Dev.Infof(ctx, "test case %d: merge %q-%q + %q-%q", i, left.StartKey, left.EndKey, left.EndKey, right.EndKey)
217+
log.KvExec.Infof(ctx, "test case %d: merge %q-%q + %q-%q", i, left.StartKey, left.EndKey, left.EndKey, right.EndKey)
218218
}
219219
}
220220
for _, meta := range metas {
221221
if log.V(1) {
222-
log.Dev.Infof(ctx, "%q", meta.key)
222+
log.KvExec.Infof(ctx, "%q", meta.key)
223223
}
224224
}
225225

pkg/kv/kvserver/app_batch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (b *appBatch) assertAndCheckCommand(
8484
ctx context.Context, cmd *raftlog.ReplicatedCmd, state *kvserverpb.ReplicaState, isLocal bool,
8585
) (kvserverbase.ForcedErrResult, error) {
8686
if log.V(4) {
87-
log.Dev.Infof(ctx, "processing command %x: raftIndex=%d maxLeaseIndex=%d closedts=%s",
87+
log.KvExec.Infof(ctx, "processing command %x: raftIndex=%d maxLeaseIndex=%d closedts=%s",
8888
cmd.ID, cmd.Index(), cmd.Cmd.MaxLeaseIndex, cmd.Cmd.ClosedTimestamp)
8989
}
9090

@@ -138,7 +138,7 @@ func (b *appBatch) addWriteBatch(
138138
return nil
139139
}
140140
if mutations, err := storage.BatchCount(wb.Data); err != nil {
141-
log.Dev.Errorf(ctx, "unable to read header of committed WriteBatch: %+v", err)
141+
log.KvExec.Errorf(ctx, "unable to read header of committed WriteBatch: %+v", err)
142142
} else {
143143
b.numMutations += mutations
144144
}

pkg/kv/kvserver/client_lease_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func TestGossipNodeLivenessOnLeaseChange(t *testing.T) {
231231
t.Fatalf("no store has gossiped %s; gossip contents: %+v",
232232
nodeLivenessKey, tc.GetFirstStoreFromServer(t, 0).Gossip().GetInfoStatus())
233233
}
234-
log.Dev.Infof(context.Background(), "%s gossiped from s%d",
234+
log.KvExec.Infof(context.Background(), "%s gossiped from s%d",
235235
nodeLivenessKey, initialServerId)
236236

237237
newServerIdx := (initialServerId + 1) % numStores

pkg/kv/kvserver/client_merge_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ func TestStoreRangeMergeRHSLeaseExpiration(t *testing.T) {
19211921
// When this test was written, it would always produce the above
19221922
// interleaving, and successfully trigger the race when run with the race
19231923
// detector enabled about 50% of the time.
1924-
log.Dev.Infof(ctx, "starting req %d", i)
1924+
log.KvDistribution.Infof(ctx, "starting req %d", i)
19251925
var req kvpb.Request
19261926
if i%2 == 0 {
19271927
req = getArgs(rhsSentinel)
@@ -4167,7 +4167,7 @@ func TestStoreRangeMergeRaftSnapshot(t *testing.T) {
41674167
}
41684168

41694169
// Restore Raft traffic to the LHS on store2.
4170-
log.Dev.Infof(ctx, "restored traffic to store 2")
4170+
log.KvDistribution.Infof(ctx, "restored traffic to store 2")
41714171
tc.Servers[2].RaftTransport().(*kvserver.RaftTransport).ListenIncomingRaftMessages(store2.Ident.StoreID, &unreliableRaftHandler{
41724172
rangeID: aRepl0.RangeID,
41734173
IncomingRaftMessageHandler: store2,

pkg/kv/kvserver/client_raft_epoch_leases_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
274274
// can increment it again later.
275275
_, err := tc.Server(0).DB().Inc(ctx, key, 1)
276276
require.NoError(t, err)
277-
log.Dev.Infof(ctx, "test: waiting for initial values...")
277+
log.KvExec.Infof(ctx, "test: waiting for initial values...")
278278
tc.WaitForValues(t, key, []int64{1, 1, 1})
279-
log.Dev.Infof(ctx, "test: waiting for initial values... done")
279+
log.KvExec.Infof(ctx, "test: waiting for initial values... done")
280280
}
281281

282282
// Partition the original leader from its followers. We do this by installing
@@ -291,7 +291,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
291291
// x x
292292
// [1]<---->[2]
293293
//
294-
log.Dev.Infof(ctx, "test: partitioning node")
294+
log.KvExec.Infof(ctx, "test: partitioning node")
295295
const partitionNodeIdx = 0
296296
partitionStore := tc.GetFirstStoreFromServer(t, partitionNodeIdx)
297297
partRepl, err := partitionStore.GetReplica(rngDesc.RangeID)
@@ -325,12 +325,12 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
325325
}
326326

327327
// Stop the heartbeats so that n1's lease can expire.
328-
log.Dev.Infof(ctx, "test: suspending heartbeats for n1")
328+
log.KvExec.Infof(ctx, "test: suspending heartbeats for n1")
329329
resumeN1Heartbeats := partitionStore.GetStoreConfig().NodeLiveness.PauseAllHeartbeatsForTest()
330330

331331
// Wait until another replica campaigns and becomes leader, replacing the
332332
// partitioned one.
333-
log.Dev.Infof(ctx, "test: waiting for leadership transfer")
333+
log.KvExec.Infof(ctx, "test: waiting for leadership transfer")
334334
testutils.SucceedsSoon(t, func() error {
335335
// Make sure this replica has not inadvertently quiesced. We need the
336336
// replica ticking so that it campaigns.
@@ -348,7 +348,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
348348
})
349349

350350
leaderReplicaID := roachpb.ReplicaID(otherRepl.RaftStatus().Lead)
351-
log.Dev.Infof(ctx, "test: the leader is replica ID %d", leaderReplicaID)
351+
log.KvExec.Infof(ctx, "test: the leader is replica ID %d", leaderReplicaID)
352352
if leaderReplicaID != 2 && leaderReplicaID != 3 {
353353
t.Fatalf("expected leader to be 1 or 2, was: %d", leaderReplicaID)
354354
}
@@ -358,7 +358,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
358358
require.NoError(t, err)
359359

360360
// Wait until the lease expires.
361-
log.Dev.Infof(ctx, "test: waiting for lease expiration")
361+
log.KvExec.Infof(ctx, "test: waiting for lease expiration")
362362
partitionedReplica, err := partitionStore.GetReplica(rngDesc.RangeID)
363363
require.NoError(t, err)
364364
testutils.SucceedsSoon(t, func() error {
@@ -375,11 +375,11 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
375375
}
376376
return nil
377377
})
378-
log.Dev.Infof(ctx, "test: lease expired")
378+
log.KvExec.Infof(ctx, "test: lease expired")
379379

380380
{
381381
// Write something to generate some Raft log entries and then truncate the log.
382-
log.Dev.Infof(ctx, "test: incrementing")
382+
log.KvExec.Infof(ctx, "test: incrementing")
383383
incArgs := incrementArgs(key, 1)
384384
sender := leaderStore.TestSender()
385385
_, pErr := kv.SendWrapped(ctx, sender, incArgs)
@@ -392,7 +392,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
392392
// Truncate the log at index+1 (log entries < N are removed, so this includes
393393
// the increment). This means that the partitioned replica will need a
394394
// snapshot to catch up.
395-
log.Dev.Infof(ctx, "test: truncating log...")
395+
log.KvExec.Infof(ctx, "test: truncating log...")
396396
truncArgs := &kvpb.TruncateLogRequest{
397397
RequestHeader: kvpb.RequestHeader{
398398
Key: key,
@@ -408,7 +408,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
408408
// Resume n1's heartbeats and wait for it to become live again. This is to
409409
// ensure that the rest of the test does not somehow fool itself because n1 is
410410
// not live.
411-
log.Dev.Infof(ctx, "test: resuming n1 heartbeats")
411+
log.KvExec.Infof(ctx, "test: resuming n1 heartbeats")
412412
resumeN1Heartbeats()
413413

414414
// Resolve the partition, but continue blocking snapshots destined for the
@@ -418,7 +418,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
418418
// allow the replica in question to figure out that it's not the leader any
419419
// more. As long as it is completely partitioned, the replica continues
420420
// believing that it is the leader, and lease acquisition requests block.
421-
log.Dev.Infof(ctx, "test: removing partition")
421+
log.KvExec.Infof(ctx, "test: removing partition")
422422
slowSnapHandler := &slowSnapRaftHandler{
423423
rangeID: rngDesc.RangeID,
424424
waitCh: make(chan struct{}),
@@ -439,7 +439,7 @@ func TestRequestsOnLaggingReplicaEpochLeases(t *testing.T) {
439439

440440
// Now we're going to send a request to the behind replica, and we expect it
441441
// to not block; we expect a redirection to the leader.
442-
log.Dev.Infof(ctx, "test: sending request")
442+
log.KvExec.Infof(ctx, "test: sending request")
443443
timeoutCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
444444
defer cancel()
445445
for {
@@ -549,7 +549,7 @@ func TestSnapshotAfterTruncationWithUncommittedTailEpochLeases(t *testing.T) {
549549
// x x
550550
// [1]<---->[2]
551551
//
552-
log.Dev.Infof(ctx, "test: installing unreliable Raft transports")
552+
log.KvExec.Infof(ctx, "test: installing unreliable Raft transports")
553553
for _, s := range []int{0, 1, 2} {
554554
h := &unreliableRaftHandler{
555555
rangeID: partRepl.RangeID,
@@ -572,7 +572,7 @@ func TestSnapshotAfterTruncationWithUncommittedTailEpochLeases(t *testing.T) {
572572
// not succeed before their context is canceled, but they will be appended
573573
// to the partitioned replica's Raft log because it is currently the Raft
574574
// leader.
575-
log.Dev.Infof(ctx, "test: sending writes to partitioned replica")
575+
log.KvExec.Infof(ctx, "test: sending writes to partitioned replica")
576576
g := ctxgroup.WithContext(ctx)
577577
otherKeys := make([]roachpb.Key, 32)
578578
otherKeys[0] = key.Next()
@@ -609,7 +609,7 @@ func TestSnapshotAfterTruncationWithUncommittedTailEpochLeases(t *testing.T) {
609609
nonPartitionedSenders[0] = tc.GetFirstStoreFromServer(t, 1).TestSender()
610610
nonPartitionedSenders[1] = tc.GetFirstStoreFromServer(t, 2).TestSender()
611611

612-
log.Dev.Infof(ctx, "test: sending write to transfer lease")
612+
log.KvExec.Infof(ctx, "test: sending write to transfer lease")
613613
incArgs = incrementArgs(key, incB)
614614
var i int
615615
var newLeaderRepl *kvserver.Replica
@@ -632,15 +632,15 @@ func TestSnapshotAfterTruncationWithUncommittedTailEpochLeases(t *testing.T) {
632632
newLeaderReplSender = tc.GetFirstStoreFromServer(t, newLeaderStoreIdx).TestSender()
633633
return nil
634634
})
635-
log.Dev.Infof(ctx, "test: waiting for values...")
635+
log.KvExec.Infof(ctx, "test: waiting for values...")
636636
tc.WaitForValues(t, key, []int64{incA, incAB, incAB})
637-
log.Dev.Infof(ctx, "test: waiting for values... done")
637+
log.KvExec.Infof(ctx, "test: waiting for values... done")
638638

639639
index := newLeaderRepl.GetLastIndex()
640640

641641
// Truncate the log at index+1 (log entries < N are removed, so this
642642
// includes the increment).
643-
log.Dev.Infof(ctx, "test: truncating log")
643+
log.KvExec.Infof(ctx, "test: truncating log")
644644
truncArgs := truncateLogArgs(index+1, partRepl.RangeID)
645645
truncArgs.Key = partRepl.Desc().StartKey.AsRawKey()
646646
testutils.SucceedsSoon(t, func() error {
@@ -659,7 +659,7 @@ func TestSnapshotAfterTruncationWithUncommittedTailEpochLeases(t *testing.T) {
659659
snapsBefore := snapsMetric.Count()
660660

661661
// Remove the partition. Snapshot should follow.
662-
log.Dev.Infof(ctx, "test: removing the partition")
662+
log.KvExec.Infof(ctx, "test: removing the partition")
663663
for _, s := range []int{0, 1, 2} {
664664
tc.Servers[s].RaftTransport().(*kvserver.RaftTransport).ListenIncomingRaftMessages(tc.Target(s).StoreID, &unreliableRaftHandler{
665665
rangeID: partRepl.RangeID,

pkg/kv/kvserver/client_raft_helpers_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (h *unreliableRaftHandler) HandleRaftRequest(
8585
if h.name != "" {
8686
prefix = fmt.Sprintf("[%s] ", h.name)
8787
}
88-
log.Dev.Infof(
88+
log.KvExec.Infof(
8989
ctx,
9090
"%sdropping r%d Raft message %s",
9191
prefix,
@@ -105,7 +105,7 @@ func (h *unreliableRaftHandler) HandleRaftRequest(
105105
if h.name != "" {
106106
prefix = fmt.Sprintf("[%s] ", h.name)
107107
}
108-
log.Dev.Infof(
108+
log.KvExec.Infof(
109109
ctx,
110110
"%s [raft] r%d Raft message %s",
111111
prefix,
@@ -420,10 +420,10 @@ func setupPartitionedRangeWithHandlers(
420420
DropStoreLivenessMsg: func(msg *storelivenesspb.Message) bool {
421421
drop := shouldDropStoreLivenessMessage(msg.From.StoreID, msg.To.StoreID)
422422
if drop {
423-
log.Dev.Infof(context.Background(), "dropping StoreLiveness msg %s from store %d: to %d",
423+
log.KvExec.Infof(context.Background(), "dropping StoreLiveness msg %s from store %d: to %d",
424424
msg.Type, msg.From.StoreID, msg.To.StoreID)
425425
} else {
426-
log.Dev.Infof(context.Background(), "allowing StoreLiveness msg %s from store %d: to %d",
426+
log.KvExec.Infof(context.Background(), "allowing StoreLiveness msg %s from store %d: to %d",
427427
msg.Type, msg.From.StoreID, msg.To.StoreID)
428428
}
429429
return drop

0 commit comments

Comments
 (0)