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 default constructor + setters to RanChangeSet & related classes #5336

Conversation

rursprung
Copy link
Contributor

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

this is needed to be able to de-serialise them using jackson which relies on the default constructor & setters.
in the upcoming liquibase-opensearch implementation opensearch-java is used, which underneath is using jackson for the (de-)serialisation of classes.

specifically, this is used in the implementation of AbstractChangeLogHistoryService#queryRanChangeSets which needs to load RanChangeSets from the DB.

also do some minor cleanups by removing manually implemented getters & setters where lombok annotations can do the job instead (no functional impact).

Things to be aware of

n/a

Things to worry about

n/a

Additional Context

for liquibase-opensearch see #4236 & opensearch-project/opensearch-migrations#148 (btw: still waiting for a reply from @nvoxland there! if you have any way of pinging him to get his feedback there that'd be great)

this is needed to be able to de-serialise them using [jackson] which
relies on the default constructor & setters.
in the upcoming liquibase-opensearch implementation [opensearch-java] is
used, which underneath is using jackson for the (de-)serialisation of
classes.

specifically, this is used in the implementation of
`AbstractChangeLogHistoryService#queryRanChangeSets` which needs to load
`RanChangeSet`s from the DB.

also do some minor cleanups by removing manually implemented getters &
setters where lombok annotations can do the job instead (no functional
impact).

[jackson]: https://github.com/FasterXML/jackson
[opensearch-java]: https://github.com/opensearch-project/opensearch-java/

Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
Copy link
Contributor

@MalloD12 MalloD12 left a comment

Choose a reason for hiding this comment

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

Approved.

Code changes look good to me.

FYI @rursprung, someone from the team will be meeting soon with Nathan to get some guidance and be able to help you with your questions.

Thanks,
Daniel.

Copy link
Collaborator

@filipelautert filipelautert left a comment

Choose a reason for hiding this comment

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

Those fields were final for a reason: once we load them from db we don't want them to be changed, as a ranChangeSet should not change. But I see the case here that's required to support Opensearch, so let's merge it and keep an eye on future PRs changes!.

@filipelautert filipelautert merged commit 3823f0b into liquibase:master Jan 15, 2024
30 of 31 checks passed
@rursprung rursprung deleted the allow-jackson-deserialisation-of-RanChangeSet branch January 15, 2024 21:48
rursprung added a commit to rursprung/liquibase that referenced this pull request May 27, 2024
this is needed to be able to de-serialise it using [jackson] which
relies on the default constructor & setters.
in the upcoming [liquibase-opensearch] implementation [opensearch-java]
is used, which underneath is using jackson for the (de-)serialisation
of classes.

specifically, this is used in the implementation of
`LockService#listLocks` which needs to load `DatabaseChangeLogLock`s
from the DB.

also do some minor cleanups by removing manually implemented getters &
setters where lombok annotations can do the job instead (no functional
impact).
this could be cleaned up even further if `Date` were replaced with
`LocalTime` (which is immutable), but that'd be a bigger (breaking)
change.

note that this is the same pattern as was previously done in liquibase#5336
(commit b4726a0) for `RanChangeSet` & other classes.

[jackson]: https://github.com/FasterXML/jackson
[opensearch-java]: https://github.com/opensearch-project/opensearch-java/
[liquibase-opensearch]: https://github.com/liquibase/liquibase-opensearch/

Signed-off-by: Ralph Ursprung <Ralph.Ursprung@avaloq.com>
rursprung added a commit to rursprung/liquibase that referenced this pull request May 28, 2024
this is needed to be able to de-serialise it using [jackson] which
relies on the getters.
in the upcoming [liquibase-opensearch] implementation [opensearch-java]
is used, which underneath is using jackson for the (de-)serialisation
of classes.

this is a follow-up to commit 3823f0b (PR liquibase#5336) where only the
deserialisation was fixed (by adding a default constructor + setters).

[jackson]: https://github.com/FasterXML/jackson
[opensearch-java]: https://github.com/opensearch-project/opensearch-java/
[liquibase-opensearch]: https://github.com/liquibase/liquibase-opensearch/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants