martinweiler commented on code in PR #3403:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3403#discussion_r1518253249
##########
addons/common/persistence/postgresql/src/main/java/org/kie/kogito/persistence/postgresql/PostgresqlProcessInstances.java:
##########
@@ -161,6 +164,42 @@ private RuntimeException uncheckedException(Exception ex,
String message, Object
return new RuntimeException(String.format(message, param), ex);
}
+ @Override
+ public void migrate(String targetProcessId, String targetProcessVersion) {
+ try {
+ Future<RowSet<Row>> future = null;
+ if (process.version() == null) {
+ future = client.preparedQuery(MIGRATE_BULK +
IS_NULL).execute(tuple(targetProcessId, targetProcessVersion, process.id()));
+ } else {
+ future = client.preparedQuery(MIGRATE_BULK + "=
$4").execute(tuple(targetProcessId, targetProcessVersion, process.id(),
process.version()));
+ }
+ getExecutedResult(future);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw uncheckedException(e, "Error migration process instance %s
%s", process.id(), process.version());
+ } catch (Exception e) {
+ throw uncheckedException(e, "Error deleting process instance %s
%s", process.id(), process.version());
+ }
+ }
+
+ @Override
+ public void migrate(String targetProcessId, String targetProcessVersion,
String... processIds) {
+ try {
+ Future<RowSet<Row>> future = null;
+ if (process.version() == null) {
+ future = client.preparedQuery(MIGRATE_INSTANCE +
IS_NULL).execute(tuple(targetProcessId, targetProcessVersion, processIds,
process.id()));
+ } else {
+ future = client.preparedQuery(MIGRATE_INSTANCE + "=
$5").execute(tuple(targetProcessId, targetProcessVersion, processIds,
process.id(), process.version()));
+ }
+ getExecutedResult(future);
Review Comment:
```
org.kie.persistence.postgresql.PostgresqlProcessInstancesIT.testMigrateSingle
-- Time elapsed: 0.723 s <<< ERROR!
java.lang.RuntimeException: Error deleting process instance
[8fb17321-029b-4b02-8bef-15086597cd8c]
...
Caused by: java.util.concurrent.ExecutionException:
io.vertx.core.impl.NoStackTraceThrowable: The number of parameters to execute
should be consistent with the expected number of parameters = [5] but the
actual number is [6].
at
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
at
org.kie.kogito.persistence.postgresql.PostgresqlProcessInstances.getResultFromFuture(PostgresqlProcessInstances.java:241)
at
org.kie.kogito.persistence.postgresql.PostgresqlProcessInstances.getExecutedResult(PostgresqlProcessInstances.java:232)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]