[
https://issues.apache.org/jira/browse/HDFS-4939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fengdong Yu updated HDFS-4939:
------------------------------
Description:
JNStorage.java
{code}
private static void purgeMatching(File dir, List<Pattern> patterns,
long minTxIdToKeep) throws IOException {
for (File f : FileUtil.listFiles(dir)) {
if (!f.isFile()) continue;
for (Pattern p : patterns) {
Matcher matcher = p.matcher(f.getName());
if (matcher.matches()) {
// This parsing will always succeed since the group(1) is
// /\d+/ in the regex itself.
long txid = Long.valueOf(matcher.group(1));
if (txid < minTxIdToKeep) {
LOG.info("Purging no-longer needed file " + txid);
if (!f.delete()) {
LOG.warn("Unable to delete no-longer-needed data " +
f);
}
break;
}
}
}
}
}
{code}
Why break the for loop here? if so, only delete one file for each retain, am I
right?
was:
JNStorage.java
{code}
private static void purgeMatching(File dir, List<Pattern> patterns,
long minTxIdToKeep) throws IOException {
for (File f : FileUtil.listFiles(dir)) {
if (!f.isFile()) continue;
for (Pattern p : patterns) {
Matcher matcher = p.matcher(f.getName());
if (matcher.matches()) {
// This parsing will always succeed since the group(1) is
// /\d+/ in the regex itself.
long txid = Long.valueOf(matcher.group(1));
if (txid < minTxIdToKeep) {
LOG.info("Purging no-longer needed file " + txid);
if (!f.delete()) {
LOG.warn("Unable to delete no-longer-needed data " +
f);
}
break;
}
}
}
}
}
{code}
Why break the for loop here? if so, only retain one file for each retain, am I
right?
> Retain old edits log, don't retain all minimum required logs
> ------------------------------------------------------------
>
> Key: HDFS-4939
> URL: https://issues.apache.org/jira/browse/HDFS-4939
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: ha, namenode
> Reporter: Fengdong Yu
> Priority: Minor
>
> JNStorage.java
> {code}
> private static void purgeMatching(File dir, List<Pattern> patterns,
> long minTxIdToKeep) throws IOException {
> for (File f : FileUtil.listFiles(dir)) {
> if (!f.isFile()) continue;
> for (Pattern p : patterns) {
> Matcher matcher = p.matcher(f.getName());
> if (matcher.matches()) {
> // This parsing will always succeed since the group(1) is
> // /\d+/ in the regex itself.
> long txid = Long.valueOf(matcher.group(1));
> if (txid < minTxIdToKeep) {
> LOG.info("Purging no-longer needed file " + txid);
> if (!f.delete()) {
> LOG.warn("Unable to delete no-longer-needed data " +
> f);
> }
> break;
> }
> }
> }
> }
> }
> {code}
> Why break the for loop here? if so, only delete one file for each retain, am
> I right?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira