diff --git a/changelog/22.0/22.0.0/summary.md b/changelog/22.0/22.0.0/summary.md
index b5137078101..1e31214cd84 100644
--- a/changelog/22.0/22.0.0/summary.md
+++ b/changelog/22.0/22.0.0/summary.md
@@ -137,9 +137,9 @@ This is the last time this will be needed in the `8.0.x` series, as starting wit
The base system now uses Debian Bookworm instead of Debian Bullseye for the `vitess/lite` images. This change was brought by [Pull Request #17552].
### KeyRanges in `--clusters_to_watch` in VTOrc
-VTOrc now supports specifying KeyRanges in the `--clusters_to_watch` flag. This is useful in scenarios where you don't need to restart a VTOrc instance if you run a reshard.
-For example, if a VTOrc is configured to watch `ks/-80`, then it would watch all the shards that fall under the KeyRange `-80`. If a reshard is run and, `-80` is split into new shards `-40`, and `40-80`, the VTOrc instance will automatically start watching the new shard without needing a restart. In the previous logic, watching a shard -80 would watch 1 (or 0) shard only. In the new system, since we interpret -80 as a key range, it can lead to a watch on multiple shards as described in the example.
-The users can still continue to specify exact key ranges too, and the new feature is backward compatible.
+VTOrc now supports specifying keyranges in the `--clusters_to_watch` flag. This means that there is no need to restart a VTOrc instance with a different flag value when you reshard a keyspace.
+For example, if a VTOrc is configured to watch `ks/-80`, then it would watch all the shards that fall under the keyrange `-80`. If a reshard is performed and `-80` is split into new shards `-40` and `40-80`, the VTOrc instance will automatically start watching the new shards without needing a restart. In the previous logic, specifying `ks/-80` for the flag would mean that VTOrc would watch only 1 (or no) shard. In the new system, since we interpret `-80` as a key range, it can watch multiple shards as described in the example.
+Users can continue to specify exact keyranges. The new feature is backward compatible.
### Support for Filtering Query logs on Error
diff --git a/go/flags/endtoend/vtorc.txt b/go/flags/endtoend/vtorc.txt
index c9d77be6082..57eb907cf4d 100644
--- a/go/flags/endtoend/vtorc.txt
+++ b/go/flags/endtoend/vtorc.txt
@@ -24,7 +24,7 @@ Flags:
--bind-address string Bind address for the server. If empty, the server will listen on all available unicast and anycast IP addresses of the local system.
--catch-sigpipe catch and ignore SIGPIPE on stdout and stderr if specified
--change-tablets-with-errant-gtid-to-drained Whether VTOrc should be changing the type of tablets with errant GTIDs to DRAINED
- --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/key-ranges that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80"
+ --clusters_to_watch strings Comma-separated list of keyspaces or keyspace/keyranges that this instance will monitor and repair. Defaults to all clusters in the topology. Example: "ks1,ks2/-80"
--config-file string Full path of the config file (with extension) to use. If set, --config-path, --config-type, and --config-name are ignored.
--config-file-not-found-handling ConfigFileNotFoundHandling Behavior when a config file is not found. (Options: error, exit, ignore, warn) (default warn)
--config-name string Name of the config file (without extension) to search for. (default "vtconfig")
diff --git a/go/vt/vtorc/logic/tablet_discovery.go b/go/vt/vtorc/logic/tablet_discovery.go
index 9351b7d8549..c5c23df0cd0 100644
--- a/go/vt/vtorc/logic/tablet_discovery.go
+++ b/go/vt/vtorc/logic/tablet_discovery.go
@@ -60,7 +60,7 @@ var (
// RegisterFlags registers the flags required by VTOrc
func RegisterFlags(fs *pflag.FlagSet) {
- fs.StringSliceVar(&clustersToWatch, "clusters_to_watch", clustersToWatch, "Comma-separated list of keyspaces or keyspace/key-ranges that this instance will monitor and repair. Defaults to all clusters in the topology. Example: \"ks1,ks2/-80\"")
+ fs.StringSliceVar(&clustersToWatch, "clusters_to_watch", clustersToWatch, "Comma-separated list of keyspaces or keyspace/keyranges that this instance will monitor and repair. Defaults to all clusters in the topology. Example: \"ks1,ks2/-80\"")
fs.DurationVar(&shutdownWaitTime, "shutdown_wait_time", shutdownWaitTime, "Maximum time to wait for VTOrc to release all the locks that it is holding before shutting down on SIGTERM")
}
@@ -103,8 +103,8 @@ func initializeShardsToWatch() error {
return nil
}
-// tabletPartOfWatch checks if the given tablet is part of the watch list.
-func tabletPartOfWatch(tablet *topodatapb.Tablet) bool {
+// shouldWatchTablet checks if the given tablet is part of the watch list.
+func shouldWatchTablet(tablet *topodatapb.Tablet) bool {
// If we are watching all keyspaces, then we want to watch this tablet too.
if len(shardsToWatch) == 0 {
return true
@@ -202,7 +202,7 @@ func refreshTabletsUsing(ctx context.Context, loader func(tabletAlias string), f
matchedTablets := make([]*topo.TabletInfo, 0, len(tablets))
func() {
for _, t := range tablets {
- if tabletPartOfWatch(t.Tablet) {
+ if shouldWatchTablet(t.Tablet) {
matchedTablets = append(matchedTablets, t)
}
}
diff --git a/go/vt/vtorc/logic/tablet_discovery_test.go b/go/vt/vtorc/logic/tablet_discovery_test.go
index eaa1eb4389d..4514ef81724 100644
--- a/go/vt/vtorc/logic/tablet_discovery_test.go
+++ b/go/vt/vtorc/logic/tablet_discovery_test.go
@@ -103,7 +103,7 @@ var (
}
)
-func TestTabletsPartOfWatch(t *testing.T) {
+func TestShouldWatchTablet(t *testing.T) {
oldClustersToWatch := clustersToWatch
defer func() {
clustersToWatch = oldClustersToWatch
@@ -113,7 +113,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
testCases := []struct {
in []string
tablet *topodatapb.Tablet
- expectedPartOfWatch bool
+ expectedShouldWatch bool
}{
{
in: []string{},
@@ -121,7 +121,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: keyspace,
Shard: shard,
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{keyspace},
@@ -129,7 +129,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: keyspace,
Shard: shard,
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{keyspace + "/-"},
@@ -137,7 +137,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: keyspace,
Shard: shard,
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{keyspace + "/" + shard},
@@ -145,7 +145,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: keyspace,
Shard: shard,
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{"ks/-70", "ks/70-"},
@@ -153,7 +153,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x50}, []byte{0x70}),
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{"ks/-70", "ks/70-"},
@@ -161,7 +161,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x40}, []byte{0x50}),
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{"ks/-70", "ks/70-"},
@@ -169,7 +169,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x70}, []byte{0x90}),
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{"ks/-70", "ks/70-"},
@@ -177,7 +177,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x60}, []byte{0x90}),
},
- expectedPartOfWatch: false,
+ expectedShouldWatch: false,
},
{
in: []string{"ks/50-70"},
@@ -185,7 +185,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x50}, []byte{0x70}),
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{"ks2/-70", "ks2/70-", "unknownKs/-", "ks/-80"},
@@ -193,7 +193,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x60}, []byte{0x80}),
},
- expectedPartOfWatch: true,
+ expectedShouldWatch: true,
},
{
in: []string{"ks2/-70", "ks2/70-", "unknownKs/-", "ks/-80"},
@@ -201,7 +201,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x80}, []byte{0x90}),
},
- expectedPartOfWatch: false,
+ expectedShouldWatch: false,
},
{
in: []string{"ks2/-70", "ks2/70-", "unknownKs/-", "ks/-80"},
@@ -209,7 +209,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
Keyspace: "ks",
KeyRange: key.NewKeyRange([]byte{0x90}, []byte{0xa0}),
},
- expectedPartOfWatch: false,
+ expectedShouldWatch: false,
},
}
@@ -218,7 +218,7 @@ func TestTabletsPartOfWatch(t *testing.T) {
clustersToWatch = tt.in
err := initializeShardsToWatch()
require.NoError(t, err)
- assert.Equal(t, tt.expectedPartOfWatch, tabletPartOfWatch(tt.tablet))
+ assert.Equal(t, tt.expectedShouldWatch, shouldWatchTablet(tt.tablet))
})
}
}
@@ -259,7 +259,7 @@ func TestInitializeShardsToWatch(t *testing.T) {
},
{
in: []string{"test/324"},
- expectedErr: `Invalid key range "324" while parsing clusters to watch`,
+ expectedErr: `invalid key range "324" while parsing clusters to watch`,
},
{
in: []string{"test/0"},