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

Error sorting an unsorted result set #4626

Open
stroomdev10 opened this issue Nov 28, 2024 · 1 comment
Open

Error sorting an unsorted result set #4626

stroomdev10 opened this issue Nov 28, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@stroomdev10
Copy link
Member

Attempt to add sort to page limited results 
java.lang.RuntimeException: Attempt to add sort to page limited results
   at stroom.query.common.v2.CompiledSorters.update(CompiledSorters.java:81)
   at stroom.query.common.v2.LmdbDataStore.fetch(LmdbDataStore.java:782)
   at stroom.query.common.v2.TableResultCreator.create(TableResultCreator.java:121)
   at stroom.query.common.v2.SearchResponseCreator.getResults(SearchResponseCreator.java:256)
   at stroom.query.common.v2.SearchResponseCreator.lambda$create$4(SearchResponseCreator.java:162)
   at stroom.util.logging.LocationAwareLambdaLogger.logDurationIfTraceEnabled(LocationAwareLambdaLogger.java:275)
   at stroom.util.logging.LambdaLogger.logDurationIfTraceEnabled(LambdaLogger.java:80)
   at stroom.query.common.v2.SearchResponseCreator.create(SearchResponseCreator.java:161)
   at stroom.query.common.v2.ResultStore.search(ResultStore.java:255)
   at stroom.query.common.v2.ResultStoreManager.doSearch(ResultStoreManager.java:339)
   at stroom.query.common.v2.ResultStoreManager.lambda$search$1(ResultStoreManager.java:164)
   at stroom.security.impl.SecurityContextImpl.useAsReadResult(SecurityContextImpl.java:405)
   at stroom.query.common.v2.ResultStoreManager.lambda$search$2(ResultStoreManager.java:163)
   at stroom.task.impl.TaskContextFactoryImpl.lambda$wrap$2(TaskContextFactoryImpl.java:253)
   at stroom.util.logging.LocationAwareLambdaLogger.logDurationIfDebugEnabled(LocationAwareLambdaLogger.java:307)
   at stroom.task.impl.TaskContextFactoryImpl.lambda$wrap$4(TaskContextFactoryImpl.java:253)
   at stroom.util.pipeline.scope.PipelineScopeRunnable.scopeResult(PipelineScopeRunnable.java:36)
   at stroom.task.impl.TaskContextFactoryImpl.lambda$wrap$5(TaskContextFactoryImpl.java:250)
   at stroom.task.impl.TaskContextFactoryImpl.lambda$wrap$6(TaskContextFactoryImpl.java:262)
   at stroom.security.impl.SecurityContextImpl.useAsReadResult(SecurityContextImpl.java:405)
   at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
   at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:50)
   at jdk.proxy2/jdk.proxy2.$Proxy122.useAsReadResult(Unknown Source)
   at stroom.task.impl.TaskContextFactoryImpl.lambda$wrap$7(TaskContextFactoryImpl.java:262)
   at stroom.security.impl.SecurityContextImpl.asUserResult(SecurityContextImpl.java:337)
   at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
   at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:50)
   at jdk.proxy2/jdk.proxy2.$Proxy122.asUserResult(Unknown Source)
   at stroom.task.impl.TaskContextFactoryImpl.lambda$wrap$11(TaskContextFactoryImpl.java:260)
   at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
   at java.base/java.lang.Thread.run(Thread.java:1583)
@stroomdev10 stroomdev10 added this to the v7.7 milestone Nov 28, 2024
@stroomdev66 stroomdev66 self-assigned this Dec 6, 2024
@stroomdev66 stroomdev66 added question p:high High priority labels Dec 6, 2024
@stroomdev66 stroomdev66 changed the title RTE when sorting an unsorted result set Error sorting an unsorted result set Dec 6, 2024
@stroomdev66
Copy link
Member

stroomdev66 commented Dec 6, 2024

This is because a search that does not sort or group data, deliberately terminates as soon as it has at least a page of results. This is an optimisation to prevent excessively long searches in cases where they are not needed, but does result in a partial result set.

In order to accurately group and sort data a search needs to run through all of the data, so searches that are grouped or sorted always require a full result set. Therefore applying a post query sort to a partial result set results in an error.

We could automatically run a new search when sort is applied to a partial result set but in some ways it is no different from trying to change grouping which currently results in the table being cleared awaiting a new search. Perhaps in both cases the table should be cleared although the user might be confused that sometimes they can change the sort order and sometimes it seems they cannot. Perhaps whenever any conditions are changed that would require a new search, the table should show a message or button saying New search required maybe.

Alternatively we could remove the partial result optimisation but it is a useful feature in a resource contended environment. It could however be optional in system config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants