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

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new b74f47867f ARTEMIS-4434 Some trivial logging about Redistribution
b74f47867f is described below

commit b74f47867f1a0e4aed56d38c9fbea5326da1c2d3
Author: Clebert Suconic <[email protected]>
AuthorDate: Thu Sep 21 09:59:31 2023 -0400

    ARTEMIS-4434 Some trivial logging about Redistribution
---
 .../activemq/artemis/core/postoffice/impl/BindingsImpl.java       | 8 +++++++-
 .../activemq/artemis/core/postoffice/impl/PostOfficeImpl.java     | 7 +++++++
 .../activemq/artemis/core/server/cluster/impl/Redistributor.java  | 4 ++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
index 5f8ad7e3ce..a1339a1a77 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
@@ -218,16 +218,20 @@ public final class BindingsImpl implements Bindings {
                                final RoutingContext context) throws Exception {
       final MessageLoadBalancingType loadBalancingType = 
this.messageLoadBalancingType;
       if (loadBalancingType.equals(MessageLoadBalancingType.STRICT) || 
loadBalancingType.equals(MessageLoadBalancingType.OFF)) {
+         logger.debug("Rejecting redistribution of message={} as the 
loadBalancingType is {}", message, loadBalancingType);
          return null;
       }
 
-      logger.trace("Redistributing message {}", message);
+      if (logger.isDebugEnabled()) {
+         logger.debug("Redistributing message {}, originatingQueue={}, 
currentBindings={}", message, originatingQueue.getName(), this.name);
+      }
 
       final SimpleString routingName = 
CompositeAddress.isFullyQualified(message.getAddress()) && 
originatingQueue.getRoutingType() == RoutingType.ANYCAST ? 
CompositeAddress.extractAddressName(message.getAddressSimpleString()) : 
originatingQueue.getName();
 
       final Pair<Binding[], CopyOnWriteBindings.BindingIndex> 
bindingsAndPosition = routingNameBindingMap.getBindings(routingName);
 
       if (bindingsAndPosition == null) {
+         logger.debug("Rejecting message redistribution for message={} as 
bindingsAndPosition is null", message);
          // The value can become null if it's concurrently removed while we're 
iterating - this is expected
          // ConcurrentHashMap behaviour!
          return null;
@@ -259,6 +263,7 @@ public final class BindingsImpl implements Bindings {
          }
       }
       if (nextBinding == null) {
+         logger.debug("there was no nextBinding, returning null while 
redistributing message={}", message);
          return null;
       }
 
@@ -279,6 +284,7 @@ public final class BindingsImpl implements Bindings {
 
       bindingIndex.setIndex(nextPosition);
       nextBinding.route(copyRedistribute, context);
+      logger.debug("Redistribution successful on message={}, towards 
bindings={}", message, bindings);
       return copyRedistribute;
    }
 
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 738fbef3f6..bb6502605d 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -1394,6 +1394,9 @@ public class PostOfficeImpl implements PostOffice, 
NotificationListener, Binding
       Bindings bindings = 
addressManager.getBindingsForRoutingAddress(message.getAddressSimpleString());
 
       if (bindings != null && bindings.allowRedistribute()) {
+         if (logger.isDebugEnabled()) {
+            logger.debug("Redistributing message {}, originatingQueue={}, 
bindings={}", message, originatingQueue.getName(), bindings);
+         }
          RoutingContext context = new RoutingContextImpl(null);
 
          // the redistributor will make a copy of the message if it can be 
redistributed
@@ -1401,7 +1404,11 @@ public class PostOfficeImpl implements PostOffice, 
NotificationListener, Binding
 
          if (redistributedMessage != null) {
             return new Pair<>(context, redistributedMessage);
+         } else {
+            logger.debug("Redistribution of message {} did not happen because 
bindings.redistribute returned null", message);
          }
+      } else {
+         logger.debug("not able to redistribute message={} towards 
bindings={}", message, bindings);
       }
 
       return null;
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java
index ac4992e18e..8d223a5ba6 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java
@@ -113,6 +113,10 @@ public class Redistributor implements Consumer {
          return HandleStatus.NO_MATCH;
       }
 
+      if (logger.isDebugEnabled()) {
+         logger.debug("Redistributing message {}, originatingQueue={}", 
reference.getMessage(), queue.getName());
+      }
+
       final Pair<RoutingContext, Message> routingInfo = 
postOffice.redistribute(reference.getMessage(), queue);
 
       if (routingInfo == null) {

Reply via email to