Skip to content
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

TASK-7213 - Port Patch 2.0.2 -> 2.4.0 #2533

Merged
merged 27 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
149577b
Prepare new development version 3.0.0.2-SNAPSHOT
juanfeSanahuja May 29, 2024
27f5906
app: allow changing the organization id during main migration,#TASK-7118
pfurio Oct 21, 2024
abd6428
Merge branch 'release-3.0.0.x' into TASK-7118
pfurio Oct 21, 2024
1f25e7a
Adapt pom to the new SDLC #TASK-7118
juanfeSanahuja Oct 21, 2024
4a0618f
Merge branch 'release-3.0.x' into TASK-7118
juanfeSanahuja Oct 21, 2024
acac916
app: store old fqn in attributes before migration, #TASK-7118
pfurio Oct 22, 2024
d2c8073
app: Ensure project.internal.datastores.variant is defined when chang…
j-coll Oct 23, 2024
bfe1925
app: Fix NPE. Add appHome to OrganizationMigration. #TASK-7118
j-coll Oct 24, 2024
85671b9
app: Rename StudyMetadata.name to match the new fqn. #TASK-7118
j-coll Oct 25, 2024
f73fbc1
app: Fix rename storage studyFqn #TASK-7118
j-coll Oct 28, 2024
d796b3d
app: Ensure OrganizationMigration is marked as "manual" to avoid auto…
j-coll Oct 28, 2024
23ff61c
Merge pull request #2523 from opencb/TASK-7118
pfurio Oct 29, 2024
f45c223
Prepare release 3.0.1
juanfeSanahuja Oct 30, 2024
e2c1261
Prepare new development version 3.0.2-SNAPSHOT
juanfeSanahuja Oct 30, 2024
345a6f2
Prepare release 3.0.2
juanfeSanahuja Oct 30, 2024
3863e5e
Prepare release 3.0.1
juanfeSanahuja Oct 30, 2024
1269834
Prepare release 3.0.1
juanfeSanahuja Oct 30, 2024
40484f0
Prepare release 3.0.1
juanfeSanahuja Oct 30, 2024
20423c3
Prepare release 3.0.2
juanfeSanahuja Oct 30, 2024
be61b15
app: ensure all jobs have an attributes field, #TASK-7207
pfurio Nov 15, 2024
d30dac9
app: Always rename studies from storage when changing organization id…
j-coll Nov 15, 2024
160fccc
Merge pull request #2531 from opencb/TASK-7207
pfurio Nov 18, 2024
3e7089a
Prepare release 3.0.2
juanfeSanahuja Nov 21, 2024
76ff1e9
Prepare Port Patch 3.0.2 -> 3.4.0 Xetabase 2.0.2 -> 2.4.0 #TASK-7213
juanfeSanahuja Nov 27, 2024
f5ad886
Conflicts in opencga-app/src/main/java/org/opencb/opencga/app/migrati…
juanfeSanahuja Nov 27, 2024
3b39feb
app: fix OrgMigration merge issues, #TASK-7213
pfurio Nov 27, 2024
317e356
Merge branch 'release-3.x.x' into TASK-7213
juanfeSanahuja Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1757,8 +1757,7 @@ public static DataStore defaultDataStore(CatalogManager catalogManager, Project
return defaultDataStore(catalogManager.getConfiguration().getDatabasePrefix(), project.getFqn());
}

public static DataStore defaultDataStore(String databasePrefix, String projectFqnStr)
throws CatalogException {
public static DataStore defaultDataStore(String databasePrefix, String projectFqnStr) {
CatalogFqn projectFqn = CatalogFqn.extractFqnFromProjectFqn(projectFqnStr);

String dbName = buildDatabaseName(databasePrefix, projectFqn.getOrganizationId(), projectFqn.getProjectId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void runMigrationToV3() throws Exception {
setCatalogDatabaseCredentials(options, options.commonOptions);

OrganizationMigration organizationMigration = new OrganizationMigration(configuration, options.commonOptions.adminPassword,
options.user);
options.user, options.organizationId, Paths.get(appHome));
organizationMigration.execute();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public class OrganizationMigrationCommandOptions extends AdminCliOptionsParser.C
@Parameter(names = {"--user"}, description = "User whose data is going to be migrated. If more than one user of type FULL contains"
+ " projects and studies, only the one provided will keep the data and will be fully migrated.")
public String user;

@Parameter(names = {"--organization-id"}, description = "Optional parameter to specify how the new organization will be named." +
" By default, if not provided, the organization id will match the user id that is currently owning the data.")
public String organizationId;
}

@Parameters(commandNames = {"summary"}, commandDescription = "Obtain migrations status summary")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import org.opencb.opencga.catalog.migration.MigrationTool;
import org.opencb.opencga.core.config.Configuration;

import java.nio.file.Path;

@Migration(id = "add_organizations", description = "Add new Organization layer #TASK-4389", version = "3.0.0",
language = Migration.MigrationLanguage.JAVA, domain = Migration.MigrationDomain.CATALOG, date = 20231212,
language = Migration.MigrationLanguage.JAVA, domain = Migration.MigrationDomain.CATALOG, date = 20231212, manual = true,
deprecatedSince = "3.1.0")

public class OrganizationMigration extends MigrationTool {

public OrganizationMigration(Configuration configuration, String adminPassword, String userId) {
public OrganizationMigration(Configuration configuration, String adminPassword, String userId, String organizationId, Path appHome) {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,17 @@ protected final void migrateCollection(MongoCollection<Document> inputCollection
.cursor()) {
while (it.hasNext()) {
Document document = it.next();
migrateFunc.accept(document, list);
try {
migrateFunc.accept(document, list);
} catch (Exception e) {
try {
logger.error("Error migrating document: {}", document.toJson());
} catch (Exception e1) {
e.addSuppressed(e1);
logger.error("Error migrating document: {}", e.getMessage());
}
throw e;
}

if (list.size() >= batchSize) {
count += list.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public String toString() {
final StringBuilder sb = new StringBuilder("DataStore{");
sb.append("storageEngine='").append(storageEngine).append('\'');
sb.append(", dbName='").append(dbName).append('\'');
sb.append(", options=").append(options);
sb.append('}');
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.opencb.biodata.models.variant.VariantFileMetadata;
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.opencga.core.common.TimeUtils;
import org.opencb.opencga.core.tools.ToolParams;
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.metadata.VariantStorageMetadataManager;
Expand Down Expand Up @@ -151,6 +152,10 @@ private void rename(String currentStudyName, String newStudyName) throws Storage
int studyId = mm.getStudyId(currentStudyName);
mm.updateStudyMetadata(studyId, studyMetadata -> {
studyMetadata.setName(newStudyName);
studyMetadata.getAttributes().put("rename_" + TimeUtils.getTime(), new ObjectMap()
.append("newName", newStudyName)
.append("oldName", currentStudyName)
);
});
}
}
Expand Down
Loading