Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug logs in PinotTripleVisibilityManager for response comparator testing #5631

Merged
merged 7 commits into from
Jan 28, 2024
88 changes: 22 additions & 66 deletions common/persistence/pinotVisibilityTripleManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,7 @@ func (v *pinotVisibilityTripleManager) ListOpenWorkflowExecutions(
closeStatus: -1, // is open. Will have --open flag in comparator workflow
}, request.Domain)

manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListOpenWorkflowExecutions(ctx, request)
}

Expand All @@ -372,12 +367,7 @@ func (v *pinotVisibilityTripleManager) ListClosedWorkflowExecutions(
domainName: request.Domain,
closeStatus: 6, // 6 means not set closeStatus.
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListClosedWorkflowExecutions(ctx, request)
}

Expand All @@ -391,12 +381,7 @@ func (v *pinotVisibilityTripleManager) ListOpenWorkflowExecutionsByType(
workflowType: request.WorkflowTypeName,
closeStatus: -1, // is open. Will have --open flag in comparator workflow
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListOpenWorkflowExecutionsByType(ctx, request)
}

Expand All @@ -410,12 +395,7 @@ func (v *pinotVisibilityTripleManager) ListClosedWorkflowExecutionsByType(
workflowType: request.WorkflowTypeName,
closeStatus: 6, // 6 means not set closeStatus.
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListClosedWorkflowExecutionsByType(ctx, request)
}

Expand All @@ -429,12 +409,7 @@ func (v *pinotVisibilityTripleManager) ListOpenWorkflowExecutionsByWorkflowID(
workflowID: request.WorkflowID,
closeStatus: -1,
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListOpenWorkflowExecutionsByWorkflowID(ctx, request)
}

Expand All @@ -448,12 +423,7 @@ func (v *pinotVisibilityTripleManager) ListClosedWorkflowExecutionsByWorkflowID(
workflowID: request.WorkflowID,
closeStatus: 6, // 6 means not set closeStatus.
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListClosedWorkflowExecutionsByWorkflowID(ctx, request)
}

Expand All @@ -466,12 +436,7 @@ func (v *pinotVisibilityTripleManager) ListClosedWorkflowExecutionsByStatus(
domainName: request.Domain,
closeStatus: int(request.Status),
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListClosedWorkflowExecutionsByStatus(ctx, request)
}

Expand All @@ -484,12 +449,7 @@ func (v *pinotVisibilityTripleManager) GetClosedWorkflowExecution(
domainName: request.Domain,
closeStatus: 6, // 6 means not set closeStatus.
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.GetClosedWorkflowExecution(ctx, request)
}

Expand All @@ -503,12 +463,7 @@ func (v *pinotVisibilityTripleManager) ListWorkflowExecutions(
closeStatus: 6, // 6 means not set closeStatus.
customQuery: request.Query,
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ListWorkflowExecutions(ctx, request)
}

Expand All @@ -522,12 +477,7 @@ func (v *pinotVisibilityTripleManager) ScanWorkflowExecutions(
closeStatus: 6, // 6 means not set closeStatus.
customQuery: request.Query,
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
}
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.ScanWorkflowExecutions(ctx, request)
}

Expand All @@ -541,16 +491,22 @@ func (v *pinotVisibilityTripleManager) CountWorkflowExecutions(
closeStatus: 6, // 6 means not set closeStatus.
customQuery: request.Query,
}, request.Domain)
manager := v.chooseVisibilityManagerForRead(request.Domain)
manager := v.chooseVisibilityManagerForRead(ctx, request.Domain)
return manager.CountWorkflowExecutions(ctx, request)
}

func (v *pinotVisibilityTripleManager) chooseVisibilityManagerForRead(ctx context.Context, domain string) VisibilityManager {
// temporary code: for Pinot migration usage -->
if override := ctx.Value(ContextKey); override == Primary {
manager = v.esVisibilityManager
v.logger.Debug("Pinot Migration log: Primary visibility manager was chosen for read.")
return v.esVisibilityManager
} else if override == Secondary {
manager = v.pinotVisibilityManager
v.logger.Debug("Pinot Migration log: Secondary visibility manager was chosen for read.")
return v.pinotVisibilityManager
}
return manager.CountWorkflowExecutions(ctx, request)
}
v.logger.Debug("Pinot Migration log: ContextKey was empty.")
// temporary code: ends here <--
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to just link to a task ID or a todo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a Jira ticket to record this.


func (v *pinotVisibilityTripleManager) chooseVisibilityManagerForRead(domain string) VisibilityManager {
var visibilityMgr VisibilityManager
if v.readModeIsFromES(domain) {
if v.esVisibilityManager != nil {
Expand Down