types/netmap, ipn/ipnlocal, control/controlclient: rename NodeMutationAdd to NodeMutationUpsert
NodeMutationAdd was a misleading name: a PeersChanged entry in a MapResponse can represent either a truly new peer or a full replacement for an existing peer that couldn't be expressed as a PeerChangedPatch. Calling it "Add" implied it was always a completely new node, which is wrong. (I'd changed my mind on the design of mapping add/delete events to NodeMutations halfway through #19607 and forgot to update the name, even though I'd updated half the docs) Rename it to NodeMutationUpsert to reflect the actual semantics: the node should be inserted or replaced in the peer map regardless of whether it already existed. Updates #19607 Updates #12542 Change-Id: Iebd3daddb3318cba02e115a1b184fcb3ee8f83d6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
a8f40a2ca5
commit
2c965ab540
@@ -108,19 +108,19 @@ func TestNetmapDeltaFastPath(t *testing.T) {
|
||||
// parallel here, hence tstest.Shard above).
|
||||
mFast := metricByName(t, "controlclient_map_response_handled_incrementally")
|
||||
mFull := metricByName(t, "controlclient_map_response_handled_full_rebuild")
|
||||
mAdd := metricByName(t, "localbackend_netmap_delta_peer_added")
|
||||
mUpsert := metricByName(t, "localbackend_netmap_delta_peer_upserted")
|
||||
mRem := metricByName(t, "localbackend_netmap_delta_peer_removed")
|
||||
mPatch := metricByName(t, "localbackend_netmap_delta_peer_patched")
|
||||
mFilter := metricByName(t, "localbackend_update_packet_filter")
|
||||
mUsers := metricByName(t, "localbackend_update_user_profiles")
|
||||
baseline := map[*clientmetric.Metric]int64{
|
||||
mFast: mFast.Value(), mFull: mFull.Value(),
|
||||
mAdd: mAdd.Value(), mRem: mRem.Value(), mPatch: mPatch.Value(),
|
||||
mUpsert: mUpsert.Value(), mRem: mRem.Value(), mPatch: mPatch.Value(),
|
||||
mFilter: mFilter.Value(), mUsers: mUsers.Value(),
|
||||
}
|
||||
dumpMetrics := func(t *testing.T) {
|
||||
t.Helper()
|
||||
for _, m := range []*clientmetric.Metric{mFast, mFull, mAdd, mRem, mPatch, mFilter, mUsers} {
|
||||
for _, m := range []*clientmetric.Metric{mFast, mFull, mUpsert, mRem, mPatch, mFilter, mUsers} {
|
||||
t.Logf("metric %s = %d (baseline %d, delta %d)", m.Name(), m.Value(), baseline[m], m.Value()-baseline[m])
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ func TestNetmapDeltaFastPath(t *testing.T) {
|
||||
})
|
||||
|
||||
waitDelta(t, mFast, 1)
|
||||
waitDelta(t, mAdd, 1)
|
||||
waitDelta(t, mUpsert, 1)
|
||||
waitDelta(t, mFilter, 1)
|
||||
waitDelta(t, mUsers, 1)
|
||||
waitDelta(t, mFull, 0)
|
||||
|
||||
Reference in New Issue
Block a user