-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Switch to Standard UUID representation #5034
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
Conversation
@@ -291,7 +291,7 @@ protected MongoClientSettings computeClientSetting() { | |||
applySettings(builder::retryWrites, computeSettingsValue(defaultSettings.getRetryWrites(), | |||
mongoClientSettings.getRetryWrites(), connectionString.getRetryWritesValue())); | |||
applySettings(builder::uuidRepresentation, | |||
computeSettingsValue(null, mongoClientSettings.getUuidRepresentation(), UuidRepresentation.JAVA_LEGACY)); | |||
computeSettingsValue(null, mongoClientSettings.getUuidRepresentation(), UuidRepresentation.STANDARD)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use here constants and not connectionString.getUuidRepresentation()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess we're missing a test here - let's align with the above and add the test for it
@@ -226,7 +226,7 @@ protected boolean autoIndexCreation() { | |||
protected MongoClientSettings mongoClientSettings() { | |||
|
|||
MongoClientSettings.Builder builder = MongoClientSettings.builder(); | |||
builder.uuidRepresentation(UuidRepresentation.JAVA_LEGACY); | |||
builder.uuidRepresentation(UuidRepresentation.STANDARD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GH Issue says
Turn defaulting off and enforce an explicit choice from the user.
To do that, shouldn't this be changed to UuidRepresentation.UNSPECIFIED
?
The risk of changing from JAVA_LEGACY
to STANDARD
is that applications with existing data can end up with a mix of UUID representations for the same field in the same collection, and then have a very difficult time querying their data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed #5037 to track the further progress. Removing defaulting and failing early (instead of a delayed failure during save/query) would be an ideal signal to require additional configuration from the application. Removing defaults is going to create quite some inconvenience during upgrade.
Another alternative could be leaving defaults as-is but issuing warn logging if the default value is implicitly (i.e. not explicitly configured) used.
Also, I updated the original ticket description.
Closes: #3932