You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2018/05/22 21:24:26 UTC

[accumulo] branch 1.9 updated: Use full path as key in file len cache #467

This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 1.9
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/1.9 by this push:
     new 1180d76  Use full path as key in file len cache #467
1180d76 is described below

commit 1180d76f87315f59aa6310015aeed7fb19937012
Author: Keith Turner <kt...@apache.org>
AuthorDate: Tue May 22 17:21:28 2018 -0400

    Use full path as key in file len cache #467
    
    I had used just the file name as the file len cache key, however I realized
    file names created by older versions of Accumulo may not be unique.  However,
    the path should be unique for older versions because the tablet dir+file name
    was unique.
---
 .../accumulo/core/file/blockfile/impl/CachableBlockFile.java  | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java b/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
index a8d1e74..336ec4d 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
@@ -288,10 +288,9 @@ public class CachableBlockFile {
       this._bc = new BCFile.Reader(this, fsin, len, conf, accumuloConfiguration);
     }
 
-    private static long getFileLen(Cache<String,Long> fileLenCache, final FileSystem fs,
-        final Path path) throws IOException {
+    private long getFileLen(final Path path) throws IOException {
       try {
-        return fileLenCache.get(path.getName(), new Callable<Long>() {
+        return fileLenCache.get(fileName, new Callable<Long>() {
           @Override
           public Long call() throws Exception {
             return fs.getFileStatus(path).getLen();
@@ -316,14 +315,14 @@ public class CachableBlockFile {
 
         if (fileLenCache != null) {
           try {
-            init(fsIn, getFileLen(fileLenCache, fs, path), conf, accumuloConfiguration);
+            init(fsIn, getFileLen(path), conf, accumuloConfiguration);
           } catch (Exception e) {
             log.debug("Failed to open {}, clearing file length cache and retrying", fileName, e);
-            fileLenCache.invalidate(path.getName());
+            fileLenCache.invalidate(fileName);
           }
 
           if (_bc == null) {
-            init(fsIn, getFileLen(fileLenCache, fs, path), conf, accumuloConfiguration);
+            init(fsIn, getFileLen(path), conf, accumuloConfiguration);
           }
         } else {
           init(fsIn, fs.getFileStatus(path).getLen(), conf, accumuloConfiguration);

-- 
To stop receiving notification emails like this one, please contact
kturner@apache.org.