YARN-6228: EntityGroupFSTimelineStore should allow configurable cache

stores. Contributed by Li Lu

(cherry picked from commit 53d372a255)
This commit is contained in:
Xuan 2017-02-24 10:58:48 -08:00
parent c097d0343c
commit 19c5b3d622
3 changed files with 15 additions and 2 deletions

View File

@ -1846,6 +1846,9 @@ public class YarnConfiguration extends Configuration {
public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX = public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX =
TIMELINE_SERVICE_PREFIX + "entity-group-fs-store."; TIMELINE_SERVICE_PREFIX + "entity-group-fs-store.";
public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CACHE_STORE =
TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "cache-store-class";
public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_ACTIVE_DIR = public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_ACTIVE_DIR =
TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "active-dir"; TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "active-dir";

View File

@ -2080,6 +2080,11 @@
</property> </property>
<!-- Timeline Service v1.5 Configuration --> <!-- Timeline Service v1.5 Configuration -->
<property>
<name>yarn.timeline-service.entity-group-fs-store.cache-store-class</name>
<value>org.apache.hadoop.yarn.server.timeline.MemoryTimelineStore</value>
<description>Caching storage timeline server v1.5 is using. </description>
</property>
<property> <property>
<name>yarn.timeline-service.entity-group-fs-store.active-dir</name> <name>yarn.timeline-service.entity-group-fs-store.active-dir</name>

View File

@ -17,8 +17,10 @@
package org.apache.hadoop.yarn.server.timeline; package org.apache.hadoop.yarn.server.timeline;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.Time; import org.apache.hadoop.util.Time;
import org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId; import org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager; import org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -95,8 +97,11 @@ public class EntityCacheItem {
} }
if (!appLogs.getDetailLogs().isEmpty()) { if (!appLogs.getDetailLogs().isEmpty()) {
if (store == null) { if (store == null) {
store = new LevelDBCacheTimelineStore(groupId.toString(), store = ReflectionUtils.newInstance(config.getClass(
"LeveldbCache." + groupId); YarnConfiguration
.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CACHE_STORE,
MemoryTimelineStore.class, TimelineStore.class),
config);
store.init(config); store.init(config);
store.start(); store.start();
} else { } else {