hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fengdong Yu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HDFS-4939) Retain old edits log, don't retain all minimum required logs
Date Wed, 26 Jun 2013 07:00:23 GMT

     [ 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 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 retain 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

Mime
View raw message