From 7ee449f09e7376ebf545b03b9733971b576485fb Mon Sep 17 00:00:00 2001 From: Bhuvnesh Bamoriya Date: Wed, 20 Nov 2024 21:45:45 +0530 Subject: [PATCH 1/2] use new document store search api --- alerting-config-service-api/gradle.lockfile | 2 +- alerting-config-service-impl/gradle.lockfile | 2 +- config-object-store/gradle.lockfile | 2 +- config-proto-converter/gradle.lockfile | 2 +- config-service-api/gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- config-service-factory/gradle.lockfile | 12 +++--- config-service-impl/gradle.lockfile | 12 +++--- .../service/store/DocumentConfigStore.java | 38 +++++++++++++++++-- .../store/DocumentConfigStoreTest.java | 3 +- config-service/gradle.lockfile | 12 +++--- config-validation-utils/gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- labels-config-service-api/gradle.lockfile | 2 +- labels-config-service-impl/gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 12 +++--- spaces-config-service-api/gradle.lockfile | 2 +- spaces-config-service-impl/gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- .../gradle.lockfile | 2 +- span-processing-utils/gradle.lockfile | 2 +- 28 files changed, 82 insertions(+), 51 deletions(-) diff --git a/alerting-config-service-api/gradle.lockfile b/alerting-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/alerting-config-service-api/gradle.lockfile +++ b/alerting-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/alerting-config-service-impl/gradle.lockfile b/alerting-config-service-impl/gradle.lockfile index 8dbc98f5..0ec2af60 100644 --- a/alerting-config-service-impl/gradle.lockfile +++ b/alerting-config-service-impl/gradle.lockfile @@ -42,7 +42,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/config-object-store/gradle.lockfile b/config-object-store/gradle.lockfile index 71da84fe..1dc09469 100644 --- a/config-object-store/gradle.lockfile +++ b/config-object-store/gradle.lockfile @@ -38,7 +38,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/config-proto-converter/gradle.lockfile b/config-proto-converter/gradle.lockfile index 609ca178..201c7330 100644 --- a/config-proto-converter/gradle.lockfile +++ b/config-proto-converter/gradle.lockfile @@ -21,6 +21,6 @@ io.grpc:grpc-protobuf-lite:1.68.1=runtimeClasspath,testRuntimeClasspath io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.33.0=compileClasspath,testCompileClasspath org.checkerframework:checker-qual:3.42.0=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/config-service-api/gradle.lockfile b/config-service-api/gradle.lockfile index 2887c247..7615513d 100644 --- a/config-service-api/gradle.lockfile +++ b/config-service-api/gradle.lockfile @@ -31,7 +31,7 @@ net.bytebuddy:byte-buddy-agent:1.14.10=testRuntimeClasspath net.bytebuddy:byte-buddy:1.14.10=testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.mockito:mockito-core:5.8.0=testRuntimeClasspath diff --git a/config-service-change-event-api/gradle.lockfile b/config-service-change-event-api/gradle.lockfile index 3ca62250..19602cf0 100644 --- a/config-service-change-event-api/gradle.lockfile +++ b/config-service-change-event-api/gradle.lockfile @@ -6,7 +6,7 @@ com.github.luben:zstd-jni:1.5.6-3=runtimeClasspath,testRuntimeClasspath com.google.protobuf:protobuf-java:3.25.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath io.grpc:grpc-bom:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.lz4:lz4-java:1.8.0=runtimeClasspath,testRuntimeClasspath org.slf4j:slf4j-api:2.0.7=runtimeClasspath,testRuntimeClasspath diff --git a/config-service-change-event-generator/gradle.lockfile b/config-service-change-event-generator/gradle.lockfile index 61c32633..3b4ffc1d 100644 --- a/config-service-change-event-generator/gradle.lockfile +++ b/config-service-change-event-generator/gradle.lockfile @@ -41,7 +41,7 @@ org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.33.0=compileClasspath,testCompileClasspath org.checkerframework:checker-qual:3.42.0=runtimeClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/config-service-factory/gradle.lockfile b/config-service-factory/gradle.lockfile index d0d808e5..19f05399 100644 --- a/config-service-factory/gradle.lockfile +++ b/config-service-factory/gradle.lockfile @@ -98,8 +98,8 @@ org.eclipse.jetty:jetty-servlet:9.4.56.v20240826=runtimeClasspath,testRuntimeCla org.eclipse.jetty:jetty-util-ajax:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.eclipse.jetty:jetty-util:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.core.documentstore:document-store:0.7.68=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.documentstore:document-store:0.8.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.7=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -114,10 +114,10 @@ org.hypertrace.core.serviceframework:platform-service-framework:0.1.82=compileCl org.hypertrace.core.serviceframework:service-framework-spi:0.1.82=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath,testRuntimeClasspath org.lz4:lz4-java:1.8.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:bson-record-codec:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:bson:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-core:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-sync:4.9.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson-record-codec:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-core:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-sync:5.2.0=runtimeClasspath,testRuntimeClasspath org.postgresql:postgresql:42.5.5=runtimeClasspath,testRuntimeClasspath org.reactivestreams:reactive-streams:1.0.4=runtimeClasspath,testRuntimeClasspath org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/config-service-impl/gradle.lockfile b/config-service-impl/gradle.lockfile index 1d52169e..66a9d305 100644 --- a/config-service-impl/gradle.lockfile +++ b/config-service-impl/gradle.lockfile @@ -72,8 +72,8 @@ org.eclipse.jetty:jetty-servlet:9.4.56.v20240826=runtimeClasspath,testRuntimeCla org.eclipse.jetty:jetty-util-ajax:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.eclipse.jetty:jetty-util:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.core.documentstore:document-store:0.7.68=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.documentstore:document-store:0.8.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -91,10 +91,10 @@ org.junit:junit-bom:5.10.0=testCompileClasspath,testRuntimeClasspath org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath,testRuntimeClasspath org.lz4:lz4-java:1.8.0=runtimeClasspath,testRuntimeClasspath org.mockito:mockito-core:5.8.0=testCompileClasspath,testRuntimeClasspath -org.mongodb:bson-record-codec:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:bson:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-core:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-sync:4.9.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson-record-codec:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-core:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-sync:5.2.0=runtimeClasspath,testRuntimeClasspath org.objenesis:objenesis:3.3=testRuntimeClasspath org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath org.postgresql:postgresql:42.5.5=runtimeClasspath,testRuntimeClasspath diff --git a/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java b/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java index d62deb4c..cad26ead 100644 --- a/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java +++ b/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java @@ -40,6 +40,13 @@ import org.hypertrace.core.documentstore.OrderBy; import org.hypertrace.core.documentstore.Query; import org.hypertrace.core.documentstore.UpdateResult; +import org.hypertrace.core.documentstore.expression.impl.ConstantExpression; +import org.hypertrace.core.documentstore.expression.impl.IdentifierExpression; +import org.hypertrace.core.documentstore.expression.impl.LogicalExpression; +import org.hypertrace.core.documentstore.expression.impl.RelationalExpression; +import org.hypertrace.core.documentstore.expression.operators.RelationalOperator; +import org.hypertrace.core.documentstore.expression.operators.SortOrder; +import org.hypertrace.core.documentstore.model.options.QueryOptions; /** Document store which stores and serves the configurations. */ @Slf4j @@ -202,12 +209,11 @@ public Map getContextConfigs( @Override public List getAllConfigs(ConfigResource configResource) throws IOException { - Query query = new Query(); - query.setFilter(this.getConfigResourceFilter(configResource)); - query.addOrderBy(new OrderBy(VERSION_FIELD_NAME, false)); + org.hypertrace.core.documentstore.query.Query query = buildQuery(configResource); List contextSpecificConfigList = new ArrayList<>(); Set seenContexts = new HashSet<>(); - try (CloseableIterator documentIterator = collection.search(query)) { + try (CloseableIterator documentIterator = + collection.query(query, QueryOptions.DEFAULT_QUERY_OPTIONS)) { while (documentIterator.hasNext()) { String documentString = documentIterator.next().toJson(); ConfigDocument configDocument = ConfigDocument.fromJson(documentString); @@ -354,4 +360,28 @@ private ConfigResourceContext buildConfigResourceContext(ConfigDocument configDo configDocument.getTenantId()), configDocument.getContext()); } + + private org.hypertrace.core.documentstore.query.Query buildQuery(ConfigResource configResource) { + return org.hypertrace.core.documentstore.query.Query.builder() + .addSort(IdentifierExpression.of(VERSION_FIELD_NAME), SortOrder.DESC) + .setFilter( + org.hypertrace.core.documentstore.query.Filter.builder() + .expression( + LogicalExpression.and( + List.of( + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceName())), + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_NAMESPACE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceNamespace())), + RelationalExpression.of( + IdentifierExpression.of(TENANT_ID_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getTenantId()))))) + .build()) + .build(); + } } diff --git a/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java b/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java index d2f97e8c..4b13ffd5 100644 --- a/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java +++ b/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java @@ -265,7 +265,8 @@ void getAllConfigs() throws IOException { getConfigDocument(CONTEXT1, 1L, config2, TIMESTAMP3, TIMESTAMP3), getConfigDocument("context", CONFIG_VERSION, config1, TIMESTAMP1, TIMESTAMP2), getConfigDocument("context", CONFIG_VERSION - 1, config2, TIMESTAMP1, TIMESTAMP1))); - when(collection.search(any(Query.class))).thenReturn(iterator); + when(collection.query(any(org.hypertrace.core.documentstore.query.Query.class), any())) + .thenReturn(iterator); List contextSpecificConfigList = configStore.getAllConfigs(new ConfigResource(RESOURCE_NAME, RESOURCE_NAMESPACE, TENANT_ID)); diff --git a/config-service/gradle.lockfile b/config-service/gradle.lockfile index d7736076..24f88ffa 100644 --- a/config-service/gradle.lockfile +++ b/config-service/gradle.lockfile @@ -101,8 +101,8 @@ org.eclipse.jetty:jetty-servlet:9.4.56.v20240826=runtimeClasspath,testRuntimeCla org.eclipse.jetty:jetty-util-ajax:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.eclipse.jetty:jetty-util:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.core.documentstore:document-store:0.7.68=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.documentstore:document-store:0.8.5=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.7=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -117,10 +117,10 @@ org.hypertrace.core.serviceframework:platform-service-framework:0.1.82=compileCl org.hypertrace.core.serviceframework:service-framework-spi:0.1.82=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath,testRuntimeClasspath org.lz4:lz4-java:1.8.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:bson-record-codec:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:bson:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-core:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-sync:4.9.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson-record-codec:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-core:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-sync:5.2.0=runtimeClasspath,testRuntimeClasspath org.postgresql:postgresql:42.5.5=runtimeClasspath,testRuntimeClasspath org.reactivestreams:reactive-streams:1.0.4=runtimeClasspath,testRuntimeClasspath org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/config-validation-utils/gradle.lockfile b/config-validation-utils/gradle.lockfile index b0caf0ef..4b92d217 100644 --- a/config-validation-utils/gradle.lockfile +++ b/config-validation-utils/gradle.lockfile @@ -31,7 +31,7 @@ io.perfmark:perfmark-api:0.27.0=runtimeClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.33.0=compileClasspath,testCompileClasspath org.checkerframework:checker-qual:3.42.0=runtimeClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.slf4j:slf4j-api:2.0.7=runtimeClasspath,testRuntimeClasspath diff --git a/label-application-rule-config-service-api/gradle.lockfile b/label-application-rule-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/label-application-rule-config-service-api/gradle.lockfile +++ b/label-application-rule-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/label-application-rule-config-service-impl/gradle.lockfile b/label-application-rule-config-service-impl/gradle.lockfile index dc27df9e..f6d1d636 100644 --- a/label-application-rule-config-service-impl/gradle.lockfile +++ b/label-application-rule-config-service-impl/gradle.lockfile @@ -42,7 +42,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/labels-config-service-api/gradle.lockfile b/labels-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/labels-config-service-api/gradle.lockfile +++ b/labels-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/labels-config-service-impl/gradle.lockfile b/labels-config-service-impl/gradle.lockfile index e32cdc42..43bea350 100644 --- a/labels-config-service-impl/gradle.lockfile +++ b/labels-config-service-impl/gradle.lockfile @@ -42,7 +42,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/notification-channel-config-service-api/gradle.lockfile b/notification-channel-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/notification-channel-config-service-api/gradle.lockfile +++ b/notification-channel-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/notification-channel-config-service-impl/gradle.lockfile b/notification-channel-config-service-impl/gradle.lockfile index 57c4fb4b..69301207 100644 --- a/notification-channel-config-service-impl/gradle.lockfile +++ b/notification-channel-config-service-impl/gradle.lockfile @@ -42,7 +42,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/notification-rule-config-service-api/gradle.lockfile b/notification-rule-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/notification-rule-config-service-api/gradle.lockfile +++ b/notification-rule-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/notification-rule-config-service-impl/gradle.lockfile b/notification-rule-config-service-impl/gradle.lockfile index bd9df0d9..50591dfa 100644 --- a/notification-rule-config-service-impl/gradle.lockfile +++ b/notification-rule-config-service-impl/gradle.lockfile @@ -41,7 +41,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/partitioner-config-service-api/gradle.lockfile b/partitioner-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/partitioner-config-service-api/gradle.lockfile +++ b/partitioner-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/partitioner-config-service-impl/gradle.lockfile b/partitioner-config-service-impl/gradle.lockfile index a8a81b89..9b448535 100644 --- a/partitioner-config-service-impl/gradle.lockfile +++ b/partitioner-config-service-impl/gradle.lockfile @@ -95,8 +95,8 @@ org.eclipse.jetty:jetty-servlet:9.4.56.v20240826=runtimeClasspath,testRuntimeCla org.eclipse.jetty:jetty-util-ajax:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.eclipse.jetty:jetty-util:9.4.56.v20240826=runtimeClasspath,testRuntimeClasspath org.hdrhistogram:HdrHistogram:2.1.12=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.core.documentstore:document-store:0.7.68=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.documentstore:document-store:0.8.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-server-utils:0.13.7=runtimeClasspath,testRuntimeClasspath @@ -121,10 +121,10 @@ org.junit:junit-bom:5.10.1=testRuntimeClasspath org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath,testRuntimeClasspath org.mockito:mockito-core:5.8.0=testCompileClasspath,testRuntimeClasspath org.mockito:mockito-junit-jupiter:5.8.0=testCompileClasspath,testRuntimeClasspath -org.mongodb:bson-record-codec:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:bson:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-core:4.9.0=runtimeClasspath,testRuntimeClasspath -org.mongodb:mongodb-driver-sync:4.9.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson-record-codec:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:bson:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-core:5.2.0=runtimeClasspath,testRuntimeClasspath +org.mongodb:mongodb-driver-sync:5.2.0=runtimeClasspath,testRuntimeClasspath org.objenesis:objenesis:3.3=testRuntimeClasspath org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath org.postgresql:postgresql:42.5.5=runtimeClasspath,testRuntimeClasspath diff --git a/spaces-config-service-api/gradle.lockfile b/spaces-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/spaces-config-service-api/gradle.lockfile +++ b/spaces-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/spaces-config-service-impl/gradle.lockfile b/spaces-config-service-impl/gradle.lockfile index 12d8b8ba..cff2c10c 100644 --- a/spaces-config-service-impl/gradle.lockfile +++ b/spaces-config-service-impl/gradle.lockfile @@ -36,7 +36,7 @@ net.bytebuddy:byte-buddy:1.14.10=testCompileClasspath,testRuntimeClasspath org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/span-processing-config-service-api/gradle.lockfile b/span-processing-config-service-api/gradle.lockfile index 3dc1bb0f..8d3b8375 100644 --- a/span-processing-config-service-api/gradle.lockfile +++ b/span-processing-config-service-api/gradle.lockfile @@ -17,6 +17,6 @@ io.grpc:grpc-protobuf:1.68.1=compileClasspath,runtimeClasspath,testCompileClassp io.grpc:grpc-stub:1.68.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor diff --git a/span-processing-config-service-impl/gradle.lockfile b/span-processing-config-service-impl/gradle.lockfile index 780add41..f8717b3e 100644 --- a/span-processing-config-service-impl/gradle.lockfile +++ b/span-processing-config-service-impl/gradle.lockfile @@ -46,7 +46,7 @@ org.apache.kafka:kafka-clients:7.7.0-ccs=compileClasspath,runtimeClasspath,testC org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=runtimeClasspath,testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.eventstore:event-store:0.1.4=runtimeClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-client-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/span-processing-utils/gradle.lockfile b/span-processing-utils/gradle.lockfile index 9340cb0f..820131e8 100644 --- a/span-processing-utils/gradle.lockfile +++ b/span-processing-utils/gradle.lockfile @@ -33,7 +33,7 @@ net.bytebuddy:byte-buddy:1.14.10=testCompileClasspath,testRuntimeClasspath org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath org.checkerframework:checker-qual:3.42.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.codehaus.mojo:animal-sniffer-annotations:1.24=testRuntimeClasspath -org.hypertrace.bom:hypertrace-bom:0.3.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.39=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hypertrace.core.grpcutils:grpc-context-utils:0.13.7=testRuntimeClasspath org.hypertrace.core.kafkastreams.framework:kafka-bom:0.5.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit.jupiter:junit-jupiter-api:5.10.0=testCompileClasspath From 727854be1d2cbb4905ea4d49f70e241fd444651c Mon Sep 17 00:00:00 2001 From: Bhuvnesh Bamoriya Date: Thu, 21 Nov 2024 13:10:00 +0530 Subject: [PATCH 2/2] resolve comment --- .../service/store/DocumentConfigStore.java | 152 +++++++++++++----- .../store/DocumentConfigStoreTest.java | 21 ++- 2 files changed, 119 insertions(+), 54 deletions(-) diff --git a/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java b/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java index cad26ead..0d779e8b 100644 --- a/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java +++ b/config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java @@ -37,8 +37,6 @@ import org.hypertrace.core.documentstore.Document; import org.hypertrace.core.documentstore.Filter; import org.hypertrace.core.documentstore.Key; -import org.hypertrace.core.documentstore.OrderBy; -import org.hypertrace.core.documentstore.Query; import org.hypertrace.core.documentstore.UpdateResult; import org.hypertrace.core.documentstore.expression.impl.ConstantExpression; import org.hypertrace.core.documentstore.expression.impl.IdentifierExpression; @@ -46,7 +44,10 @@ import org.hypertrace.core.documentstore.expression.impl.RelationalExpression; import org.hypertrace.core.documentstore.expression.operators.RelationalOperator; import org.hypertrace.core.documentstore.expression.operators.SortOrder; +import org.hypertrace.core.documentstore.expression.type.FilterTypeExpression; import org.hypertrace.core.documentstore.model.options.QueryOptions; +import org.hypertrace.core.documentstore.query.Pagination; +import org.hypertrace.core.documentstore.query.Query; /** Document store which stores and serves the configurations. */ @Slf4j @@ -101,7 +102,7 @@ public UpsertedConfig writeConfig( .asRuntimeException(); } } else { - collection.upsert(latestDocKey, latestConfigDocument); + collection.createOrReplace(latestDocKey, latestConfigDocument); } return optionalPreviousConfig @@ -209,7 +210,11 @@ public Map getContextConfigs( @Override public List getAllConfigs(ConfigResource configResource) throws IOException { - org.hypertrace.core.documentstore.query.Query query = buildQuery(configResource); + Query query = + Query.builder() + .addSort(IdentifierExpression.of(VERSION_FIELD_NAME), SortOrder.DESC) + .setFilter(getConfigResourceFilterTypeExpression(configResource)) + .build(); List contextSpecificConfigList = new ArrayList<>(); Set seenContexts = new HashSet<>(); try (CloseableIterator documentIterator = @@ -236,12 +241,15 @@ public boolean healthCheck() { private Optional getLatestVersionConfigDoc( ConfigResourceContext configResourceContext) throws IOException { - Query query = new Query(); - query.setFilter(getConfigResourceContextFilter(configResourceContext)); - query.addOrderBy(new OrderBy(VERSION_FIELD_NAME, false)); - query.setLimit(1); + Query query = + Query.builder() + .setFilter(getConfigResourceContextFilterTypeExpression(configResourceContext)) + .addSort(IdentifierExpression.of(VERSION_FIELD_NAME), SortOrder.DESC) + .setPagination(Pagination.builder().offset(0).limit(1).build()) + .build(); - try (CloseableIterator documentIterator = collection.search(query)) { + try (CloseableIterator documentIterator = + collection.query(query, QueryOptions.DEFAULT_QUERY_OPTIONS)) { if (documentIterator.hasNext()) { String documentString = documentIterator.next().toJson(); return Optional.of(ConfigDocument.fromJson(documentString)); @@ -256,11 +264,15 @@ private Map> getLatestVersionCon return Collections.emptyMap(); } - Filter filter = buildConfigResourceContextsFilter(configResourceContexts); + FilterTypeExpression filter = + buildConfigResourceContextsFilterTypeExpression(configResourceContexts); // build query - Query query = new Query(); - query.setFilter(filter); - query.setLimit(configResourceContexts.size()); + Query query = + Query.builder() + .setFilter(filter) + .setPagination( + Pagination.builder().offset(0).limit(configResourceContexts.size()).build()) + .build(); Map> latestVersionConfigDocs = new LinkedHashMap<>(); @@ -270,7 +282,8 @@ private Map> getLatestVersionCon } // populate - try (CloseableIterator documentIterator = collection.search(query)) { + try (CloseableIterator documentIterator = + collection.query(query, QueryOptions.DEFAULT_QUERY_OPTIONS)) { while (documentIterator.hasNext()) { String documentString = documentIterator.next().toJson(); ConfigDocument configDocument = ConfigDocument.fromJson(documentString); @@ -304,9 +317,55 @@ private Filter buildConfigResourceContextsFilter( return tenantIdFilter.and(configResourceFieldContextFilter); } - private Filter getConfigResourceContextFilter(ConfigResourceContext configResourceContext) { - return this.getConfigResourceFilter(configResourceContext.getConfigResource()) - .and(Filter.eq(CONTEXT_FIELD_NAME, configResourceContext.getContext())); + private FilterTypeExpression buildConfigResourceContextsFilterTypeExpression( + java.util.Collection configResourceContexts) { + if (configResourceContexts.isEmpty()) { + throw new RuntimeException("Config resource contexts cannot be empty"); + } + List childFilters = + configResourceContexts.stream() + .map(this::getConfigResourceFieldContextFilterTypeExpression) + .collect(Collectors.toUnmodifiableList()); + FilterTypeExpression configResourceFieldContextFilter; + if (childFilters.size() == 1) { + configResourceFieldContextFilter = childFilters.get(0); + } else { + configResourceFieldContextFilter = LogicalExpression.or(childFilters); + } + FilterTypeExpression tenantIdFilter = + RelationalExpression.of( + IdentifierExpression.of(TENANT_ID_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of( + configResourceContexts.stream() + .findFirst() + .orElseThrow() + .getConfigResource() + .getTenantId())); + return LogicalExpression.and(tenantIdFilter, configResourceFieldContextFilter); + } + + private FilterTypeExpression getConfigResourceContextFilterTypeExpression( + ConfigResourceContext configResourceContext) { + ConfigResource configResource = configResourceContext.getConfigResource(); + return LogicalExpression.and( + List.of( + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceName())), + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_NAMESPACE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceNamespace())), + RelationalExpression.of( + IdentifierExpression.of(TENANT_ID_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getTenantId())), + RelationalExpression.of( + IdentifierExpression.of(CONTEXT_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResourceContext.getContext())))); } private Filter getConfigResourceFieldContextFilter(ConfigResourceContext configResourceContext) { @@ -316,10 +375,23 @@ private Filter getConfigResourceFieldContextFilter(ConfigResourceContext configR .and(Filter.eq(CONTEXT_FIELD_NAME, configResourceContext.getContext())); } - private Filter getConfigResourceFilter(ConfigResource configResource) { - return Filter.eq(RESOURCE_FIELD_NAME, configResource.getResourceName()) - .and(Filter.eq(RESOURCE_NAMESPACE_FIELD_NAME, configResource.getResourceNamespace())) - .and(Filter.eq(TENANT_ID_FIELD_NAME, configResource.getTenantId())); + private FilterTypeExpression getConfigResourceFieldContextFilterTypeExpression( + ConfigResourceContext configResourceContext) { + ConfigResource configResource = configResourceContext.getConfigResource(); + return LogicalExpression.and( + List.of( + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceName())), + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_NAMESPACE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceNamespace())), + RelationalExpression.of( + IdentifierExpression.of(CONTEXT_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResourceContext.getContext())))); } private Optional convertToContextSpecificConfig( @@ -361,27 +433,21 @@ private ConfigResourceContext buildConfigResourceContext(ConfigDocument configDo configDocument.getContext()); } - private org.hypertrace.core.documentstore.query.Query buildQuery(ConfigResource configResource) { - return org.hypertrace.core.documentstore.query.Query.builder() - .addSort(IdentifierExpression.of(VERSION_FIELD_NAME), SortOrder.DESC) - .setFilter( - org.hypertrace.core.documentstore.query.Filter.builder() - .expression( - LogicalExpression.and( - List.of( - RelationalExpression.of( - IdentifierExpression.of(RESOURCE_FIELD_NAME), - RelationalOperator.EQ, - ConstantExpression.of(configResource.getResourceName())), - RelationalExpression.of( - IdentifierExpression.of(RESOURCE_NAMESPACE_FIELD_NAME), - RelationalOperator.EQ, - ConstantExpression.of(configResource.getResourceNamespace())), - RelationalExpression.of( - IdentifierExpression.of(TENANT_ID_FIELD_NAME), - RelationalOperator.EQ, - ConstantExpression.of(configResource.getTenantId()))))) - .build()) - .build(); + private FilterTypeExpression getConfigResourceFilterTypeExpression( + ConfigResource configResource) { + return LogicalExpression.and( + List.of( + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceName())), + RelationalExpression.of( + IdentifierExpression.of(RESOURCE_NAMESPACE_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getResourceNamespace())), + RelationalExpression.of( + IdentifierExpression.of(TENANT_ID_FIELD_NAME), + RelationalOperator.EQ, + ConstantExpression.of(configResource.getTenantId())))); } } diff --git a/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java b/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java index 4b13ffd5..494654b4 100644 --- a/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java +++ b/config-service-impl/src/test/java/org/hypertrace/config/service/store/DocumentConfigStoreTest.java @@ -43,9 +43,9 @@ import org.hypertrace.core.documentstore.Datastore; import org.hypertrace.core.documentstore.Document; import org.hypertrace.core.documentstore.Key; -import org.hypertrace.core.documentstore.Query; import org.hypertrace.core.documentstore.UpdateResult; import org.hypertrace.core.documentstore.metric.DocStoreMetricProvider; +import org.hypertrace.core.documentstore.query.Query; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -77,7 +77,7 @@ void beforeEach() { @Test void WriteConfigForCreate() throws IOException { CloseableIteratorImpl iterator = new CloseableIteratorImpl(List.of()); - when(collection.search(any(Query.class))).thenReturn(iterator); + when(collection.query(any(Query.class), any())).thenReturn(iterator); UpsertConfigRequest request = mock(UpsertConfigRequest.class); when(request.getConfig()).thenReturn(config1); when(request.hasUpsertCondition()).thenReturn(false); @@ -89,7 +89,7 @@ void WriteConfigForCreate() throws IOException { ArgumentCaptor keyCaptor = ArgumentCaptor.forClass(Key.class); ArgumentCaptor documentCaptor = ArgumentCaptor.forClass(Document.class); - verify(collection, times(1)).upsert(keyCaptor.capture(), documentCaptor.capture()); + verify(collection, times(1)).createOrReplace(keyCaptor.capture(), documentCaptor.capture()); Key key = keyCaptor.getValue(); Document document = documentCaptor.getValue(); @@ -116,7 +116,7 @@ void WriteConfigForUpdateWithoutUpsertCondition() throws IOException { config1, TIMESTAMP1, TIMESTAMP2))); - when(collection.search(any(Query.class))).thenReturn(iterator); + when(collection.query(any(Query.class), any())).thenReturn(iterator); UpsertConfigRequest request = mock(UpsertConfigRequest.class); when(request.getConfig()).thenReturn(config1); when(request.hasUpsertCondition()).thenReturn(false); @@ -129,7 +129,7 @@ void WriteConfigForUpdateWithoutUpsertCondition() throws IOException { ArgumentCaptor keyCaptor = ArgumentCaptor.forClass(Key.class); ArgumentCaptor documentCaptor = ArgumentCaptor.forClass(Document.class); - verify(collection, times(1)).upsert(keyCaptor.capture(), documentCaptor.capture()); + verify(collection, times(1)).createOrReplace(keyCaptor.capture(), documentCaptor.capture()); Key key = keyCaptor.getValue(); Document document = documentCaptor.getValue(); @@ -152,7 +152,7 @@ void WriteConfigForUpdateWithUpsertCondition() throws IOException { config1, TIMESTAMP1, TIMESTAMP2))); - when(collection.search(any(Query.class))).thenReturn(iterator); + when(collection.query(any(Query.class), any())).thenReturn(iterator); UpsertConfigRequest request = mock(UpsertConfigRequest.class); UpdateResult updateResult = mock(UpdateResult.class); when(request.hasUpsertCondition()).thenReturn(true); @@ -223,7 +223,7 @@ void getConfigs() throws IOException { new CloseableIteratorImpl( Collections.singletonList( getConfigDocument("context", CONFIG_VERSION, config1, TIMESTAMP1, TIMESTAMP2))); - when(collection.search(any(Query.class))).thenReturn(iterator); + when(collection.query(any(Query.class), any())).thenReturn(iterator); ContextSpecificConfig expectedConfig = ContextSpecificConfig.newBuilder() @@ -244,7 +244,7 @@ void getConfig() throws IOException { new CloseableIteratorImpl( Collections.singletonList( getConfigDocument("context", CONFIG_VERSION, config1, TIMESTAMP1, TIMESTAMP2))); - when(collection.search(any(Query.class))).thenReturn(iterator); + when(collection.query(any(Query.class), any())).thenReturn(iterator); ContextSpecificConfig expectedConfig = ContextSpecificConfig.newBuilder() @@ -265,8 +265,7 @@ void getAllConfigs() throws IOException { getConfigDocument(CONTEXT1, 1L, config2, TIMESTAMP3, TIMESTAMP3), getConfigDocument("context", CONFIG_VERSION, config1, TIMESTAMP1, TIMESTAMP2), getConfigDocument("context", CONFIG_VERSION - 1, config2, TIMESTAMP1, TIMESTAMP1))); - when(collection.query(any(org.hypertrace.core.documentstore.query.Query.class), any())) - .thenReturn(iterator); + when(collection.query(any(Query.class), any())).thenReturn(iterator); List contextSpecificConfigList = configStore.getAllConfigs(new ConfigResource(RESOURCE_NAME, RESOURCE_NAMESPACE, TENANT_ID)); @@ -306,7 +305,7 @@ void writeAllConfigs() throws IOException { TIMESTAMP2, TIMESTAMP2))); - when(collection.search(any(Query.class))).thenReturn(getResult); + when(collection.query(any(Query.class), any())).thenReturn(getResult); when(collection.bulkUpsert(any())).thenReturn(true); when(this.mockClock.millis()).thenReturn(updateTime); List upsertedConfigs =