You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/08/27 14:53:35 UTC
ambari git commit: AMBARI-12895 After upgrading Ambari to 2.1,
hbase.bucketcache.size value has an "m" added to it preventing region
servers from starting (dsen)
Repository: ambari
Updated Branches:
refs/heads/trunk b0137be7a -> 6e8d00cff
AMBARI-12895 After upgrading Ambari to 2.1, hbase.bucketcache.size value has an "m" added to it preventing region servers from starting (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6e8d00cf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6e8d00cf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6e8d00cf
Branch: refs/heads/trunk
Commit: 6e8d00cffba54e3983b4a0c251b6ff88424998c2
Parents: b0137be
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Aug 27 15:53:18 2015 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Aug 27 15:53:18 2015 +0300
----------------------------------------------------------------------
.../server/upgrade/UpgradeCatalog210.java | 2 +-
.../server/upgrade/UpgradeCatalog212.java | 27 ++++++++++++++++----
.../server/upgrade/UpgradeCatalog212Test.java | 17 +++++++++++-
3 files changed, 39 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6e8d00cf/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index f5a4d28..1981514 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -1680,7 +1680,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
final int regionserver_max_direct_memory_size = regionserver_total_ram - regionserver_heap_size;
final int bucketcache_offheap_memory = regionserver_max_direct_memory_size - reserved_offheap_memory;
- hbaseSiteProps.put("hbase.bucketcache.size", block_cache_heap + bucketcache_offheap_memory + "m");
+ hbaseSiteProps.put("hbase.bucketcache.size", String.valueOf(block_cache_heap + bucketcache_offheap_memory));
hbaseSiteProps.put("hbase.bucketcache.ioengine", "offheap");
hbaseEnvProps.put("hbase_max_direct_memory_size", String.valueOf(regionserver_max_direct_memory_size));
} else {
http://git-wip-us.apache.org/repos/asf/ambari/blob/6e8d00cf/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog212.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog212.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog212.java
index 51ea8f7..02df181 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog212.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog212.java
@@ -53,6 +53,9 @@ import java.util.regex.Matcher;
public class UpgradeCatalog212 extends AbstractUpgradeCatalog {
private static final String HIVE_SITE = "hive-site";
private static final String HIVE_ENV = "hive-env";
+ private static final String HBASE_ENV = "hbase-env";
+ private static final String HBASE_SITE = "hbase-site";
+ private static final String CLUSTER_ENV = "cluster-env";
/**
* Logger.
@@ -134,20 +137,34 @@ public class UpgradeCatalog212 extends AbstractUpgradeCatalog {
if ((clusterMap != null) && !clusterMap.isEmpty()) {
// Iterate through the clusters and perform any configuration updates
for (final Cluster cluster : clusterMap.values()) {
- Config config = cluster.getDesiredConfigByType("hbase-env");
+ Config hbaseEnvProps = cluster.getDesiredConfigByType(HBASE_ENV);
+ Config hbaseSiteProps = cluster.getDesiredConfigByType(HBASE_SITE);
- if (config != null) {
+ if (hbaseEnvProps != null) {
// Remove override_hbase_uid from hbase-env and add override_uid to cluster-env
- String value = config.getProperties().get("override_hbase_uid");
+ String value = hbaseEnvProps.getProperties().get("override_hbase_uid");
if (value != null) {
Map<String, String> updates = new HashMap<String, String>();
Set<String> removes = new HashSet<String>();
updates.put("override_uid", value);
removes.add("override_hbase_uid");
- updateConfigurationPropertiesForCluster(cluster, "hbase-env", new HashMap<String, String>(), removes, false, true);
- updateConfigurationPropertiesForCluster(cluster, "cluster-env", updates, true, false);
+ updateConfigurationPropertiesForCluster(cluster, HBASE_ENV, new HashMap<String, String>(), removes, false, true);
+ updateConfigurationPropertiesForCluster(cluster, CLUSTER_ENV, updates, true, false);
}
}
+
+ if (hbaseSiteProps != null) {
+ String value = hbaseSiteProps.getProperties().get("hbase.bucketcache.size");
+ if (value != null) {
+ if (value.endsWith("m")) {
+ value = value.substring(0, value.length() - 1);
+ Map<String, String> updates = new HashMap<String, String>();
+ updates.put("hbase.bucketcache.size", value);
+ updateConfigurationPropertiesForCluster(cluster, HBASE_SITE, updates, true, false);
+ }
+ }
+
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6e8d00cf/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java
index fa469e4..7a394ca 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java
@@ -163,6 +163,13 @@ public class UpgradeCatalog212Test {
final Clusters mockClusters = easyMockSupport.createStrictMock(Clusters.class);
final Cluster mockClusterExpected = easyMockSupport.createNiceMock(Cluster.class);
+
+ final Map<String, String> propertiesHbaseSite = new HashMap<String, String>() {
+ {
+ put("hbase.bucketcache.size", "1024m");
+ }
+ };
+
final Map<String, String> propertiesHbaseEnv = new HashMap<String, String>() {
{
put("override_hbase_uid", "false");
@@ -171,13 +178,17 @@ public class UpgradeCatalog212Test {
final Config mockHbaseEnv = easyMockSupport.createNiceMock(Config.class);
expect(mockHbaseEnv.getProperties()).andReturn(propertiesHbaseEnv).once();
-
+ final Config mockHbaseSite = easyMockSupport.createNiceMock(Config.class);
+ expect(mockHbaseSite.getProperties()).andReturn(propertiesHbaseSite).once();
final Config mockClusterEnv = easyMockSupport.createNiceMock(Config.class);
final Map<String, String> propertiesExpectedHbaseEnv = new HashMap<String, String>();
final Map<String, String> propertiesExpectedClusterEnv = new HashMap<String, String>() {{
put("override_uid", "false");
}};
+ final Map<String, String> propertiesExpectedHbaseSite = new HashMap<String, String>() {{
+ put("hbase.bucketcache.size", "1024");
+ }};
final Injector mockInjector = Guice.createInjector(new AbstractModule() {
@Override
@@ -198,8 +209,12 @@ public class UpgradeCatalog212Test {
expect(mockClusterExpected.getDesiredConfigByType("cluster-env")).andReturn(mockClusterEnv).atLeastOnce();
expect(mockClusterExpected.getDesiredConfigByType("hbase-env")).andReturn(mockHbaseEnv).atLeastOnce();
+ expect(mockClusterExpected.getDesiredConfigByType("hbase-site")).andReturn(mockHbaseSite).atLeastOnce();
+
expect(mockClusterEnv.getProperties()).andReturn(propertiesExpectedClusterEnv).atLeastOnce();
expect(mockHbaseEnv.getProperties()).andReturn(propertiesExpectedHbaseEnv).atLeastOnce();
+ expect(mockHbaseSite.getProperties()).andReturn(propertiesExpectedHbaseSite).atLeastOnce();
+
easyMockSupport.replayAll();
mockInjector.getInstance(UpgradeCatalog212.class).updateHbaseAndClusterConfigurations();
easyMockSupport.verifyAll();