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

Fixed indexing policy getting reset when not provided #22246

Conversation

kushagraThapar
Copy link
Member

Closes #20330

@ghost ghost added Cosmos azure-spring All azure-spring related issues labels Jun 11, 2021
Copy link
Member

@mbhaskar mbhaskar left a comment

Choose a reason for hiding this comment

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

You may also consider adding a real integration test by reading container properties and comparing the index.
LGTM. Thanks for the fix

@@ -47,6 +47,7 @@ public SimpleReactiveCosmosRepository(CosmosEntityInformation<T, K> metadata,

CosmosContainerProperties currentProperties = getContainerProperties();
if (currentProperties != null
&& entityInformation.isIndexingPolicySpecified()
Copy link
Member

Choose a reason for hiding this comment

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

Do we also have to check for empty indexing policy?

Copy link
Member Author

Choose a reason for hiding this comment

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

We are not checking for empty indexing policy for now, but future plan is to add an override flag (annotation or to application.properties) - which will ask user to force override indexing policy if they want. If they don't want to override it, then indexing policy will not be updated even if it is used and not same as what they have on their account.

Regarding IntegrationTest, it is difficult to add one, since for CI, containers are created through spring, and to create a container with indexing policy, the only way to do that is to add the annotation, which if added, will update the indexing policy.

But we can improve integration tests for this scenario later. For now, the tests in the PR should be sufficient.

@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Cosmos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Spring Data Cosmos - IndexingPolicy is getting overwritten on application bootup
2 participants