You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2014/04/24 18:55:00 UTC

svn commit: r1589795 - in /jackrabbit/oak/branches/1.0: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java

Author: jukka
Date: Thu Apr 24 16:55:00 2014
New Revision: 1589795

URL: http://svn.apache.org/r1589795
Log:
1.0: Merged revisions 1589488 and 1589794 (OAK-1767)

Modified:
    jackrabbit/oak/branches/1.0/   (props changed)
    jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java

Propchange: jackrabbit/oak/branches/1.0/
------------------------------------------------------------------------------
  Merged /jackrabbit/oak/trunk:r1589488,1589794

Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java?rev=1589795&r1=1589794&r2=1589795&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/TarReader.java Thu Apr 24 16:55:00 2014
@@ -194,20 +194,36 @@ class TarReader {
                         }
 
                         if (memoryMapping) {
-                            FileAccess mapped = new FileAccess.Mapped(access);
-                            // re-read the index, now with memory mapping
-                            int indexSize = index.remaining();
-                            index = mapped.read(
-                                    mapped.length() - indexSize - 16 - 1024,
-                                    indexSize);
-                            return new TarReader(file, mapped, index);
-                        } else {
-                            FileAccess random = new FileAccess.Random(access);
-                            // prevent the finally block from closing the file
-                            // as the returned TarReader will take care of that
-                            access = null;
-                            return new TarReader(file, random, index);
+                            try {
+                                FileAccess mapped = new FileAccess.Mapped(access);
+                                // re-read the index, now with memory mapping
+                                int indexSize = index.remaining();
+                                index = mapped.read(
+                                        mapped.length() - indexSize - 16 - 1024,
+                                        indexSize);
+                                return new TarReader(file, mapped, index);
+                            } catch (IOException e) {
+                                log.warn("Failed to mmap tar file " + file
+                                        + ". Falling back to normal file IO,"
+                                        + " which will negatively impact"
+                                        + " repository performance. This"
+                                        + " problem may have been caused by"
+                                        + " restrictions on the amount of"
+                                        + " virtual memory available to the"
+                                        + " JVM. Please make sure that a"
+                                        + " 64-bit JVM is being used and"
+                                        + " that the process has access to"
+                                        + " unlimited virtual memory"
+                                        + " (ulimit option -v).",
+                                        e);
+                            }
                         }
+
+                        FileAccess random = new FileAccess.Random(access);
+                        // prevent the finally block from closing the file
+                        // as the returned TarReader will take care of that
+                        access = null;
+                        return new TarReader(file, random, index);
                     }
                 } finally {
                     if (access != null) {