Skip to content

Commit c52848e

Browse files
Revert #3755 (#3842)
1 parent 909ca96 commit c52848e

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

service/history/shard/context_impl.go

+10-16
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
commonpb "go.temporal.io/api/common/v1"
3636
"go.temporal.io/api/enums/v1"
3737
"go.temporal.io/api/serviceerror"
38-
"go.uber.org/multierr"
3938
"golang.org/x/exp/maps"
4039

4140
"go.temporal.io/server/api/adminservice/v1"
@@ -1444,7 +1443,8 @@ func (s *ContextImpl) handleReadError(err error) error {
14441443
case *persistence.ShardOwnershipLostError:
14451444
// Shard is stolen, trigger shutdown of history engine.
14461445
// Handling of max read level doesn't matter here.
1447-
return multierr.Combine(err, s.transition(contextRequestStop{}))
1446+
_ = s.transition(contextRequestStop{})
1447+
return err
14481448

14491449
default:
14501450
return err
@@ -1478,7 +1478,8 @@ func (s *ContextImpl) handleWriteErrorAndUpdateMaxReadLevelLocked(err error, new
14781478
case *persistence.ShardOwnershipLostError:
14791479
// Shard is stolen, trigger shutdown of history engine.
14801480
// Handling of max read level doesn't matter here.
1481-
return multierr.Combine(err, s.transition(contextRequestStop{}))
1481+
_ = s.transition(contextRequestStop{})
1482+
return err
14821483

14831484
default:
14841485
// We have no idea if the write failed or will eventually make it to persistence. Try to re-acquire
@@ -1487,7 +1488,8 @@ func (s *ContextImpl) handleWriteErrorAndUpdateMaxReadLevelLocked(err error, new
14871488
// reliably check the outcome by performing a read. If we fail, we'll shut down the shard.
14881489
// Note that reacquiring the shard will cause the max read level to be updated
14891490
// to the new range (i.e. past newMaxReadLevel).
1490-
return multierr.Combine(err, s.transition(contextRequestLost{}))
1491+
_ = s.transition(contextRequestLost{})
1492+
return err
14911493
}
14921494
}
14931495

@@ -1510,24 +1512,18 @@ func (s *ContextImpl) createEngine() Engine {
15101512

15111513
// start should only be called by the controller.
15121514
func (s *ContextImpl) start() {
1513-
if err := s.transition(contextRequestAcquire{}); err != nil {
1514-
s.contextTaggedLogger.Error("Failed to start shard", tag.Error(err))
1515-
}
1515+
_ = s.transition(contextRequestAcquire{})
15161516
}
15171517

15181518
func (s *ContextImpl) Unload() {
1519-
if err := s.transition(contextRequestStop{}); err != nil {
1520-
s.contextTaggedLogger.Error("Failed to unload shard", tag.Error(err))
1521-
}
1519+
_ = s.transition(contextRequestStop{})
15221520
}
15231521

15241522
// finishStop should only be called by the controller.
15251523
func (s *ContextImpl) finishStop() {
15261524
// After this returns, engineFuture.Set may not be called anymore, so if we don't get see
15271525
// an Engine here, we won't ever have one.
1528-
if err := s.transition(contextRequestFinishStop{}); err != nil {
1529-
s.contextTaggedLogger.Error("Failed to stop shard", tag.Error(err))
1530-
}
1526+
_ = s.transition(contextRequestFinishStop{})
15311527

15321528
// use a context that we know is cancelled so that this doesn't block
15331529
engine, _ := s.engineFuture.Get(s.lifecycleCtx)
@@ -2032,9 +2028,7 @@ func (s *ContextImpl) acquireShard() {
20322028

20332029
// On any error, initiate shutting down the shard. If we already changed state
20342030
// because we got a ShardOwnershipLostError, this won't do anything.
2035-
if err := s.transition(contextRequestStop{}); err != nil {
2036-
s.contextTaggedLogger.Error("Error stopping shard", tag.Error(err))
2037-
}
2031+
_ = s.transition(contextRequestStop{})
20382032
}
20392033
}
20402034

service/history/shard/controller_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,7 @@ func (s *controllerSuite) TestShardControllerFuzz() {
790790
shardID := int32(rand.Intn(int(s.config.NumberOfShards))) + 1
791791
switch rand.Intn(5) {
792792
case 0:
793-
if _, err := s.shardController.GetShardByID(shardID); err != nil {
794-
return err
795-
}
793+
_, _ = s.shardController.GetShardByID(shardID)
796794
case 1:
797795
if shard, err := s.shardController.GetShardByID(shardID); err == nil {
798796
_, _ = shard.GetEngine(ctx)

0 commit comments

Comments
 (0)