You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2019/01/30 15:46:29 UTC

[geode] branch feature/GEODE-2113e updated: removing debug log statements

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

bschuchardt pushed a commit to branch feature/GEODE-2113e
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-2113e by this push:
     new 3342e93  removing debug log statements
3342e93 is described below

commit 3342e9321fc39c3651115640daf46a08a981ca4e
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Tue Jan 29 16:00:32 2019 -0800

    removing debug log statements
---
 .../apache/geode/internal/net/NioPlainEngine.java  |  9 ----
 .../apache/geode/internal/net/NioSslEngine.java    | 51 ++++++++++------------
 .../org/apache/geode/internal/tcp/Connection.java  | 10 -----
 .../org/apache/geode/internal/tcp/MsgReader.java   | 31 -------------
 4 files changed, 22 insertions(+), 79 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioPlainEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioPlainEngine.java
index 1e83c40..bf868f2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/net/NioPlainEngine.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioPlainEngine.java
@@ -82,10 +82,6 @@ public class NioPlainEngine implements NioFilter {
       DMStats stats) throws IOException {
     ByteBuffer buffer = wrappedBuffer;
 
-    // logger.info("BRUCE: readAtLeast({}) lastProcessedPosition={} lastReadPosition={} buffer
-    // capacity={}",
-    // bytes, lastProcessedPosition, lastReadPosition, buffer.capacity());
-
     Assert.assertTrue(buffer.capacity() - lastProcessedPosition >= bytes);
 
     // read into the buffer starting at the end of valid data
@@ -108,15 +104,10 @@ public class NioPlainEngine implements NioFilter {
     buffer.position(lastProcessedPosition);
     lastProcessedPosition += bytes;
 
-    // logger.info("BRUCE: readAtLeast new lastProcessedPosition={} lastReadPosition={}",
-    // lastProcessedPosition, lastReadPosition);
-
     return buffer;
   }
 
   public void doneReading(ByteBuffer unwrappedBuffer) {
-    // logger.info("BRUCE: nioFilter is compacting {}",
-    // Integer.toHexString(System.identityHashCode(unwrappedBuffer)));
     if (unwrappedBuffer.position() != 0) {
       unwrappedBuffer.compact();
     } else {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
index 84d4f54..2294c9f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java
@@ -323,38 +323,31 @@ public class NioSslEngine implements NioFilter {
   @Override
   public ByteBuffer readAtLeast(SocketChannel channel, int bytes,
       ByteBuffer wrappedBuffer, DMStats stats) throws IOException {
-    try {
-      if (peerAppData.capacity() > bytes) {
-        // we already have a buffer that's big enough
-        if (peerAppData.capacity() - peerAppData.position() < bytes) {
-          peerAppData.compact();
-          peerAppData.flip();
-        }
-      } else {
-        peerAppData =
-            Buffers.expandReadBufferIfNeeded(TRACKED_RECEIVER, peerAppData, bytes, this.stats);
+    if (peerAppData.capacity() > bytes) {
+      // we already have a buffer that's big enough
+      if (peerAppData.capacity() - peerAppData.position() < bytes) {
+        peerAppData.compact();
+        peerAppData.flip();
       }
+    } else {
+      peerAppData =
+          Buffers.expandReadBufferIfNeeded(TRACKED_RECEIVER, peerAppData, bytes, this.stats);
+    }
 
-      while (peerAppData.remaining() < bytes) {
-        wrappedBuffer.limit(wrappedBuffer.capacity());
-        int amountRead = channel.read(wrappedBuffer);
-        if (amountRead < 0) {
-          throw new EOFException();
-        }
-        if (amountRead > 0) {
-          wrappedBuffer.flip();
-          // prep the decoded buffer for writing
-          peerAppData.compact();
-          peerAppData = unwrap(wrappedBuffer);
-          // done writing to the decoded buffer - prep it for reading again
-          peerAppData.flip();
-        }
+    while (peerAppData.remaining() < bytes) {
+      wrappedBuffer.limit(wrappedBuffer.capacity());
+      int amountRead = channel.read(wrappedBuffer);
+      if (amountRead < 0) {
+        throw new EOFException();
+      }
+      if (amountRead > 0) {
+        wrappedBuffer.flip();
+        // prep the decoded buffer for writing
+        peerAppData.compact();
+        peerAppData = unwrap(wrappedBuffer);
+        // done writing to the decoded buffer - prep it for reading again
+        peerAppData.flip();
       }
-    } catch (IOException | RuntimeException | Error e) {
-      logger.warn(
-          "BRUCE: PID " + OSProcess.getId() + ", MsgReader.readAtLeast() is throwing an exception",
-          e);
-      throw e;
     }
     return peerAppData;
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index 2f6c5ba..941bd55 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -748,7 +748,6 @@ public class Connection implements Runnable {
   }
 
   private void notifyHandshakeWaiter(boolean success) {
-    // logger.info("BRUCE: notifyHandshakeWaiter invoked", new Exception("stack trace"));
     synchronized (this.handshakeSync) {
       if (success) {
         this.handshakeRead = true;
@@ -1582,7 +1581,6 @@ public class Connection implements Runnable {
       // make sure that if the reader thread exits we notify a thread waiting
       // for the handshake.
       // see bug 37524 for an example of listeners hung in waitForHandshake
-      // logger.info("BRUCE: run() invoking notifyHandshakeWaiter(false)");
       notifyHandshakeWaiter(false);
       this.readerThread.setName("unused p2p reader");
       synchronized (this.stateLock) {
@@ -1734,7 +1732,6 @@ public class Connection implements Runnable {
                 logger.debug("handshake has been cancelled {}", this);
               }
             }
-            // logger.info("BRUCE: handshake thread setting isHandshakeReader=true");
             isHandShakeReader = true;
             // Once we have read the handshake the reader can go away
             break;
@@ -2909,10 +2906,6 @@ public class Connection implements Runnable {
    */
   private void processInputBuffer() throws ConnectionException, IOException {
 
-    // logger.info("BRUCE: processInputBuffer hash={} postion={} limit={}",
-    // Integer.toHexString(System.identityHashCode(inputBuffer)), inputBuffer.position(),
-    // inputBuffer.limit());
-
     inputBuffer.flip();
 
     ByteBuffer peerDataBuffer = ioFilter.unwrap(inputBuffer);
@@ -2972,7 +2965,6 @@ public class Connection implements Runnable {
           }
         }
       } else {
-        // logger.info("BRUCE: processInputBuffer invoking doneReading");
         ioFilter.doneReading(peerDataBuffer);
         done = true;
       }
@@ -3289,10 +3281,8 @@ public class Connection implements Runnable {
   private void readHandshakeForSender(DataInputStream dis, ByteBuffer peerDataBuffer) {
     try {
       this.replyCode = dis.readUnsignedByte();
-      // logger.info("BRUCE: readHandshakeForSender read replyCode {}", replyCode);
       switch (replyCode) {
         case REPLY_CODE_OK:
-          // logger.info("BRUCE: notifying handshake waitier - reply_code_ok");
           ioFilter.doneReading(peerDataBuffer);
           notifyHandshakeWaiter(true);
           return;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgReader.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgReader.java
index 1512526..830ad38 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgReader.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgReader.java
@@ -62,8 +62,6 @@ public class MsgReader {
   Header readHeader() throws IOException {
     ByteBuffer unwrappedBuffer = readAtLeast(Connection.MSG_HEADER_BYTES);
 
-    // logger.info("BRUCE: MsgReader.readHeader buffer position {} limit {}",
-    // unwrappedBuffer.position(), unwrappedBuffer.limit());
     Assert.assertTrue(unwrappedBuffer.remaining() >= Connection.MSG_HEADER_BYTES);
 
     int position = unwrappedBuffer.position();
@@ -86,10 +84,7 @@ public class MsgReader {
 
       return header;
     } catch (BufferUnderflowException e) {
-      dumpState("BufferUnderflowException", e, unwrappedBuffer, position, limit);
       throw e;
-    } finally {
-      dumpState("readHeader", null, unwrappedBuffer, position, limit);
     }
 
   }
@@ -113,10 +108,8 @@ public class MsgReader {
       // dumpState("readMessage ready to deserialize", null, nioInputBuffer, position, limit);
       return (DistributionMessage) InternalDataSerializer.readDSFID(byteBufferInputStream);
     } catch (RuntimeException e) {
-      dumpState("readMessage(1)", e, nioInputBuffer, position, limit);
       throw e;
     } catch (IOException e) {
-      dumpState("readMessage(2)", e, nioInputBuffer, position, limit);
       throw e;
     } finally {
       this.getStats().endMsgDeserialization(startSer);
@@ -125,23 +118,6 @@ public class MsgReader {
     }
   }
 
-  private void dumpState(String whereFrom, Throwable e, ByteBuffer inputBuffer, int position,
-      int limit) {
-    logger.info("BRUCE: {}, PID {} Connection to {}, {} SSL", whereFrom, OSProcess.getId(),
-        conn.getRemoteAddress(), conn.getConduit().useSSL() ? "with" : "without");
-    logger.info("BRUCE: {}, Message length {}; type {}; id {}",
-        whereFrom, header.messageLength, header.messageType, header.messageId);
-    logger.info(
-        "BRUCE: {}, starting buffer position {}; buffer limit {} capacity {} buffer hash {}",
-        whereFrom, position, limit, inputBuffer.capacity(),
-        Integer.toHexString(System.identityHashCode(inputBuffer)));
-    logger.info("BRUCE: {}, current buffer position {}; buffer limit {}",
-        whereFrom, inputBuffer.position(), inputBuffer.limit());
-    if (e != null) {
-      logger.info("BRUCE: Exception reading message", e);
-    }
-  }
-
   void readChunk(Header header, MsgDestreamer md)
       throws IOException {
     ByteBuffer unwrappedBuffer = readAtLeast(header.messageLength);
@@ -154,15 +130,8 @@ public class MsgReader {
 
 
   private ByteBuffer readAtLeast(int bytes) throws IOException {
-    // logger.info("BRUCE: ensureWrappedCapacity need {} buffer {} position {} limit {} capacity
-    // {}", bytes,
-    // Integer.toHexString(System.identityHashCode(peerNetData)), peerNetData.position(),
-    // peerNetData.limit(), peerNetData.capacity());
     peerNetData = ioFilter.ensureWrappedCapacity(bytes, peerNetData,
         Buffers.BufferType.TRACKED_RECEIVER, getStats());
-    // logger.info("BRUCE: result buffer {} position {} limit {} capacity {}",
-    // Integer.toHexString(System.identityHashCode(peerNetData)), peerNetData.position(),
-    // peerNetData.limit(), peerNetData.capacity());
     return ioFilter.readAtLeast(conn.getSocket().getChannel(), bytes, peerNetData, getStats());
   }