|
@@ -38,6 +38,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.MutableConfScheduler;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.MutableConfigurationProvider;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore.LogMutation;
|
|
|
import org.apache.hadoop.yarn.webapp.dao.QueueConfigInfo;
|
|
|
import org.apache.hadoop.yarn.webapp.dao.SchedConfUpdateInfo;
|
|
|
import org.junit.After;
|
|
@@ -148,7 +149,7 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
YarnConfigurationStore.LogMutation mutation =
|
|
|
new YarnConfigurationStore.LogMutation(update, TEST_USER);
|
|
|
confStore.logMutation(mutation);
|
|
|
- confStore.confirmMutation(true);
|
|
|
+ confStore.confirmMutation(mutation, true);
|
|
|
long v2 = confStore.getConfigVersion();
|
|
|
assertEquals(2, v2);
|
|
|
}
|
|
@@ -160,10 +161,9 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
|
|
|
Map<String, String> update = new HashMap<>();
|
|
|
update.put("key", "val");
|
|
|
- YarnConfigurationStore.LogMutation mutation =
|
|
|
- new YarnConfigurationStore.LogMutation(update, TEST_USER);
|
|
|
+ LogMutation mutation = new LogMutation(update, TEST_USER);
|
|
|
confStore.logMutation(mutation);
|
|
|
- confStore.confirmMutation(true);
|
|
|
+ confStore.confirmMutation(mutation, true);
|
|
|
assertEquals("val", confStore.retrieve().get("key"));
|
|
|
|
|
|
// Create a new configuration store, and check for updated configuration
|
|
@@ -190,7 +190,7 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
logs = ((ZKConfigurationStore) confStore).getLogs();
|
|
|
assertEquals(1, logs.size());
|
|
|
assertEquals("val1", logs.get(0).getUpdates().get("key1"));
|
|
|
- confStore.confirmMutation(true);
|
|
|
+ confStore.confirmMutation(mutation, true);
|
|
|
assertEquals(1, logs.size());
|
|
|
assertEquals("val1", logs.get(0).getUpdates().get("key1"));
|
|
|
|
|
@@ -202,7 +202,7 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
assertEquals(2, logs.size());
|
|
|
assertEquals("val1", logs.get(0).getUpdates().get("key1"));
|
|
|
assertEquals("val2", logs.get(1).getUpdates().get("key2"));
|
|
|
- confStore.confirmMutation(true);
|
|
|
+ confStore.confirmMutation(mutation, true);
|
|
|
assertEquals(2, logs.size());
|
|
|
assertEquals("val1", logs.get(0).getUpdates().get("key1"));
|
|
|
assertEquals("val2", logs.get(1).getUpdates().get("key2"));
|
|
@@ -216,7 +216,7 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
assertEquals(2, logs.size());
|
|
|
assertEquals("val2", logs.get(0).getUpdates().get("key2"));
|
|
|
assertEquals("val3", logs.get(1).getUpdates().get("key3"));
|
|
|
- confStore.confirmMutation(true);
|
|
|
+ confStore.confirmMutation(mutation, true);
|
|
|
assertEquals(2, logs.size());
|
|
|
assertEquals("val2", logs.get(0).getUpdates().get("key2"));
|
|
|
assertEquals("val3", logs.get(1).getUpdates().get("key3"));
|
|
@@ -308,16 +308,17 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
rm1.getResourceScheduler()).getMutableConfProvider();
|
|
|
UserGroupInformation user = UserGroupInformation
|
|
|
.createUserForTesting(TEST_USER, new String[0]);
|
|
|
- confProvider.logAndApplyMutation(user, schedConfUpdateInfo);
|
|
|
+ LogMutation log = confProvider.logAndApplyMutation(user,
|
|
|
+ schedConfUpdateInfo);
|
|
|
rm1.getResourceScheduler().reinitialize(conf1, rm1.getRMContext());
|
|
|
assertEquals("val", ((MutableConfScheduler) rm1.getResourceScheduler())
|
|
|
.getConfiguration().get("key"));
|
|
|
- confProvider.confirmPendingMutation(true);
|
|
|
+ confProvider.confirmPendingMutation(log, true);
|
|
|
assertEquals("val", ((MutableCSConfigurationProvider) confProvider)
|
|
|
.getConfStore().retrieve().get("key"));
|
|
|
// Next update is not persisted, it should not be recovered
|
|
|
schedConfUpdateInfo.getGlobalParams().put("key", "badVal");
|
|
|
- confProvider.logAndApplyMutation(user, schedConfUpdateInfo);
|
|
|
+ log = confProvider.logAndApplyMutation(user, schedConfUpdateInfo);
|
|
|
|
|
|
// Start RM2 and verifies it starts with updated configuration
|
|
|
rm2.getRMContext().getRMAdminService().transitionToActive(req);
|
|
@@ -400,9 +401,10 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
stopParams.put("capacity", "0");
|
|
|
QueueConfigInfo stopInfo = new QueueConfigInfo("root.default", stopParams);
|
|
|
schedConfUpdateInfo.getUpdateQueueInfo().add(stopInfo);
|
|
|
- confProvider.logAndApplyMutation(user, schedConfUpdateInfo);
|
|
|
+ LogMutation log = confProvider.logAndApplyMutation(user,
|
|
|
+ schedConfUpdateInfo);
|
|
|
rm1.getResourceScheduler().reinitialize(conf1, rm1.getRMContext());
|
|
|
- confProvider.confirmPendingMutation(true);
|
|
|
+ confProvider.confirmPendingMutation(log, true);
|
|
|
assertTrue(Arrays.asList(((MutableConfScheduler) rm1.getResourceScheduler())
|
|
|
.getConfiguration().get("yarn.scheduler.capacity.root.queues").split
|
|
|
(",")).contains("a"));
|
|
@@ -411,9 +413,9 @@ public class TestZKConfigurationStore extends ConfigurationStoreBaseTest {
|
|
|
schedConfUpdateInfo.getUpdateQueueInfo().clear();
|
|
|
schedConfUpdateInfo.getAddQueueInfo().clear();
|
|
|
schedConfUpdateInfo.getRemoveQueueInfo().add("root.default");
|
|
|
- confProvider.logAndApplyMutation(user, schedConfUpdateInfo);
|
|
|
+ log = confProvider.logAndApplyMutation(user, schedConfUpdateInfo);
|
|
|
rm1.getResourceScheduler().reinitialize(conf1, rm1.getRMContext());
|
|
|
- confProvider.confirmPendingMutation(true);
|
|
|
+ confProvider.confirmPendingMutation(log, true);
|
|
|
assertEquals("a", ((MutableConfScheduler) rm1.getResourceScheduler())
|
|
|
.getConfiguration().get("yarn.scheduler.capacity.root.queues"));
|
|
|
|