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

Fixes #835: ensure "createCollection()" still idempotent with "no-index" options #836

Merged
merged 5 commits into from
Jan 25, 2024

Conversation

tatu-at-datastax
Copy link
Contributor

What this PR does:

Adds tests to verify idempotency of "createCollection" command when using new "no-index" options; and fixes issues found, if any

Which issue(s) this PR fixes:
Fixes #835

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@tatu-at-datastax tatu-at-datastax marked this pull request as ready for review January 25, 2024 18:02
@tatu-at-datastax tatu-at-datastax requested a review from a team as a code owner January 25, 2024 18:02

// Need to override to prevent comparison of the supplier
@Override
public boolean equals(Object o) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the "real fix".

return executeCollectionCreation(queryExecutor);
}
// if table exists we have to choices:
// (1) trying to create with same options -> ok, proceed
Copy link
Contributor

Choose a reason for hiding this comment

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

proceed, but essentially nothing changes.
Am i understanding it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Yuqi-Du In the sense that this is what used to happen before changes too, yes.

But I think it will now try to re-create Collection, which will be no-op due to "IF NOT EXISTS" used in CQL.
Except! Important case is that if we failed to create one or more of SAIs, these will now be created, which is why retry of a timed out creation could fix things.

Copy link
Contributor

@Yuqi-Du Yuqi-Du left a comment

Choose a reason for hiding this comment

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

LGTM!

@tatu-at-datastax tatu-at-datastax merged commit 4200171 into main Jan 25, 2024
2 checks passed
@tatu-at-datastax tatu-at-datastax deleted the tatu/835-idempotent-create-coll-noindex branch January 25, 2024 21:07
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof IndexingConfig other) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I might be missing something but do we also need to check vector config here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is within nested class, IndeingConfig and not for CollectionSettings -- CollectionSettings uses default, record-provided field-by-field equality check. So that will cover vectorEnabled and other fields.

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.

[regression] - Adding indexing options in the createCollection remove idempotence
3 participants