From d798a26f1eb7ef3b633d8e331f7f07bd5b78bb9d Mon Sep 17 00:00:00 2001 From: pfurio Date: Thu, 22 Aug 2024 16:18:22 +0200 Subject: [PATCH 1/7] datastore: support transactions in mongodb aggregations, #TASK-6754 --- .../datastore/mongodb/MongoDBCollection.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java index ed76bdcb2..2adc3ed77 100644 --- a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java +++ b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java @@ -25,6 +25,7 @@ import com.mongodb.client.ClientSession; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; +import com.mongodb.client.model.Aggregates; import com.mongodb.client.model.IndexOptions; import com.mongodb.client.result.DeleteResult; import com.mongodb.client.result.UpdateResult; @@ -36,10 +37,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; +import java.util.*; /** * @author Ignacio Medina <imedina@ebi.ac.uk> @@ -323,17 +321,39 @@ public List> privateFind(List queries, Bson pr return queryResultList; } + public DataResult copyDocuments(Bson query, String targetCollection) { + return copyDocuments(query, targetCollection, null); + } + + public DataResult copyDocuments(Bson query, String targetCollection, + ComplexTypeConverter converter) { + List aggregation = Arrays.asList( + Aggregates.match(query), + Aggregates.out(targetCollection) // $out step does not support transactions + ); + return aggregate(null, aggregation, converter, QueryOptions.empty()); + } + + public DataResult aggregate(ClientSession clientSession, List operations, + QueryOptions options) { + return aggregate(clientSession, operations, null, options); + } + public DataResult aggregate(List operations, QueryOptions options) { return aggregate(operations, null, options); } public DataResult aggregate(List operations, ComplexTypeConverter converter, QueryOptions options) { + return aggregate(null, operations, converter, options); + } + public DataResult aggregate(ClientSession clientSession, List operations, + ComplexTypeConverter converter, QueryOptions options) { long start = startQuery(); DataResult queryResult; - MongoDBIterator iterator = mongoDBNativeQuery.aggregate(operations, converter, options); + MongoDBIterator iterator = mongoDBNativeQuery.aggregate(clientSession, operations, converter, options); // MongoCursor iterator = output.iterator(); List list = new LinkedList<>(); if (queryResultWriter != null) { From 534f4ffd58ec08de6e6c6fc661cf52dff5f44395 Mon Sep 17 00:00:00 2001 From: pfurio Date: Thu, 22 Aug 2024 16:23:22 +0200 Subject: [PATCH 2/7] datastore: remove copyDocuments method, #TASK-6754 --- .../datastore/mongodb/MongoDBCollection.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java index 2adc3ed77..5a3c77d5b 100644 --- a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java +++ b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java @@ -321,19 +321,6 @@ public List> privateFind(List queries, Bson pr return queryResultList; } - public DataResult copyDocuments(Bson query, String targetCollection) { - return copyDocuments(query, targetCollection, null); - } - - public DataResult copyDocuments(Bson query, String targetCollection, - ComplexTypeConverter converter) { - List aggregation = Arrays.asList( - Aggregates.match(query), - Aggregates.out(targetCollection) // $out step does not support transactions - ); - return aggregate(null, aggregation, converter, QueryOptions.empty()); - } - public DataResult aggregate(ClientSession clientSession, List operations, QueryOptions options) { return aggregate(clientSession, operations, null, options); From 85f8fa44205dcc5906774b972701999ea37f2ffc Mon Sep 17 00:00:00 2001 From: pfurio Date: Fri, 11 Oct 2024 11:58:33 +0200 Subject: [PATCH 3/7] datastore: remove unused imports, #TASK-6754 --- .../opencb/commons/datastore/mongodb/MongoDBCollection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java index 5a3c77d5b..c0e2a0b0e 100644 --- a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java +++ b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBCollection.java @@ -25,7 +25,6 @@ import com.mongodb.client.ClientSession; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoCursor; -import com.mongodb.client.model.Aggregates; import com.mongodb.client.model.IndexOptions; import com.mongodb.client.result.DeleteResult; import com.mongodb.client.result.UpdateResult; @@ -37,7 +36,10 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; /** * @author Ignacio Medina <imedina@ebi.ac.uk> From 593d5ff8ec900903ac19ec034ea906af82c2f9e8 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 15 Oct 2024 15:19:43 +0200 Subject: [PATCH 4/7] Prepare next release 5.4.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index dfa4bf700..5ceb7e736 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.3.0 + 5.4.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index c44b9cc0e..6c44701b9 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.3.0 + 5.4.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 45eb7f441..54f4f4a11 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.3.0 + 5.4.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index ee91c6494..016883ca3 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.3.0 + 5.4.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 1d463ecab..59c0221df 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.3.0 + 5.4.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index eee09ada9..833b707af 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.3.0 + 5.4.0-SNAPSHOT pom OpenCB commons project From fabf7077bdc45f3e43d7086ff19336794e7114ab Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 24 Dec 2024 10:21:07 +0100 Subject: [PATCH 5/7] cicd: added if github.event.review.state approved #TASK-7301 --- .github/workflows/pull-request-approved.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index c68cc16b4..044c89e79 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -7,6 +7,7 @@ on: jobs: calculate-xetabase-branch: + if: github.event.review.state == 'approved' name: Calculate Xetabase branch runs-on: ubuntu-22.04 outputs: From 41fae16ae7bd1846254d9f45ea7df091615194c6 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 27 Jan 2025 16:08:42 +0100 Subject: [PATCH 6/7] Prepare release 5.4.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 5ceb7e736..1a79fcf9f 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.4.0-SNAPSHOT + 5.4.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 6c44701b9..080f1c8a0 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.4.0-SNAPSHOT + 5.4.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 54f4f4a11..555a4e9ff 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.4.0-SNAPSHOT + 5.4.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 016883ca3..d883cfbf8 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0-SNAPSHOT + 5.4.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 59c0221df..0857a23ad 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0-SNAPSHOT + 5.4.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 833b707af..9ffb79dbd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0-SNAPSHOT + 5.4.0 pom OpenCB commons project From 58f72899cbb302da19f858a769662a74e089c1dd Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 6 Feb 2025 10:22:06 +0100 Subject: [PATCH 7/7] Prepare port patch 5.4.0 -> 6.0.0 Xetabase 2.4.0 -> 3.0.0 #TASK-7214 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 1a79fcf9f..f75e11a92 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.4.0 + 6.0.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 080f1c8a0..842daef6b 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.4.0 + 6.0.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 555a4e9ff..789a9a915 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.4.0 + 6.0.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index d883cfbf8..1e503e66c 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0 + 6.0.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 0857a23ad..a660edcf9 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0 + 6.0.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 9ffb79dbd..ec022c4f4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0 + 6.0.0-SNAPSHOT pom OpenCB commons project