Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor debug fixes

  • Loading branch information...
commit f97699b18a423c4717c0a7e8af4224201cbbc242 1 parent a18d91b
@vinothchandar vinothchandar authored
View
4 META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
-Created-By: 20.1-b02 (Sun Microsystems Inc.)
+Created-By: 20.2-b06 (Sun Microsystems Inc.)
Implementation-Title: Voldemort
-Implementation-Version: 1.1.4
+Implementation-Version: 1.1.7
Implementation-Vendor: LinkedIn
View
9 src/java/voldemort/store/readonly/io/MemLock.java
@@ -13,7 +13,7 @@
public class MemLock implements Closeable {
- private static final Logger log = Logger.getLogger(MemLock.class);
+ private static final Logger logger = Logger.getLogger(MemLock.class);
private Pointer pa;
private long length;
@@ -33,8 +33,8 @@
*/
public MemLock(File file, FileDescriptor descriptor, long offset, long length)
throws IOException {
-
- log.debug("mlocking " + file + " with length " + length);
+ if(logger.isDebugEnabled())
+ logger.debug("mlocking " + file + " with length " + length);
this.setFile(file);
this.setDescriptor(descriptor);
@@ -61,7 +61,8 @@ public void close() throws IOException {
mman.munlock(pa, length);
mman.munmap(pa, length);
- log.debug("munlocking " + file + " with length " + length);
+ if(logger.isDebugEnabled())
+ logger.debug("munlocking " + file + " with length " + length);
}
View
33 src/java/voldemort/store/readonly/io/jna/mman.java
@@ -46,8 +46,8 @@ public static Pointer mmap(long len, int prot, int flags, int fildes, long off)
new NativeLong(off));
if(Pointer.nativeValue(result) == -1) {
-
- logger.debug(errno.strerror());
+ if(logger.isDebugEnabled())
+ logger.debug(errno.strerror());
}
return result;
@@ -59,7 +59,8 @@ public static int munmap(Pointer addr, long len) throws IOException {
int result = Delegate.munmap(addr, new NativeLong(len));
if(result != 0) {
- logger.debug(errno.strerror());
+ if(logger.isDebugEnabled())
+ logger.debug(errno.strerror());
}
return result;
@@ -70,12 +71,13 @@ public static void mlock(Pointer addr, long len) throws IOException {
int res = Delegate.mlock(addr, new NativeLong(len));
if(res != 0) {
- String error = errno.strerror();
- logger.warn("Mlock failed probably because of insufficient privileges");
- logger.debug(error);
- logger.debug(res);
+ if(logger.isDebugEnabled()) {
+ logger.debug("Mlock failed probably because of insufficient privileges, errno:"
+ + errno.strerror() + ", return value:" + res);
+ }
} else {
- logger.debug("Mlock successfull");
+ if(logger.isDebugEnabled())
+ logger.debug("Mlock successfull");
}
@@ -87,11 +89,12 @@ public static void mlock(Pointer addr, long len) throws IOException {
public static void munlock(Pointer addr, long len) throws IOException {
if(Delegate.munlock(addr, new NativeLong(len)) != 0) {
- logger.warn(errno.strerror());
+ if(logger.isDebugEnabled())
+ logger.debug("munlocking failed with errno:" + errno.strerror());
} else {
- logger.debug("munlocking region");
+ if(logger.isDebugEnabled())
+ logger.debug("munlocking region");
}
-
}
static class Delegate {
@@ -122,13 +125,13 @@ public static void main(String[] args) throws Exception {
File file = new File(path);
FileInputStream in = new FileInputStream(file);
int fd = voldemort.store.readonly.io.Native.getFd(in.getFD());
-
- logger.debug("File descriptor is: " + fd);
+ if(logger.isDebugEnabled())
+ logger.debug("File descriptor is: " + fd);
// mmap a large file...
Pointer addr = mmap(file.length(), PROT_READ, mman.MAP_SHARED | mman.MAP_ALIGN, fd, 0L);
-
- logger.debug("mmap address is: " + Pointer.nativeValue(addr));
+ if(logger.isDebugEnabled())
+ logger.debug("mmap address is: " + Pointer.nativeValue(addr));
// try to mlock it directly
mlock(addr, file.length());
Please sign in to comment.
Something went wrong with that request. Please try again.