From 0a864494404a36150df30f0385a2dbba5b7ec661 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Thu, 30 May 2024 00:03:38 +0200 Subject: [PATCH] Remove legacy `EmergencyReparentShard` stats (#15941) Signed-off-by: Tim Vaillancourt --- changelog/20.0/20.0.0/summary.md | 16 +++++++++++++++- go/vt/vtctl/reparentutil/emergency_reparenter.go | 14 ++------------ .../reparentutil/emergency_reparenter_test.go | 13 ------------- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/changelog/20.0/20.0.0/summary.md b/changelog/20.0/20.0.0/summary.md index 6d2d9f18b2e..aeacf8d7a2c 100644 --- a/changelog/20.0/20.0.0/summary.md +++ b/changelog/20.0/20.0.0/summary.md @@ -9,6 +9,7 @@ - [MySQL binaries in the vitess/lite Docker images](#vitess-lite) - [vitess/base and vitess/k8s Docker images](#base-k8s-images) - [`gh-ost` binary and endtoend tests](#gh-ost-binary-tests-removal) + - [Legacy `EmergencyReparentShard` stats](#legacy-emergencyshardreparent-stats) - **[Breaking changes](#breaking-changes)** - [Metric Name Changes in VTOrc](#metric-change-vtorc) - [ENUM and SET column handling in VTGate VStream API](#enum-set-vstream) @@ -107,6 +108,19 @@ Vitess 20.0 drops support for `gh-ost` DDL strategy. Vitess' endtoend tests no longer use nor test `gh-ost` migrations. +#### Legacy `EmergencyReparentShard` stats + +The following `EmergencyReparentShard` stats were deprecated in Vitess 18.0 and are removed in Vitess 20.0: +- `ers_counter` +- `ers_success_counter` +- `ers_failure_counter` + +These counters are replaced by the following stats _(introduced in Vitess 18.0)_: +- `emergency_reparent_counts` - Number of times `EmergencyReparentShard` has been run. It is further subdivided by the keyspace, shard and the result of the operation. +- `planned_reparent_counts` - Number of times `PlannedReparentShard` has been run. It is further subdivided by the keyspace, shard and the result of the operation. + +Also, the `reparent_shard_operation_timings` stat was added to provide per-operation timings of reparent operations. + ### Breaking Changes #### Metric Name Changes in VTOrc @@ -353,4 +367,4 @@ The internal gRPC client now caches the static auth credentials and supports rel #### vtadmin-web updated to node v20.12.2 (LTS) Building `vtadmin-web` now requires node >= v20.12.0 (LTS). Breaking changes from v18 to v20 can be found at https://nodejs.org/en/blog/release/v20.12.0 -- with no known issues that apply to VTAdmin. -Full details on the node v20.12.2 release can be found at https://nodejs.org/en/blog/release/v20.12.2. \ No newline at end of file +Full details on the node v20.12.2 release can be found at https://nodejs.org/en/blog/release/v20.12.2. diff --git a/go/vt/vtctl/reparentutil/emergency_reparenter.go b/go/vt/vtctl/reparentutil/emergency_reparenter.go index a744012982a..c3542850bee 100644 --- a/go/vt/vtctl/reparentutil/emergency_reparenter.go +++ b/go/vt/vtctl/reparentutil/emergency_reparenter.go @@ -68,15 +68,8 @@ type EmergencyReparentOptions struct { } // counters for Emergency Reparent Shard -var ( - // TODO(timvaillancourt): remove legacyERS* gauges in v19+. - legacyERSCounter = stats.NewGauge("ers_counter", "Number of times Emergency Reparent Shard has been run") - legacyERSSuccessCounter = stats.NewGauge("ers_success_counter", "Number of times Emergency Reparent Shard has succeeded") - legacyERSFailureCounter = stats.NewGauge("ers_failure_counter", "Number of times Emergency Reparent Shard has failed") - - ersCounter = stats.NewCountersWithMultiLabels("emergency_reparent_counts", "Number of times Emergency Reparent Shard has been run", - []string{"Keyspace", "Shard", "Result"}, - ) +var ersCounter = stats.NewCountersWithMultiLabels("emergency_reparent_counts", "Number of times Emergency Reparent Shard has been run", + []string{"Keyspace", "Shard", "Result"}, ) // NewEmergencyReparenter returns a new EmergencyReparenter object, ready to @@ -125,11 +118,9 @@ func (erp *EmergencyReparenter) ReparentShard(ctx context.Context, keyspace stri reparentShardOpTimings.Add("EmergencyReparentShard", time.Since(startTime)) switch err { case nil: - legacyERSSuccessCounter.Add(1) ersCounter.Add(append(statsLabels, successResult), 1) event.DispatchUpdate(ev, "finished EmergencyReparentShard") default: - legacyERSFailureCounter.Add(1) ersCounter.Add(append(statsLabels, failureResult), 1) event.DispatchUpdate(ev, "failed EmergencyReparentShard: "+err.Error()) } @@ -154,7 +145,6 @@ func (erp *EmergencyReparenter) getLockAction(newPrimaryAlias *topodatapb.Tablet func (erp *EmergencyReparenter) reparentShardLocked(ctx context.Context, ev *events.Reparent, keyspace, shard string, opts EmergencyReparentOptions) (err error) { // log the starting of the operation and increment the counter erp.logger.Infof("will initiate emergency reparent shard in keyspace - %s, shard - %s", keyspace, shard) - legacyERSCounter.Add(1) var ( stoppedReplicationSnapshot *replicationSnapshot diff --git a/go/vt/vtctl/reparentutil/emergency_reparenter_test.go b/go/vt/vtctl/reparentutil/emergency_reparenter_test.go index 6c73254586a..ffd2c4a3926 100644 --- a/go/vt/vtctl/reparentutil/emergency_reparenter_test.go +++ b/go/vt/vtctl/reparentutil/emergency_reparenter_test.go @@ -2586,9 +2586,6 @@ func TestEmergencyReparenter_waitForAllRelayLogsToApply(t *testing.T) { func TestEmergencyReparenterStats(t *testing.T) { ersCounter.ResetAll() - legacyERSCounter.Reset() - legacyERSSuccessCounter.Reset() - legacyERSFailureCounter.Reset() reparentShardOpTimings.Reset() emergencyReparentOps := EmergencyReparentOptions{} @@ -2713,11 +2710,6 @@ func TestEmergencyReparenterStats(t *testing.T) { require.EqualValues(t, map[string]int64{"testkeyspace.-.success": 1}, ersCounter.Counts()) require.EqualValues(t, map[string]int64{"All": 1, "EmergencyReparentShard": 1}, reparentShardOpTimings.Counts()) - // check the legacy counter values - require.EqualValues(t, 1, legacyERSCounter.Get()) - require.EqualValues(t, 1, legacyERSSuccessCounter.Get()) - require.EqualValues(t, 0, legacyERSFailureCounter.Get()) - // set emergencyReparentOps to request a non existent tablet emergencyReparentOps.NewPrimaryAlias = &topodatapb.TabletAlias{ Cell: "bogus", @@ -2731,11 +2723,6 @@ func TestEmergencyReparenterStats(t *testing.T) { // check the counter values require.EqualValues(t, map[string]int64{"testkeyspace.-.success": 1, "testkeyspace.-.failure": 1}, ersCounter.Counts()) require.EqualValues(t, map[string]int64{"All": 2, "EmergencyReparentShard": 2}, reparentShardOpTimings.Counts()) - - // check the legacy counter values - require.EqualValues(t, 2, legacyERSCounter.Get()) - require.EqualValues(t, 1, legacyERSSuccessCounter.Get()) - require.EqualValues(t, 1, legacyERSFailureCounter.Get()) } func TestEmergencyReparenter_findMostAdvanced(t *testing.T) {