File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -243,15 +243,17 @@ func (v *visibilityHybridManager) chooseVisibilityManagerForWrite(ctx context.Co
243243 if err := visFunc (mode ); err != nil {
244244 errors = append (errors , err .Error ())
245245 }
246- } else if ok && mgr == nil && mode != dbVisStoreName && ! strings .Contains (writeMode , dbVisStoreName ) {
247- // if advanced visibility is not available, fall back to db
246+ } else if mode != dbVisStoreName && ! strings .Contains (writeMode , dbVisStoreName ) {
247+ // If requested mode is not available and it's not already "db" , fall back to "db"
248248 // when write mode already includes db, skip this step since it will perform the write in another loop
249- v .logger .Warn ("advanced visibility is not available to write, fall back to basic visibility" )
249+ v .logger .Warn ("requested visibility mode is not available, falling back to db" , tag . Value ( mode ) )
250250 if err := visFunc (dbVisStoreName ); err != nil {
251251 errors = append (errors , err .Error ())
252252 }
253253 } else {
254- errors = append (errors , fmt .Sprintf ("Unknown visibility writing mode: %s" , mode ))
254+ // If the mode is "db" but not available, this is an error
255+ // This is the else case - when mode is "db" but the manager is not available
256+ errors = append (errors , fmt .Sprintf ("DB visibility mode is not available: %s" , mode ))
255257 }
256258 }
257259
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ func TestVisibilityHybridRecordWorkflowExecutionClosed(t *testing.T) {
255255 writeVisibilityStoreName dynamicproperties.StringPropertyFn
256256 expectedError error
257257 }{
258- "Case0-1: error case with writeVisibilityStoreName is nil" : {
258+ "Case0-1: success case with writeVisibilityStoreName is nil - should fall back to db " : {
259259 context : context .Background (),
260260 request : request ,
261261 mockDBVisibilityManager : NewMockVisibilityManager (ctrl ),
@@ -266,7 +266,7 @@ func TestVisibilityHybridRecordWorkflowExecutionClosed(t *testing.T) {
266266 mockPinotVisibilityManagerAffordance : func (mockPinotVisibilityManager * MockVisibilityManager ) {
267267 mockPinotVisibilityManager .EXPECT ().RecordWorkflowExecutionClosed (gomock .Any (), gomock .Any ()).Return (nil ).AnyTimes ()
268268 },
269- expectedError : fmt . Errorf ( "error" ),
269+ expectedError : nil , // Should succeed by falling back to db
270270 },
271271 "Case0-2: error case with ES has errors in dual mode" : {
272272 context : context .Background (),
You can’t perform that action at this time.
0 commit comments