Skip to content

Commit f2cfac7

Browse files
vbabaninstIncMale
andauthored
Support Range Indexes as GA. (#1465)
- Make trimFactor and sparsity optional. - Update specification tests. - Move duplicated code to EncryptionFixture. - Remove Beta annotation from Range algorithm methods. JAVA-5537 JAVA-5441 --------- Co-authored-by: Valentin Kovalenko <[email protected]>
1 parent bc49800 commit f2cfac7

File tree

73 files changed

+1553
-1769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1553
-1769
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ext {
5555
zstdVersion = '1.5.5-3'
5656
awsSdkV2Version = '2.18.9'
5757
awsSdkV1Version = '1.12.337'
58-
mongoCryptVersion = '1.11.0-SNAPSHOT'
58+
mongoCryptVersion = '1.11.0'
5959
projectReactorVersion = '2022.0.0'
6060
junitBomVersion = '5.10.2'
6161
logbackVersion = '1.3.14'

driver-core/src/main/com/mongodb/client/model/vault/EncryptOptions.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public EncryptOptions(final String algorithm) {
5454
* <li>Unindexed</li>
5555
* <li>Range</li>
5656
* </ul>
57-
* Note: The Range algorithm is unstable. It is subject to breaking changes.
5857
*
5958
* @return the encryption algorithm
6059
*/
@@ -118,7 +117,6 @@ public EncryptOptions keyAltName(final String keyAltName) {
118117
* The contention factor.
119118
*
120119
* <p>It is an error to set contentionFactor when algorithm is not "Indexed" or "Range".
121-
* <p>Note: The Range algorithm is unstable. It is subject to breaking changes.</p>
122120
* @param contentionFactor the contention factor, which must be {@code >= 0} or null.
123121
* @return this
124122
* @since 4.7
@@ -147,7 +145,6 @@ public Long getContentionFactor() {
147145
*
148146
* <p>Currently, we support only "equality" or "range" queryType.</p>
149147
* <p>It is an error to set queryType when the algorithm is not "Indexed" or "Range".</p>
150-
* <p>Note: The Range algorithm is unstable. It is subject to breaking changes.</p>
151148
* @param queryType the query type
152149
* @return this
153150
* @since 4.7
@@ -162,7 +159,6 @@ public EncryptOptions queryType(@Nullable final String queryType) {
162159
* Gets the QueryType.
163160
*
164161
* <p>Currently, we support only "equality" or "range" queryType.</p>
165-
* <p>Note: The Range algorithm is unstable. It is subject to breaking changes.
166162
* @see #queryType(String)
167163
* @return the queryType or null
168164
* @since 4.7
@@ -177,14 +173,12 @@ public String getQueryType() {
177173
* The RangeOptions
178174
*
179175
* <p>It is an error to set RangeOptions when the algorithm is not "Range".
180-
* <p>Note: The Range algorithm is unstable. It is subject to breaking changes.
181176
* @param rangeOptions the range options
182177
* @return this
183178
* @since 4.9
184179
* @mongodb.server.release 8.0
185180
* @mongodb.driver.manual /core/queryable-encryption/ queryable encryption
186181
*/
187-
@Beta(Reason.SERVER)
188182
public EncryptOptions rangeOptions(@Nullable final RangeOptions rangeOptions) {
189183
this.rangeOptions = rangeOptions;
190184
return this;

driver-core/src/main/com/mongodb/client/model/vault/RangeOptions.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package com.mongodb.client.model.vault;
1818

19-
import com.mongodb.annotations.Beta;
20-
import com.mongodb.annotations.Reason;
2119
import com.mongodb.lang.Nullable;
2220
import org.bson.BsonValue;
2321

@@ -29,12 +27,10 @@
2927
*
3028
* <p>For {@code double} and {@code decimal128}, {@code min}/{@code max}/{@code precision} must all be set, or all be unset.
3129
*
32-
* <p>Note: The "Range" algorithm is unstable. It is subject to breaking changes.
3330
* @since 4.9
3431
* @mongodb.server.release 6.2
3532
* @mongodb.driver.manual /core/queryable-encryption/ queryable encryption
3633
*/
37-
@Beta(Reason.SERVER)
3834
public class RangeOptions {
3935

4036
private BsonValue min;
@@ -81,18 +77,21 @@ public RangeOptions max(@Nullable final BsonValue max) {
8177
* @return the trim factor value if set
8278
* @since 5.2
8379
*/
80+
@Nullable
8481
public Integer getTrimFactor() {
8582
return trimFactor;
8683
}
8784

8885
/**
89-
* Set the number of top-level edges stored per record by setting a trim factor, reducing write conflicts during simultaneous inserts
90-
* and optimizing queries by excluding seldom-used high-level edges.
86+
* Set the number of top-level edges stored per record.
87+
* <p>
88+
* The trim factor may be used to tune performance.
89+
*
9190
* @param trimFactor the trim factor
9291
* @return this
9392
* @since 5.2
9493
*/
95-
public RangeOptions setTrimFactor(final Integer trimFactor) {
94+
public RangeOptions trimFactor(@Nullable final Integer trimFactor) {
9695
this.trimFactor = trimFactor;
9796
return this;
9897
}
@@ -106,7 +105,10 @@ public BsonValue getMax() {
106105
}
107106

108107
/**
109-
* Set the Queryable Encryption range hypergraph sparsity factor
108+
* Set the Queryable Encryption range hypergraph sparsity factor.
109+
* <p>
110+
* Sparsity may be used to tune performance.
111+
*
110112
* @param sparsity the sparsity
111113
* @return this
112114
*/

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-BypassQueryAnalysis.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-Compact.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",
@@ -131,6 +130,9 @@
131130
"command": {
132131
"compactStructuredEncryptionData": "default"
133132
}
133+
},
134+
"result": {
135+
"ok": 1
134136
}
135137
}
136138
],
@@ -228,4 +230,4 @@
228230
]
229231
}
230232
]
231-
}
233+
}

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-CreateCollection-OldServer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,38 @@
5555
"result": {
5656
"errorContains": "Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption."
5757
}
58+
},
59+
{
60+
"name": "assertCollectionNotExists",
61+
"object": "testRunner",
62+
"arguments": {
63+
"database": "default",
64+
"collection": "enxcol_.encryptedCollection.esc"
65+
}
66+
},
67+
{
68+
"name": "assertCollectionNotExists",
69+
"object": "testRunner",
70+
"arguments": {
71+
"database": "default",
72+
"collection": "enxcol_.encryptedCollection.ecc"
73+
}
74+
},
75+
{
76+
"name": "assertCollectionNotExists",
77+
"object": "testRunner",
78+
"arguments": {
79+
"database": "default",
80+
"collection": "enxcol_.encryptedCollection.ecoc"
81+
}
82+
},
83+
{
84+
"name": "assertCollectionNotExists",
85+
"object": "testRunner",
86+
"arguments": {
87+
"database": "default",
88+
"collection": "encryptedCollection"
89+
}
5890
}
5991
]
6092
}

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-CreateCollection.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",
@@ -158,9 +157,6 @@
158157
"command": {
159158
"create": "encryptedCollection",
160159
"encryptedFields": {
161-
"escCollection": null,
162-
"ecocCollection": null,
163-
"eccCollection": null,
164160
"fields": [
165161
{
166162
"path": "firstName",
@@ -343,9 +339,6 @@
343339
"command": {
344340
"create": "encryptedCollection",
345341
"encryptedFields": {
346-
"escCollection": null,
347-
"ecocCollection": null,
348-
"eccCollection": null,
349342
"fields": [
350343
{
351344
"path": "firstName",
@@ -851,9 +844,6 @@
851844
"command": {
852845
"create": "encryptedCollection",
853846
"encryptedFields": {
854-
"escCollection": null,
855-
"ecocCollection": null,
856-
"eccCollection": null,
857847
"fields": [
858848
{
859849
"path": "firstName",
@@ -1048,9 +1038,6 @@
10481038
"command": {
10491039
"create": "encryptedCollection",
10501040
"encryptedFields": {
1051-
"escCollection": null,
1052-
"ecocCollection": null,
1053-
"eccCollection": null,
10541041
"fields": [
10551042
{
10561043
"path": "firstName",
@@ -1367,9 +1354,6 @@
13671354
"command": {
13681355
"create": "encryptedCollection",
13691356
"encryptedFields": {
1370-
"escCollection": null,
1371-
"ecocCollection": null,
1372-
"eccCollection": null,
13731357
"fields": [
13741358
{
13751359
"path": "firstName",
@@ -1635,9 +1619,6 @@
16351619
"command": {
16361620
"create": "encryptedCollection",
16371621
"encryptedFields": {
1638-
"escCollection": null,
1639-
"ecocCollection": null,
1640-
"eccCollection": null,
16411622
"fields": [
16421623
{
16431624
"path": "firstName",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-DecryptExistingData.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-Delete.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-EncryptedFields-vs-jsonSchema.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-EncryptedFieldsMap-defaults.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-FindOneAndUpdate.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-InsertFind-Indexed.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-InsertFind-Unindexed.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-MissingKey.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",
@@ -55,7 +54,7 @@
5554
"key_vault_data": [],
5655
"tests": [
5756
{
58-
"description": "FLE2 encrypt fails with mising key",
57+
"description": "FLE2 encrypt fails with missing key",
5958
"clientOptions": {
6059
"autoEncryptOpts": {
6160
"kmsProviders": {
@@ -86,7 +85,7 @@
8685
]
8786
},
8887
{
89-
"description": "FLE2 decrypt fails with mising key",
88+
"description": "FLE2 decrypt fails with missing key",
9089
"clientOptions": {
9190
"autoEncryptOpts": {
9291
"kmsProviders": {

driver-core/src/test/resources/client-side-encryption/legacy/fle2v2-NoEncryption.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"runOn": [
33
{
44
"minServerVersion": "7.0.0",
5-
"serverless": "forbid",
65
"topology": [
76
"replicaset",
87
"sharded",

0 commit comments

Comments
 (0)