-
Notifications
You must be signed in to change notification settings - Fork 139
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
[Fix #2169] Allow filtering over processInstances.definition and definition.metadata #2191
base: main
Are you sure you want to change the base?
Conversation
33d634c
to
1babdd1
Compare
8f57738
to
1e7c3e1
Compare
This reverts commit bede427.
905bffc
to
6a1f2b3
Compare
PR job Reproducerbuild-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-apps -u #2191 --skipParallelCheckout NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-2191/13/display/redirect Test results:
Those are the test failures: PR check / Build projects / org.kie.kogito.addons.quarkus.data.index.it.MongoQuarkusAddonDataIndexIT.testDataIndexAddonjava.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors[error]: Build step io.quarkus.mongodb.deployment.DevServicesMongoProcessor#startMongo threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:7.0 at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at java.base/java.lang.Thread.run(Thread.java:840) at org.jboss.threads.JBossThread.run(JBossThread.java:483) Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:7.0 at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359) at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330) at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.lambda$startMongo$0(DevServicesMongoProcessor.java:191) at java.base/java.util.Optional.orElseGet(Optional.java:364) at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:208) at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:112) ... 9 more Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88) at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344) ... 14 more Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563) at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354) at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) ... 15 more Caused by: java.lang.IllegalStateException: Wait strategy failed. Container exited with code 132 at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:533) ... 17 more Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '(?i).*waiting for connections.*' at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47) at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52) at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:909) at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:500) ... 17 more PR check / Build projects / org.kie.kogito.addons.quarkus.data.index.it.MongoQuarkusAddonDataIndexIT.testDataIndexAddonjava.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors[error]: Build step io.quarkus.mongodb.deployment.DevServicesMongoProcessor#startMongo threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:7.0 at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at java.base/java.lang.Thread.run(Thread.java:840) at org.jboss.threads.JBossThread.run(JBossThread.java:483) Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:7.0 at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359) at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330) at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.lambda$startMongo$0(DevServicesMongoProcessor.java:191) at java.base/java.util.Optional.orElseGet(Optional.java:364) at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:208) at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:112) ... 9 more Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88) at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344) ... 14 more Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563) at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354) at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) ... 15 more Caused by: java.lang.IllegalStateException: Wait strategy failed. Container exited with code 132 at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:533) ... 17 more Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '(?i).*waiting for connections.*' at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47) at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52) at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:909) at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:500) ... 17 more |
*/ | ||
|
||
ALTER TABLE definitions ADD COLUMN metadata varchar(max); | ||
|
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 do not think we need data migration for metedata when using "ansi" JPA
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 commented deletion of the old data and added how the scripts to migrate data should look like for different dbs (in case users want to apply manually)
@@ -126,11 +126,11 @@ public void setAnnotations(Set<String> annotations) { | |||
this.annotations = annotations; | |||
} | |||
|
|||
public Map<String, String> getMetadata() { | |||
public Map<String, Object> getMetadata() { |
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.
This is the only change in the model.
Moving from string to object allow us to use something different than a String (currently only supported by postgresql) and keep other Dbs basically unchanged.
@@ -61,7 +62,7 @@ public ProcessDefinition readFrom(ProtoStreamReader reader) throws IOException { | |||
pd.setName(reader.readString(NAME)); | |||
pd.setDescription(reader.readString(DESCRIPTION)); | |||
pd.setAnnotations(reader.readCollection(ANNOTATIONS, new HashSet<>(), String.class)); | |||
pd.setMetadata(buildMetadata(reader)); | |||
pd.setMetadata(Collections.unmodifiableMap(buildMetadata(reader))); |
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.
This is a compilation trick to reuse the Map<String,String> stored in Hibernate as Map<String,Object> as required by the model change
@@ -148,11 +148,11 @@ public void setAnnotations(Set<String> annotations) { | |||
this.annotations = annotations; | |||
} | |||
|
|||
public Map<String, String> getMetadata() { | |||
public Map<String, Object> getMetadata() { |
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.
MongoDb should handle the Map<String,Object> in a similar way than the Map<String,String>, but it will be good to test this manually with an existing mongodb table
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 tested it works by performing a quick test
public class MongoDBTest {
public static void main(String[] args) {
String uri = "mongodb://localhost";
try (MongoClient mongoClient = MongoClients.create(uri)) {
MongoDatabase database = mongoClient.getDatabase("sample_mflix");
MongoCollection<Document> collection = database.getCollection("movies");
// Map<String,String> map = Map.of("name","pepe");
// Document insert = new Document();
//insert.put("person", map);
//collection.insertOne(new Document(insert));
Document doc = collection.find(eq("person.name", "pepe")).first();
Map<String,Object> map = (Map<String, Object>) doc.get("person");
if (doc != null) {
System.out.println(map);
} else {
System.out.println("No matching documents found.");
}
}
}
}
PR job Reproducerbuild-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-apps -u #2191 --skipParallelCheckout NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-2191/18/display/redirect Test results:
Those are the test failures: org.kie.kogito.index.mongodb.ProcessDataIndexMongoDBKafkaIT.testProcessInstanceEvents1 expectation failed.JSON path data.UserTaskInstances[0].potentialGroups[0] doesn't match. Expected: managers Actual: null |
Fix #2169
The Graphql schema already declared metadata as json.
Therefore we had two options to add query support in postgresql:
I chose the latter because it give more freedom over what can be stored in metadata and keep the current graphql interface unchanged. The main cons is that it required a DB schema change for JPA (but that is handled by the flyway scripts automatically, so not a big deal, in my opinion)