Skip to content

Infinite loop in v311.UpdateMetadatastatus Java migration #6055

Description

@juanluisrp

Describe the bug
When migrating from GN 3.10.x to GN 4.0.x the migration v3110/UpdateMetadataStatus.java is executed and does never end.

To Reproduce
Steps to reproduce the behavior:

  1. Get a database from GN 3.10.x
  2. Start GN 4.0.6-SNAPSHOT using that database.

Expected behavior
The v3110/UpdateMetadataStatus is executed and finish after processing all the records.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
The problem seems to be related to the check done to finish the loop:

pageRequest=page.nextPageable();
} while (pageRequest != null && page.hasContent());

It can be fixed with something like this:

    if (!page.hasNext()) {
        break;
    }
    pageRequest = page.nextPageable();
} while (page.hasContent());

In previous versions of spring-data-commons (1.6.1.RELEASE) the docs of Page.nextPageable() says

Returns the Pageable to request the next Page. Can be null in case the current Page is already the last one. Clients should check hasNextPage() before calling this method to make sure they receive a non-null value.

However, in the version used in GN 4 (2.2.8.RELEASE) it says

Returns the Pageable to request the next Slice. Can be Pageable.unpaged() in case the current Slice is already the last one. Clients should check hasNext() before calling this method.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions