Skip to content

Commit 6a0ea40

Browse files
authored
[CRE] Reduce noisy error in shard index mapper (#23885)
[CRE] Reduce noisy errors in shard index mapper
1 parent 74a198f commit 6a0ea40

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎core/services/registrysyncer/v2/syncer.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func (s *registrySyncer) Sync(ctx context.Context, isInitialSync bool) error {
377377
for _, listener := range s.listeners {
378378
lrCopy := registry.DeepCopyRegistryMetadata(latestRegistry)
379379
if err := listener.OnNewRegistry(ctx, &lrCopy); err != nil {
380-
s.lggr.Errorf("error calling launcher: %s", err)
380+
s.lggr.Errorf("error calling OnNewRegistry on a registrysyncer listener: %s", err)
381381
s.metrics.incrementLauncherFailureCounter(ctx)
382382
}
383383
}

‎core/services/workflows/shardownership/shard_index_mapper.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package shardownership
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76
"slices"
87
"strings"
@@ -45,7 +44,8 @@ func (s *ShardIndexMapper) OnNewRegistry(ctx context.Context, reg *registry.Regi
4544
return fmt.Errorf("failed to resolve local node: %w", err)
4645
}
4746
if localNode.WorkflowDON.ID == 0 {
48-
return errors.New("local node does not belong to a workflow DON")
47+
s.lggr.Info("local node does not belong to a workflow DON, skipping shard index mapping")
48+
return nil
4949
}
5050

5151
namePrefix := shardGroupNamePrefix(localNode.WorkflowDON.Name)

‎core/services/workflows/shardownership/shard_index_mapper_test.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func TestShardIndexMapper_ErrorsWhenLocalDonHasNoFamilies(t *testing.T) {
184184
assert.Contains(t, err.Error(), "no workflow DONs found")
185185
}
186186

187-
func TestShardIndexMapper_ErrorsWhenLocalNodeNotInAnyWorkflowDon(t *testing.T) {
187+
func TestShardIndexMapper_SkipsWhenLocalNodeNotInAnyWorkflowDon(t *testing.T) {
188188
t.Parallel()
189189

190190
me := makePeerID(1)
@@ -194,9 +194,8 @@ func TestShardIndexMapper_ErrorsWhenLocalNodeNotInAnyWorkflowDon(t *testing.T) {
194194
)
195195

196196
idx := NewShardIndexMapper(logger.Test(t))
197-
err := idx.OnNewRegistry(t.Context(), reg)
198-
require.Error(t, err)
199-
assert.Contains(t, err.Error(), "does not belong to a workflow DON")
197+
require.NoError(t, idx.OnNewRegistry(t.Context(), reg))
198+
assert.Nil(t, idx.DonByShardIndex(t.Context(), 0))
200199
}
201200

202201
func TestShardIndexMapper_ErrorsOnMultiDigitShardSuffix(t *testing.T) {

0 commit comments

Comments
 (0)