Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[AMBARI-24637] Ambari metrics service check failed during UI deploy. …
…(#2316)

* [AMBARI-24637] Ambari metrics service check failed during UI deploy.

* [AMBARI-24637] Ambari metrics service check failed during UI deploy. (2)
  • Loading branch information
avijayanhwx committed Sep 24, 2018
1 parent e76d3ba commit 8a1462b4b2f27d160aca595318c7ffabaa21058b
Showing 2 changed files with 18 additions and 10 deletions.
@@ -299,7 +299,6 @@ public void putIfModifiedHostedAppsMetadata(String hostname, String appId) {
apps = new ConcurrentHashMap<>();
if (timelineMetricHostMetadata == null) {
TimelineMetricHostMetadata newHostMetadata = new TimelineMetricHostMetadata(apps);
newHostMetadata.setUuid(getUuidForHostname(hostname, true));
HOSTED_APPS_MAP.put(hostname, newHostMetadata);
} else {
HOSTED_APPS_MAP.get(hostname).setHostedApps(apps);
@@ -453,17 +452,19 @@ private byte[] getUuidForHostname(String hostname, boolean createIfNotPresent) {
}

byte[] uuid = uuidGenStrategy.computeUuid(hostname, HOSTNAME_UUID_LENGTH);
if (uuidHostMap.containsKey(new TimelineMetricUuid(uuid))) {
LOG.error("Duplicate key computed for " + hostname +", Collides with " + uuidHostMap.get(uuid));
TimelineMetricUuid timelineMetricUuid = new TimelineMetricUuid(uuid);
if (uuidHostMap.containsKey(timelineMetricUuid) && !hostname.equals(uuidHostMap.get(timelineMetricUuid))) {
LOG.error("Duplicate key computed for " + hostname +", Collides with " + uuidHostMap.get(timelineMetricUuid));
return null;
}

if (timelineMetricHostMetadata == null) {
timelineMetricHostMetadata = new TimelineMetricHostMetadata();
HOSTED_APPS_MAP.put(hostname, timelineMetricHostMetadata);
timelineMetricHostMetadata = HOSTED_APPS_MAP.computeIfAbsent(hostname, k -> new TimelineMetricHostMetadata());
if (timelineMetricHostMetadata.getUuid() == null) {
timelineMetricHostMetadata.setUuid(uuid);
}
if (!uuidHostMap.containsKey(timelineMetricUuid)) {
uuidHostMap.put(timelineMetricUuid, hostname);
}
timelineMetricHostMetadata.setUuid(uuid);
uuidHostMap.put(new TimelineMetricUuid(uuid), hostname);

return uuid;
}
@@ -501,6 +502,7 @@ public byte[] getUuid(TimelineClusterMetric timelineClusterMetric, boolean creat
return null;
}

timelineMetricMetadata = METADATA_CACHE.get(key);
if (timelineMetricMetadata == null) {
timelineMetricMetadata = new TimelineMetricMetadata();
timelineMetricMetadata.setMetricName(timelineClusterMetric.getMetricName());
@@ -509,9 +511,14 @@ public byte[] getUuid(TimelineClusterMetric timelineClusterMetric, boolean creat
METADATA_CACHE.put(key, timelineMetricMetadata);
}

timelineMetricMetadata.setUuid(uuid.uuid);
if (timelineMetricMetadata.getUuid() == null) {
timelineMetricMetadata.setUuid(uuid.uuid);
}
timelineMetricMetadata.setIsPersisted(false);
uuidKeyMap.put(uuid, key);

if (!uuidKeyMap.containsKey(uuid)) {
uuidKeyMap.put(uuid, key);
}
return uuid.uuid;
}

@@ -184,6 +184,7 @@ public void testGenerateUuidFromMetric() throws SQLException {
public void testWildcardSanitization() throws IOException, SQLException, URISyntaxException {
// Initialize new manager
metadataManager = new TimelineMetricMetadataManager(new Configuration(), hdb);
hdb.setMetadataInstance(metadataManager);
final long now = System.currentTimeMillis();

TimelineMetrics timelineMetrics = new TimelineMetrics();

0 comments on commit 8a1462b

Please sign in to comment.