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
Pagination for views list always shows only single page #6254
Milestone
Comments
dennisoelkers
added a commit
that referenced
this issue
Aug 7, 2019
Before this change, in `PaginatedDbService#findPaginatedWithQueryFilterAndSort` a single stream was used to filter (based on the query), paginate (based on page size and page number) and determine the number of total items (before pagination). The latter is performed using `Stream#peek`, which has the following characteristics: 1. The docs say: `This method exists mainly to support debugging, where you want to see the elements as they flow past a certain point in a pipeline` 2. `peek` is an intermediate operation on a stream, which means that a) it's actual execution is driven by the terminal operation of the stream b) it has the benefit in this case that a single stream execution is able to perform multiple tasks The code before this PR relies on `peek` being executed for each item on the stream before pagination (`skip`/`limit`) is performed. This is the case for OracleJDK up and including 1.8.0_202. Unfortunately OpenJDK is performing an optimization, where the actual stream execution is determined by the terminal operation (see 2a) and `peek` only sees items after filtering _and_ pagination. Therefore, this change is replacing the usage of `peek` with a simpler variant, which is using two separate stream instantiations for counting the total items and the actual pagination. Fixes #6254.
9 tasks
bernd
pushed a commit
that referenced
this issue
Aug 7, 2019
…#6256) * Avoid using `Stream#peek` for counting items in paginated result set. Before this change, in `PaginatedDbService#findPaginatedWithQueryFilterAndSort` a single stream was used to filter (based on the query), paginate (based on page size and page number) and determine the number of total items (before pagination). The latter is performed using `Stream#peek`, which has the following characteristics: 1. The docs say: `This method exists mainly to support debugging, where you want to see the elements as they flow past a certain point in a pipeline` 2. `peek` is an intermediate operation on a stream, which means that a) it's actual execution is driven by the terminal operation of the stream b) it has the benefit in this case that a single stream execution is able to perform multiple tasks The code before this PR relies on `peek` being executed for each item on the stream before pagination (`skip`/`limit`) is performed. This is the case for OracleJDK up and including 1.8.0_202. Unfortunately OpenJDK is performing an optimization, where the actual stream execution is determined by the terminal operation (see 2a) and `peek` only sees items after filtering _and_ pagination. Therefore, this change is replacing the usage of `peek` with a simpler variant, which is using two separate stream instantiations for counting the total items and the actual pagination. Fixes #6254. * Updated comments. * Ensuring closing of streams by using try-with-resource.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
When more than 10 views exist, the views list should show multiple pages in the pagination.
Current Behavior
When more than 10 views exist, only a single page is shown.
Possible Solution
Steps to Reproduce (for bugs)
Context
Your Environment
The text was updated successfully, but these errors were encountered: