[
https://issues.apache.org/jira/browse/HDFS-14104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16919060#comment-16919060
]
Hudson commented on HDFS-14104:
-------------------------------
FAILURE: Integrated in Jenkins build Hadoop-trunk-Commit #17201 (See
[https://builds.apache.org/job/Hadoop-trunk-Commit/17201/])
HDFS-14104. Review getImageTxIdToRetain. Contributed by David Mollitor.
(inigoiri: rev ffca734c62fba26211f22232ddb5e80eae4b5d51)
* (edit)
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorageRetentionManager.java
> Review getImageTxIdToRetain
> ---------------------------
>
> Key: HDFS-14104
> URL: https://issues.apache.org/jira/browse/HDFS-14104
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: namenode
> Affects Versions: 3.0.0
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Minor
> Fix For: 3.3.0
>
> Attachments: HDFS-14104.1.patch, HDFS-14104.1.patch,
> HDFS-14104.1.patch, HDFS-14104.2.patch, HDFS-14104.3.patch,
> HDFS-14104.4.patch, HDFS-14104.5.patch
>
>
> {code:java|title=NNStorageRetentionManager.java}
> private long getImageTxIdToRetain(FSImageTransactionalStorageInspector
> inspector) {
>
> List<FSImageFile> images = inspector.getFoundImages();
> TreeSet<Long> imageTxIds = Sets.newTreeSet();
> for (FSImageFile image : images) {
> imageTxIds.add(image.getCheckpointTxId());
> }
>
> List<Long> imageTxIdsList = Lists.newArrayList(imageTxIds);
> if (imageTxIdsList.isEmpty()) {
> return 0;
> }
>
> Collections.reverse(imageTxIdsList);
> int toRetain = Math.min(numCheckpointsToRetain, imageTxIdsList.size());
>
> long minTxId = imageTxIdsList.get(toRetain - 1);
> LOG.info("Going to retain " + toRetain + " images with txid >= " +
> minTxId);
> return minTxId;
> }
> {code}
> # Fix check style issues
> # Use SLF4J paramaterized logging
> # A lot of work gets done before checking if the list actually contains any
> entries and returning a 0. That should be the first thing that happens
> # Instead of building up the {{TreeSet}} in its natural order, then reversing
> the collection, simply use a reverse natural ordering to begin with and save
> a step.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]