Skip to content

Commit

Permalink
repo-sqale: perf monitor kind contains class + rare assert fail fix
Browse files Browse the repository at this point in the history
For iterative search if the page is full and last raw caused exit,
test expected another page like for non-partial results. Fixed now.
  • Loading branch information
virgo47 committed Aug 30, 2021
1 parent 70e23a9 commit 60e1f9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ protected boolean isFatalException(Throwable ex) {
// region perf monitoring

/**
* Registers operation start with specified short operation type name, class is prefixed automatically.
* Registers operation start with specified short operation type name.
*/
protected <T extends Containerable> long registerOperationStart(
String kind, PrismContainer<T> object) {
return registerOperationStart(kind, object.getCompileTimeClass());
}

protected <T extends Containerable> long registerOperationStart(String kind, Class<T> type) {
// TODO what about class prefix? If not used some audit/repo ops would mingle.
// a) we will use prefix (this version); b) we will name ops distinctively
return performanceMonitor != null
? performanceMonitor.registerOperationStart(opNamePrefix + kind, type)
: -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ protected void assertSingleOperationRecorded(String opKind) {
}

protected void assertOperationRecordedCount(String opKind, int count) {
// TODO see comment in SqaleServiceBase.registerOperationStart
opKind = "SqaleRepositoryService." + opKind;
Map<String, OperationPerformanceInformation> pmAllData =
repositoryService.getPerformanceMonitor()
.getGlobalPerformanceInformation().getAllData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,12 @@ private SearchResultMetadata searchObjectsIterative(
}

private void assertTypicalPageOperationCount(SearchResultMetadata metadata) {
boolean lastRowCausingPartialResult = metadata.isPartialResults()
&& metadata.getApproxNumberOfAllResults() % getConfiguredPageSize() == 0;

assertOperationRecordedCount(RepositoryService.OP_SEARCH_OBJECTS_ITERATIVE_PAGE,
metadata.getApproxNumberOfAllResults() / getConfiguredPageSize() + 1);
metadata.getApproxNumberOfAllResults() / getConfiguredPageSize()
+ (lastRowCausingPartialResult ? 0 : 1));
}

private int getConfiguredPageSize() {
Expand Down

0 comments on commit 60e1f9a

Please sign in to comment.