diff --git a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/FederatedMetaStoreStorage.java b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/FederatedMetaStoreStorage.java index ae1d77d9f..a9e323c2d 100644 --- a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/FederatedMetaStoreStorage.java +++ b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/FederatedMetaStoreStorage.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2016-2019 Expedia, Inc. + * Copyright (C) 2016-2023 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,4 +31,5 @@ public interface FederatedMetaStoreStorage { void update(AbstractMetaStore oldMetaStore, AbstractMetaStore newMetaStore); + void saveFederation(); } diff --git a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/impl/YamlFederatedMetaStoreStorage.java b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/impl/YamlFederatedMetaStoreStorage.java index 5df5a105c..afce52625 100644 --- a/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/impl/YamlFederatedMetaStoreStorage.java +++ b/waggle-dance-core/src/main/java/com/hotels/bdp/waggledance/mapping/service/impl/YamlFederatedMetaStoreStorage.java @@ -182,6 +182,7 @@ public void loadFederation() { } @PreDestroy + @Override public void saveFederation() { if (writeConfigOnShutdown) { yamlMarshaller diff --git a/waggle-dance-integration-tests/src/main/java/com/hotels/bdp/waggledance/WaggleDanceRunner.java b/waggle-dance-integration-tests/src/main/java/com/hotels/bdp/waggledance/WaggleDanceRunner.java index fa0d21d39..f2d7625e3 100644 --- a/waggle-dance-integration-tests/src/main/java/com/hotels/bdp/waggledance/WaggleDanceRunner.java +++ b/waggle-dance-integration-tests/src/main/java/com/hotels/bdp/waggledance/WaggleDanceRunner.java @@ -52,6 +52,7 @@ import com.hotels.bdp.waggledance.conf.GraphiteConfiguration; import com.hotels.bdp.waggledance.conf.WaggleDanceConfiguration; import com.hotels.bdp.waggledance.conf.YamlStorageConfiguration; +import com.hotels.bdp.waggledance.mapping.service.FederatedMetaStoreStorage; import com.hotels.bdp.waggledance.server.MetaStoreProxyServer; import com.hotels.bdp.waggledance.yaml.YamlFactory; import com.hotels.hcommon.hive.metastore.client.tunnelling.MetastoreTunnel; @@ -327,6 +328,10 @@ private MetaStoreProxyServer getProxy() { return applicationContext.getBean(MetaStoreProxyServer.class); } + private FederatedMetaStoreStorage getFederatedMetaStoreStorage() { + return applicationContext.getBean(FederatedMetaStoreStorage.class); + } + public Map run() throws Exception { Map props = populateProperties(); WaggleDance.register(this); @@ -348,6 +353,7 @@ public void waitForService() throws Exception { public void stop() throws Exception { if (applicationContext != null) { getProxy().stop(); + getFederatedMetaStoreStorage().saveFederation(); long delay = 1; while (applicationContext != null) { if (delay >= 15) {