Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4854

Enhance Logging for Client Connection Socket Selection in ZooKeeper

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.9.2
    • None
    • server
    • None
    • Zookeeper Version: 3.9.2
      Location: `zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java`, in `getClientCnxnSocket` method. Lines 3073--3077.

    Description

      The ZooKeeper class currently selects a client connection socket implementation (ClientCnxnSocket) based on a configuration parameter (zookeeper.clientCnxnSocket). However, the current implementation does not log the outcome of this selection, making it difficult to debug issues related to socket selection or understand the behavior of the client in different environments. The proposed enhancement adds logging to expose the decision-making process, providing clearer insights into which socket is being used and whether the configuration was set correctly.
       
      Expected Behavior:
      When the zookeeper.clientCnxnSocket property is set to a valid value (e.g., ClientCnxnSocketNetty), the log should indicate that this specific socket is being used. If the property is not set or is set to the default value (ClientCnxnSocketNIO), the log should confirm that the default socket is in use. If the property is set to an unrecognized value, the log should warn that the system is defaulting to ClientCnxnSocketNIO.
       
      How-to-Fix:
      Introduce logging within the getClientCnxnSocket method to capture and report the configuration state of the ZOOKEEPER_CLIENT_CNXN_SOCKET parameter. This enhancement will help trace which client connection socket implementation is selected—whether it's the default ClientCnxnSocketNIO, a specified alternative like ClientCnxnSocketNetty, or an unrecognized value that causes a fallback to the default. The added log statements will improve transparency and aid in debugging by providing clear and actionable information in the logs.

      Attachments

        1. original-vs-log-enhanced.md
          4 kB
          LoggingResearch
        2. ZooKeeperTest.java
          2 kB
          LoggingResearch

        Activity

          People

            Unassigned Unassigned
            loggingresearch LoggingResearch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: