[
https://issues.apache.org/jira/browse/YARN-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13893791#comment-13893791
]
Zhijie Shen commented on YARN-1635:
-----------------------------------
1. Change ATSPutError -> ATSPutErrorCode? Otherwise, the name is duplicate with
ATSPutError POJO.
2. Why is it 10 here? Replace it with some meaningful constant?
{code}
+ public static KeyBuilder newInstance() {
+ return new KeyBuilder(10);
+ }
{code}
3. "atsEntity.setEvents(new ArrayList<ATSEvent>());" is not necessary, right?
Same for the followup invoke of collection setters.
{code}
+ if (fields.contains(Field.EVENTS)) {
+ events = true;
+ atsEntity.setEvents(new ArrayList<ATSEvent>());
+ } else if (fields.contains(Field.LAST_EVENT_ONLY)) {
+ lastEvent = true;
+ atsEntity.setEvents(new ArrayList<ATSEvent>());
+ }
{code}
4. Is it better to combine two conditions as "primaryFilters &&
key\[prefixlen\] == PRIMARY_FILTER_COLUMN\[0\]", and check boolean flag first?
Same for the following conditions.
{code}
+ if (key[prefixlen] == PRIMARY_FILTER_COLUMN[0]) {
+ if (primaryFilters) {
{code}
5. Does CurrentMap work here? Then, we can reduce the synchronization.
{code}
+ private final Map<EntityIdentifier, Long> startTimeCache =
+ Collections.synchronizedMap(new LRUMap(START_TIME_CACHE_SIZE));
{code}
6. Add exception in the javadoc as well
{code}
+ /**
+ * Retrieves a list of entities satisfying given parameters.
+ *
+ * @param base A byte array prefix for the lookup
+ * @param entityType The type of the entity
+ * @param limit A limit on the number of entities to return
+ * @param starttime The earliest entity start time to retrieve (exclusive)
+ * @param endtime The latest entity start time to retrieve (inclusive)
+ * @param secondaryFilters Filter pairs that the entities should match
+ * @param fields The set of fields to retrieve
+ * @return A list of entities
+ */
+ private ATSEntities getEntityByTime(byte[] base,
+ String entityType, Long limit, Long starttime, Long endtime,
+ Collection<NameValuePair> secondaryFilters, EnumSet<Field> fields)
+ throws IOException {
{code}
7. Catch IOException only.
{code}
} catch (Exception e) {
+ LOG.error("Error putting entity " + atsEntity.getEntityId() +
+ " of type " + atsEntity.getEntityType(), e);
+ ATSPutError error = new ATSPutError();
+ error.setEntityId(atsEntity.getEntityId());
+ error.setEntityType(atsEntity.getEntityType());
+ error.setErrorCode(ATSPutError.IO_EXCEPTION);
+ response.addError(error);
+ } finally {
{code}
8. Mark \@VisibleForTesting.
{code}
+ void clearStartTimeCache() {
+ startTimeCache.clear();
+ }
{code}
> Implement a Leveldb based ApplicationTimelineStore
> --------------------------------------------------
>
> Key: YARN-1635
> URL: https://issues.apache.org/jira/browse/YARN-1635
> Project: Hadoop YARN
> Issue Type: Sub-task
> Reporter: Vinod Kumar Vavilapalli
> Assignee: Billie Rinaldi
> Attachments: YARN-1635.1.patch, YARN-1635.10.patch,
> YARN-1635.2.patch, YARN-1635.3.patch, YARN-1635.4.patch, YARN-1635.5.patch,
> YARN-1635.6.patch, YARN-1635.7.patch, YARN-1635.8.patch, YARN-1635.9.patch
>
>
> As per the design doc, we need a levelDB + local-filesystem based
> implementation to start with and for small deployments.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)