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

feat: add support for 5.15 key format and rename relationship keys #8

Merged
merged 4 commits into from
Dec 6, 2023

Conversation

venikkin
Copy link
Contributor

@venikkin venikkin commented Dec 4, 2023

  • For nodes keys parse the keys from result depending on value type in key map.
  • For relationship keys parse both keys and key and pick the data structure from there.
  • Split IT into 2 suits:
    • Test for 5.14 - verifies backward compatibility with earlier versions
    • Test for latest - in future will verify contract with 5.15 and onwards. Disabled now, because docker image for 5.15 hasn't been released yet. It's available from TeamCity, but we are on GH Actions. I suggest enabling this tests after 5.15 is release. So far tested against locally imported image.

@venikkin venikkin marked this pull request as ready for review December 5, 2023 15:24
@venikkin
Copy link
Contributor Author

venikkin commented Dec 5, 2023

Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

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

should we also add a test for 5.15 where we have two keys defined for the same label and assert we receive two lists?

Comment on lines 113 to 125
private static List<Map<String, Object>> getKeys(Map<String, Object> cypherMap) {
var keysList = ModelUtils.getList(cypherMap, "keys", Map.class);
if (keysList != null) {
return ModelUtils.coerceToListOfMaps(keysList, String.class, Object.class);
}

// Check if the key structure is pre Neo4j 5.15
var keyMap = ModelUtils.getMap(cypherMap, "key", String.class, Object.class);
if (keyMap == null) {
return null;
}
return List.of(keyMap);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

just a nit but should this also move into ModelUtils?


/**
* Neo4j 5.15+ introduced a breaking change in node ande relationship keys structure. This suite verifies if
* CLC Client is backward compatible with 5.14 and earlier.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* CLC Client is backward compatible with 5.14 and earlier.
* CDC Client is backward compatible with 5.14 and earlier.

"Person",
List.of(Map.of("id", 1L), Map.of("name", "John")),
"Employee",
List.of(Map.of("id", 5L, "role", "manager"))),
Copy link
Contributor

Choose a reason for hiding this comment

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

just looking into these now, having both id: 1L and id: 5L for the same property on the same node doesn't make sense at all. Do you mind updating these to match?

* TODO At the moment of writing Neo4j 5.15 hasn't publicly releases yet. This means that these tests are identical to
* {@link CDCClient514IT Integration tests for Neo4j 5.14}. When 5.15 is released, we need to enabled these tests.
*/
@Disabled
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just add a card for this in Next column on the board so that we don't forget?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chicken-egg dilemma. Was going to do this after the approval. Here is the card https://trello.com/c/Qor9KTa7/387-enable-integration-test-for-neo4j-515-in-cdc-client-lib

@venikkin venikkin requested a review from ali-ince December 6, 2023 13:35
Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

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

looks good.

@venikkin venikkin merged commit 401c210 into neo4j:main Dec 6, 2023
3 checks passed
@venikkin venikkin deleted the key-structure-5-15 branch December 6, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants