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
243
243
if err := visFunc (mode ); err != nil {
244
244
errors = append (errors , err .Error ())
245
245
}
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"
248
248
// 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 ) )
250
250
if err := visFunc (dbVisStoreName ); err != nil {
251
251
errors = append (errors , err .Error ())
252
252
}
253
253
} 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 ))
255
257
}
256
258
}
257
259
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ func TestVisibilityHybridRecordWorkflowExecutionClosed(t *testing.T) {
255
255
writeVisibilityStoreName dynamicproperties.StringPropertyFn
256
256
expectedError error
257
257
}{
258
- "Case0-1: error case with writeVisibilityStoreName is nil" : {
258
+ "Case0-1: success case with writeVisibilityStoreName is nil - should fall back to db " : {
259
259
context : context .Background (),
260
260
request : request ,
261
261
mockDBVisibilityManager : NewMockVisibilityManager (ctrl ),
@@ -266,7 +266,7 @@ func TestVisibilityHybridRecordWorkflowExecutionClosed(t *testing.T) {
266
266
mockPinotVisibilityManagerAffordance : func (mockPinotVisibilityManager * MockVisibilityManager ) {
267
267
mockPinotVisibilityManager .EXPECT ().RecordWorkflowExecutionClosed (gomock .Any (), gomock .Any ()).Return (nil ).AnyTimes ()
268
268
},
269
- expectedError : fmt . Errorf ( "error" ),
269
+ expectedError : nil , // Should succeed by falling back to db
270
270
},
271
271
"Case0-2: error case with ES has errors in dual mode" : {
272
272
context : context .Background (),
You can’t perform that action at this time.
0 commit comments