Skip to content

Commit 4645c6e

Browse files
committed
kv: minor cleanup
This commit includes minor cleanups for comments and a small if stmt tweak.
1 parent ae644bb commit 4645c6e

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

pkg/kv/kvserver/allocator/mmaprototype/messages.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ type StoreLeaseholderMsg struct {
4343

4444
// RangeMsg is generated by the leaseholder store (and part of
4545
// StoreLeaseholderMsg). If there is any change for that range, the full
46-
// information for that range is provided (and Populated is set to true). This
47-
// is also the case for a new leaseholder since it does not know whether
48-
// something has changed since the last leaseholder informed the allocator. A
49-
// tiny change to the RangeLoad (decided by the caller) will not cause the
50-
// fields to be populated.
46+
// information for that range is provided (and MaybeSpanConfIsPopulated is set
47+
// to true). This is also the case for a new leaseholder since it does not know
48+
// whether something has changed since the last leaseholder informed the
49+
// allocator. A tiny change to the RangeLoad (decided by the caller) will not
50+
// cause the fields to be populated.
5151
//
5252
// To ensure that the allocator does not lose synchronization with the current
5353
// set of replicas, due to spurious changes (we had one undiagnosed example

pkg/kv/kvserver/mma_replica_store.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ func (mr *mmaReplica) isLeaseholderWithDescAndConfig(
130130
func constructMMAUpdate(
131131
desc *roachpb.RangeDescriptor, raftStatus *raft.Status, leaseholderReplicaStoreID roachpb.StoreID,
132132
) []mmaprototype.StoreIDAndReplicaState {
133-
if raftStatus == nil {
134-
if buildutil.CrdbTestBuild {
135-
panic("programming error: raftStatus is nil when constructing range msg")
136-
}
133+
if raftStatus == nil && buildutil.CrdbTestBuild {
134+
panic("programming error: raftStatus is nil when constructing range msg")
137135
}
138136
// TODO(mma): this is called on every leaseholder replica every minute. We
139137
// should pass scratch memory to avoid unnecessary allocation.

pkg/kv/kvserver/replica.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,9 @@ func (r *Replica) RaftBasicStatus() raft.BasicStatus {
18451845
//
18461846
// NB: This incurs deep copies of Status.Config and Status.Progress.Inflights
18471847
// and is not suitable for use in hot paths. See raftSparseStatusRLocked().
1848+
//
1849+
// TODO(wenyihu6): odd that this is returning a pointer while holding only an
1850+
// RLock.
18481851
func (r *Replica) raftStatusRLocked() *raft.Status {
18491852
if rg := r.mu.internalRaftGroup; rg != nil {
18501853
s := rg.Status()

pkg/server/server.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,6 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf
904904

905905
mmaAllocator := mmaprototype.NewAllocatorState(timeutil.DefaultTimeSource{},
906906
rand.New(rand.NewSource(timeutil.Now().UnixNano())))
907-
// TODO(mma): Move this into a dedicated integration struct (per node, not
908-
// per-store) for mma.Allocator.
909907
g.RegisterCallback(
910908
gossip.MakePrefixPattern(gossip.KeyStoreDescPrefix),
911909
func(_ string, content roachpb.Value, origTimestampNanos int64) {

0 commit comments

Comments
 (0)