This is an automated email from the ASF dual-hosted git repository. dlych pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 9d4536dcdeb82876917c4c8a48a22412a3700e3d Author: Dmitry Lychagin <dmitry.lycha...@couchbase.com> AuthorDate: Mon Dec 14 11:36:59 2020 -0800 [NO ISSUE][MD] Drop pending libraries during recovery - user model changes: no - storage format changes: no - interface changes: no Details: - Drop pending libraries during metadata recovery Change-Id: I41d0d9cb4a58d6a12e0c8356b80e376452767a8b Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9343 Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Dmitry Lychagin <dmitry.lycha...@couchbase.com> Reviewed-by: Ian Maxon <ima...@uci.edu> --- .../asterix/metadata/bootstrap/MetadataBootstrap.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java index cf089fa..2aca994 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java @@ -60,6 +60,7 @@ import org.apache.asterix.metadata.entities.Index; import org.apache.asterix.metadata.entities.InternalDatasetDetails; import org.apache.asterix.metadata.entities.InternalDatasetDetails.FileStructure; import org.apache.asterix.metadata.entities.InternalDatasetDetails.PartitioningStrategy; +import org.apache.asterix.metadata.entities.Library; import org.apache.asterix.metadata.entities.Node; import org.apache.asterix.metadata.entities.NodeGroup; import org.apache.asterix.metadata.feeds.BuiltinFeedPolicies; @@ -457,6 +458,12 @@ public class MetadataBootstrap { for (Dataset dataset : datasets) { recoverDataset(mdTxnCtx, dataset); } + + List<Library> libraries = + MetadataManager.INSTANCE.getDataverseLibraries(mdTxnCtx, dataverse.getDataverseName()); + for (Library library : libraries) { + recoverLibrary(mdTxnCtx, library); + } } } @@ -501,6 +508,17 @@ public class MetadataBootstrap { } } + private static void recoverLibrary(MetadataTransactionContext mdTxnCtx, Library library) + throws AlgebricksException { + if (library.getPendingOp() != MetadataUtil.PENDING_NO_OP) { + // drop pending library + MetadataManager.INSTANCE.dropLibrary(mdTxnCtx, library.getDataverseName(), library.getName()); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("Dropped a pending library: " + library.getDataverseName() + "." + library.getName()); + } + } + } + public static boolean isNewUniverse() { return isNewUniverse; }