You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2017/09/15 18:48:54 UTC
[1/7] qpid-dispatch git commit: DISPATCH-807: Adjust sizes of q2
limits
Repository: qpid-dispatch
Updated Branches:
refs/heads/DISPATCH-807-1 [created] ecdc75103
DISPATCH-807: Adjust sizes of q2 limits
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ecdc7510
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ecdc7510
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ecdc7510
Branch: refs/heads/DISPATCH-807-1
Commit: ecdc75103d89fec10b66af0945c99dcc7eaf4337
Parents: 47be10f
Author: Chuck Rolke <cr...@redhat.com>
Authored: Fri Sep 15 10:01:54 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
include/qpid/dispatch/message.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ecdc7510/include/qpid/dispatch/message.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/message.h b/include/qpid/dispatch/message.h
index 3ad11b0..292434f 100644
--- a/include/qpid/dispatch/message.h
+++ b/include/qpid/dispatch/message.h
@@ -40,8 +40,8 @@
// upper and lower limits for bang bang hysteresis control
//
// Q2 defines the number of buffers allowed in a message's buffer chain
-#define QD_QLIMIT_Q2_UPPER 128
-#define QD_QLIMIT_Q2_LOWER 120
+#define QD_QLIMIT_Q2_UPPER 256
+#define QD_QLIMIT_Q2_LOWER 128
//
// Q3 defines the number of bytes allowed in a session's outgoing_bytes
#define QD_QLIMIT_Q3_UPPER (256 * 1000)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[5/7] qpid-dispatch git commit: DISPATCH-807: Remove delivery arg
from delivery_handler interface
Posted by ch...@apache.org.
DISPATCH-807: Remove delivery arg from delivery_handler interface
Container delivery handler has a qd_link arg and from that the
pn_link and the current pn_delivery may be derived.
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/1c639f10
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/1c639f10
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/1c639f10
Branch: refs/heads/DISPATCH-807-1
Commit: 1c639f101eb286ddde19ec7eeb6447c86a867de7
Parents: 41e363e
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Sep 14 10:33:50 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
include/qpid/dispatch/container.h | 7 ++++---
src/container.c | 2 +-
src/router_node.c | 6 +++++-
3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1c639f10/include/qpid/dispatch/container.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/container.h b/include/qpid/dispatch/container.h
index bcb079c..844c32d 100644
--- a/include/qpid/dispatch/container.h
+++ b/include/qpid/dispatch/container.h
@@ -70,7 +70,8 @@ typedef enum {
typedef struct qd_node_t qd_node_t;
typedef struct qd_link_t qd_link_t;
-typedef void (*qd_container_delivery_handler_t) (void *node_context, qd_link_t *link, pn_delivery_t *delivery);
+typedef void (*qd_container_delivery_handler_t) (void *node_context, qd_link_t *link);
+typedef void (*qd_container_disposition_handler_t) (void *node_context, qd_link_t *link, pn_delivery_t *pnd);
typedef int (*qd_container_link_handler_t) (void *node_context, qd_link_t *link);
typedef int (*qd_container_link_detach_handler_t) (void *node_context, qd_link_t *link, qd_detach_type_t dt);
typedef void (*qd_container_node_handler_t) (void *type_context, qd_node_t *node);
@@ -88,11 +89,11 @@ typedef struct {
* @{
*/
- /** Invoked when a new received delivery is avaliable for processing. */
+ /** Invoked when a new or existing received delivery is avaliable for processing. */
qd_container_delivery_handler_t rx_handler;
/** Invoked when an existing delivery changes disposition or settlement state. */
- qd_container_delivery_handler_t disp_handler;
+ qd_container_disposition_handler_t disp_handler;
/** Invoked when an attach for a new incoming link is received. */
qd_container_link_handler_t incoming_handler;
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1c639f10/src/container.c
----------------------------------------------------------------------
diff --git a/src/container.c b/src/container.c
index 3c3bc49..a99ef35 100644
--- a/src/container.c
+++ b/src/container.c
@@ -172,7 +172,7 @@ static void do_receive(pn_delivery_t *pnd)
if (link) {
qd_node_t *node = link->node;
if (node) {
- node->ntype->rx_handler(node->context, link, pnd);
+ node->ntype->rx_handler(node->context, link);
return;
}
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1c639f10/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 3ed4eac..6672751 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -191,10 +191,14 @@ static qd_iterator_t *router_annotate_message(qd_router_t *router,
/**
* Inbound Delivery Handler
*/
-static void AMQP_rx_handler(void* context, qd_link_t *link, pn_delivery_t *pnd)
+static void AMQP_rx_handler(void* context, qd_link_t *link)
{
qd_router_t *router = (qd_router_t*) context;
pn_link_t *pn_link = qd_link_pn(link);
+ assert(pn_link);
+ pn_delivery_t *pnd = pn_link_current(pn_link);
+ if (!pnd)
+ return;
qdr_link_t *rlink = (qdr_link_t*) qd_link_get_context(link);
qd_connection_t *conn = qd_link_connection(link);
const qd_server_config_t *cf = qd_connection_config(conn);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/7] qpid-dispatch git commit: DISPATCH-807: move q2 holdoff flag
from message into content
Posted by ch...@apache.org.
DISPATCH-807: move q2 holdoff flag from message into content
Random senders free message content buffers. Each sender must be
able to sense the receiver's holdoff state to know when to
schedule a callback. Message content is common to the receiver
and to all the senders.
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/41e363e2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/41e363e2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/41e363e2
Branch: refs/heads/DISPATCH-807-1
Commit: 41e363e2ee3b0b60fd8caf2d06b844dc9265bbe0
Parents: ece8bfe
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Sep 14 10:15:05 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
src/message.c | 4 ++--
src/message_private.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/41e363e2/src/message.c
----------------------------------------------------------------------
diff --git a/src/message.c b/src/message.c
index 12b09ce..c15dd56 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1869,13 +1869,13 @@ int qd_message_get_phase_val(qd_message_t *msg)
void qd_message_set_Q2_input_holdoff(qd_message_t *msg, bool holdoff)
{
- ((qd_message_pvt_t*)msg)->q2_input_holdoff = holdoff;
+ ((qd_message_pvt_t*)msg)->content->q2_input_holdoff = holdoff;
}
bool qd_message_get_Q2_input_holdoff(qd_message_t *msg)
{
- return ((qd_message_pvt_t*)msg)->q2_input_holdoff;
+ return ((qd_message_pvt_t*)msg)->content->q2_input_holdoff;
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/41e363e2/src/message_private.h
----------------------------------------------------------------------
diff --git a/src/message_private.h b/src/message_private.h
index aa01831..9be0f7f 100644
--- a/src/message_private.h
+++ b/src/message_private.h
@@ -112,6 +112,7 @@ typedef struct {
bool discard; // Should this message be discarded?
bool receive_complete; // true if the message has been completely received, false otherwise
sys_atomic_t fanout; // The number of receivers for this message. This number does not include in-process subscribers.
+ bool q2_input_holdoff; // hold off calling pn_link_recv
} qd_message_content_t;
typedef struct {
@@ -127,7 +128,6 @@ typedef struct {
qd_buffer_list_t ma_ingress; // ingress field in outgoing message annotations
int ma_phase; // phase for the override address
bool strip_annotations_in;
- bool q2_input_holdoff;// hold off calling pn_link_recv
} qd_message_pvt_t;
ALLOC_DECLARE(qd_message_t);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[7/7] qpid-dispatch git commit: DISPATCH-807: Implement Q2 throttling
Posted by ch...@apache.org.
DISPATCH-807: Implement Q2 throttling
* Add container accessor for link->node->context
* qd_message_send signals when enough room for q2 resume is available
* Add message accessor for receiving qd_link
* Promote server connection_wake to public
* Use macros to name LOCK, UNLOCK functions for legibility
* Sense and set q2 holdoff in message_receive
* Sense and clear q2 holdoff in message_send
* Add deferred callback for AMQP_rx_handler
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c46cb011
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c46cb011
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c46cb011
Branch: refs/heads/DISPATCH-807-1
Commit: c46cb0115f9f9a1028a3be38622273d4b7db7637
Parents: 1c639f1
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Sep 14 16:01:32 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
include/qpid/dispatch/container.h | 1 +
include/qpid/dispatch/message.h | 11 +++++-
include/qpid/dispatch/server.h | 5 +++
src/container.c | 4 +++
src/message.c | 66 +++++++++++++++++++++++++++-------
src/message_private.h | 3 +-
src/router_node.c | 35 +++++++++++++++++-
7 files changed, 110 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/include/qpid/dispatch/container.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/container.h b/include/qpid/dispatch/container.h
index 844c32d..1a35a1c 100644
--- a/include/qpid/dispatch/container.h
+++ b/include/qpid/dispatch/container.h
@@ -178,6 +178,7 @@ void qd_link_close(qd_link_t *link);
void qd_link_detach(qd_link_t *link);
bool qd_link_drain_changed(qd_link_t *link, bool *mode);
void qd_link_free(qd_link_t *link);
+void *qd_link_get_node_context(const qd_link_t *link);
///@}
#endif
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/include/qpid/dispatch/message.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/message.h b/include/qpid/dispatch/message.h
index e0df420..61e810e 100644
--- a/include/qpid/dispatch/message.h
+++ b/include/qpid/dispatch/message.h
@@ -222,8 +222,10 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery);
*
* @param msg A pointer to a message to be sent.
* @param link The outgoing link on which to send the message.
+ * @param strip_outbound_annotations [in] annotation control flag
+ * @param restart_rx [out] indication to wake up receive process
*/
-void qd_message_send(qd_message_t *msg, qd_link_t *link, bool strip_outbound_annotations);
+void qd_message_send(qd_message_t *msg, qd_link_t *link, bool strip_outbound_annotations, bool *restart_rx);
/**
* Check that the message is well-formed up to a certain depth. Any part of the message that is
@@ -392,6 +394,13 @@ bool qd_message_Q2_holdoff_should_block(qd_message_t *msg);
*/
bool qd_message_Q2_holdoff_should_unblock(qd_message_t *msg);
+/**
+ * Return qd_link through which the message is being received.
+ * @param msg A pointer to the message
+ * @return the qd_link
+ */
+qd_link_t * qd_message_get_receiving_link(const qd_message_t *msg);
+
///@}
#endif
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/include/qpid/dispatch/server.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/server.h b/include/qpid/dispatch/server.h
index 7fa61c3..db25856 100644
--- a/include/qpid/dispatch/server.h
+++ b/include/qpid/dispatch/server.h
@@ -559,4 +559,9 @@ bool is_log_component_enabled(qd_log_bits log_message, char *component_name);
*/
bool qd_connection_strip_annotations_in(const qd_connection_t *c);
+/**
+ * @}
+ */
+void qd_connection_wake(qd_connection_t *ctx);
+
#endif
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/src/container.c
----------------------------------------------------------------------
diff --git a/src/container.c b/src/container.c
index a99ef35..c44d397 100644
--- a/src/container.c
+++ b/src/container.c
@@ -893,3 +893,7 @@ bool qd_link_drain_changed(qd_link_t *link, bool *mode)
}
+void *qd_link_get_node_context(const qd_link_t *link)
+{
+ return (link && link->node) ? link->node->context : 0;
+}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/src/message.c
----------------------------------------------------------------------
diff --git a/src/message.c b/src/message.c
index c15dd56..f82fd47 100644
--- a/src/message.c
+++ b/src/message.c
@@ -36,6 +36,9 @@
#include <inttypes.h>
#include <assert.h>
+#define LOCK sys_mutex_lock
+#define UNLOCK sys_mutex_unlock
+
const char *STR_AMQP_NULL = "null";
const char *STR_AMQP_TRUE = "T";
const char *STR_AMQP_FALSE = "F";
@@ -1140,6 +1143,7 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery)
msg = (qd_message_pvt_t*) qd_message();
qd_link_t *qdl = (qd_link_t *)pn_link_get_context(link);
qd_connection_t *qdc = qd_link_connection(qdl);
+ msg->content->input_link = pn_link_get_context(link);
msg->strip_annotations_in = qd_connection_strip_annotations_in(qdc);
pn_record_def(record, PN_DELIVERY_CTX, PN_WEAKREF);
pn_record_set(record, PN_DELIVERY_CTX, (void*) msg);
@@ -1153,6 +1157,14 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery)
return discard_receive(delivery, link, (qd_message_t *)msg);
}
+ //
+ // If input is in holdoff then just exit. When enough buffers
+ // have been processed and freed by outbound processing then
+ // message holdoff is cleared and receiving may continue.
+ //
+ if (msg->content->q2_input_holdoff) {
+ return (qd_message_t*)msg;
+ }
// Loop until msg is complete, error seen, or incoming bytes are consumed
bool recv_error_or_eos = false;
@@ -1165,7 +1177,7 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery)
if (at_eos || recv_error_or_eos) {
// Message is complete
- sys_mutex_lock(msg->content->lock);
+ LOCK(msg->content->lock);
{
// Append last buffer if any with data
if (msg->content->pending) {
@@ -1183,12 +1195,13 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery)
}
msg->content->receive_complete = true;
+ msg->content->input_link = 0;
// unlink message and delivery
pn_record_set(record, PN_DELIVERY_CTX, 0);
}
- sys_mutex_unlock(msg->content->lock);
- return (qd_message_t*) msg;
+ UNLOCK(msg->content->lock);
+ break;
}
//
@@ -1201,9 +1214,15 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery)
// Pending buffer exists
if (qd_buffer_capacity(msg->content->pending) == 0) {
// Pending buffer is full
- sys_mutex_lock(msg->content->lock);
+ LOCK(msg->content->lock);
DEQ_INSERT_TAIL(msg->content->buffers, msg->content->pending);
- sys_mutex_unlock(msg->content->lock);
+ msg->content->pending = 0;
+ if (qd_message_Q2_holdoff_should_block((qd_message_t *)msg)) {
+ msg->content->q2_input_holdoff = true;
+ UNLOCK(msg->content->lock);
+ break;
+ }
+ UNLOCK(msg->content->lock);
msg->content->pending = qd_buffer();
} else {
// Pending buffer still has capacity
@@ -1233,11 +1252,11 @@ qd_message_t *qd_message_receive(pn_delivery_t *delivery)
// the entire message. We'll be back later to finish it up.
// Return the message so that the caller can start sending out whatever we have received so far
//
- return (qd_message_t*) msg;
+ break;
}
}
- return 0;
+ return (qd_message_t*) msg;
}
@@ -1373,7 +1392,8 @@ static void compose_message_annotations(qd_message_pvt_t *msg, qd_buffer_list_t
void qd_message_send(qd_message_t *in_msg,
qd_link_t *link,
- bool strip_annotations)
+ bool strip_annotations,
+ bool *restart_rx)
{
qd_message_pvt_t *msg = (qd_message_pvt_t*) in_msg;
qd_message_content_t *content = msg->content;
@@ -1381,6 +1401,7 @@ void qd_message_send(qd_message_t *in_msg,
pn_link_t *pnl = qd_link_pn(link);
int fanout = qd_message_fanout(in_msg);
+ *restart_rx = false;
if (msg->sent_depth < QD_DEPTH_MESSAGE_ANNOTATIONS) {
@@ -1491,7 +1512,7 @@ void qd_message_send(qd_message_t *in_msg,
// If the entire message has already been received, taking out this lock is not that expensive
// because there is no contention for this lock.
- sys_mutex_lock(msg->content->lock);
+ LOCK(msg->content->lock);
qd_buffer_t *next_buf = DEQ_NEXT(buf);
if (next_buf) {
@@ -1503,6 +1524,21 @@ void qd_message_send(qd_message_t *in_msg,
DEQ_REMOVE_HEAD(content->buffers);
qd_buffer_free(local_buf);
local_buf = DEQ_HEAD(content->buffers);
+
+ // by freeing a buffer there now may be room to restart a
+ // stalled message receiver
+ if (msg->content->q2_input_holdoff) {
+ if (qd_message_Q2_holdoff_should_unblock((qd_message_t *)msg)) {
+ // wake up receive side
+ // Note: clearing holdoff here is easy compared to
+ // clearing it in the deferred callback. Tracing
+ // shows that rx_handler may run and subsequently
+ // set input holdoff before the deferred handler
+ // runs.
+ msg->content->q2_input_holdoff = false;
+ *restart_rx = true;
+ }
+ }
}
}
msg->cursor.buffer = next_buf;
@@ -1529,7 +1565,7 @@ void qd_message_send(qd_message_t *in_msg,
}
}
- sys_mutex_unlock(msg->content->lock);
+ UNLOCK(msg->content->lock);
buf = next_buf;
}
@@ -1678,9 +1714,9 @@ int qd_message_check(qd_message_t *in_msg, qd_message_depth_t depth)
qd_message_content_t *content = msg->content;
int result;
- sys_mutex_lock(content->lock);
+ LOCK(content->lock);
result = qd_message_check_LH(content, depth);
- sys_mutex_unlock(content->lock);
+ UNLOCK(content->lock);
return result;
}
@@ -1889,3 +1925,9 @@ bool qd_message_Q2_holdoff_should_unblock(qd_message_t *msg)
{
return DEQ_SIZE(((qd_message_pvt_t*)msg)->content->buffers) < QD_QLIMIT_Q2_LOWER;
}
+
+
+qd_link_t * qd_message_get_receiving_link(const qd_message_t *msg)
+{
+ return ((qd_message_pvt_t *)msg)->content->input_link;
+}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/src/message_private.h
----------------------------------------------------------------------
diff --git a/src/message_private.h b/src/message_private.h
index 9be0f7f..f4972ba 100644
--- a/src/message_private.h
+++ b/src/message_private.h
@@ -112,7 +112,8 @@ typedef struct {
bool discard; // Should this message be discarded?
bool receive_complete; // true if the message has been completely received, false otherwise
sys_atomic_t fanout; // The number of receivers for this message. This number does not include in-process subscribers.
- bool q2_input_holdoff; // hold off calling pn_link_recv
+ bool q2_input_holdoff; // hold off calling pn_link_recv
+ qd_link_t *input_link; // message received on this link
} qd_message_content_t;
typedef struct {
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c46cb011/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 6672751..25e4fe7 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -40,6 +40,8 @@ static char *container_role = "route-container";
static char *direct_prefix;
static char *node_id;
+static void deferred_AMQP_rx_handler(void *context, bool discard);
+
/**
* Determine the role of a connection
*/
@@ -229,6 +231,13 @@ static void AMQP_rx_handler(void* context, qd_link_t *link)
message_repr);
}
}
+
+ // Link stalling may have ignored some delivery events.
+ // If there's another delivery pending then reschedule this.
+ pn_delivery_t *npnd = pn_link_current(pn_link);
+ if (npnd) {
+ qd_connection_invoke_deferred(conn, deferred_AMQP_rx_handler, link);
+ }
}
//
@@ -475,6 +484,19 @@ static void AMQP_rx_handler(void* context, qd_link_t *link)
/**
+ * Deferred callback for inbound delivery handler
+ */
+static void deferred_AMQP_rx_handler(void *context, bool discard) {
+ if (!discard) {
+ qd_link_t *qdl = (qd_link_t*)context;
+ qd_router_t *qdr = (qd_router_t *)qd_link_get_node_context(qdl);
+ assert(qdr != 0);
+ AMQP_rx_handler(qdr, qdl);
+ }
+}
+
+
+/**
* Delivery Disposition Handler
*/
static void AMQP_disposition_handler(void* context, qd_link_t *link, pn_delivery_t *pnd)
@@ -1118,7 +1140,18 @@ static void CORE_link_deliver(void *context, qdr_link_t *link, qdr_delivery_t *d
pdlv = pn_link_current(plink);
}
- qd_message_send(qdr_delivery_message(dlv), qlink, qdr_link_strip_annotations_out(link));
+ bool restart_rx = false;
+
+ qd_message_t *msg_out = qdr_delivery_message(dlv);
+ qd_message_send(msg_out, qlink, qdr_link_strip_annotations_out(link), &restart_rx);
+
+ if (restart_rx) {
+ qd_link_t *qdl_in = qd_message_get_receiving_link(msg_out);
+ assert(qdl_in);
+ qd_connection_t *qdc_in = qd_link_connection(qdl_in);
+ assert(qdc_in);
+ qd_connection_invoke_deferred(qdc_in, deferred_AMQP_rx_handler, qdl_in);
+ }
bool send_complete = qdr_delivery_send_complete(dlv);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/7] qpid-dispatch git commit: DISPATCH-807: Define limits, state,
and accessors for Q2 input holdoff
Posted by ch...@apache.org.
DISPATCH-807: Define limits, state, and accessors for Q2 input holdoff
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ece8bfea
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ece8bfea
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ece8bfea
Branch: refs/heads/DISPATCH-807-1
Commit: ece8bfea22fbe4333ed11e86741156913ed95b35
Parents: 02ed034
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Sep 14 09:53:55 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
include/qpid/dispatch/message.h | 41 ++++++++++++++++++++++++++++++++++++
src/message.c | 24 +++++++++++++++++++++
src/message_private.h | 1 +
tests/message_test.c | 33 +++++++++++++++++++++++++++++
4 files changed, 99 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ece8bfea/include/qpid/dispatch/message.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/message.h b/include/qpid/dispatch/message.h
index 111c6a0..e0df420 100644
--- a/include/qpid/dispatch/message.h
+++ b/include/qpid/dispatch/message.h
@@ -36,6 +36,13 @@
* @{
*/
+// DISPATCH-807 Queue depth limits
+// upper and lower limits for bang bang hysteresis control
+//
+// Q2 defines the number of buffers allowed in a message's buffer chain
+#define QD_QLIMIT_Q2_UPPER 128
+#define QD_QLIMIT_Q2_LOWER 120
+
// Callback for status change (confirmed persistent, loaded-in-memory, etc.)
typedef struct qd_message_t qd_message_t;
@@ -351,6 +358,40 @@ size_t qd_message_fanout(qd_message_t *msg);
*/
void qd_message_add_fanout(qd_message_t *msg);
+/**
+ * Setter for message Q2 input_holdoff state
+ *
+ * @param msg A pointer to the message
+ */
+void qd_message_set_Q2_input_holdoff(qd_message_t *msg, bool holdoff);
+
+/**
+ * Accessor for message Q2 input_holdoff state
+ *
+ * @param msg A pointer to the message
+ * @return true if input is being held off
+ */
+bool qd_message_get_Q2_input_holdoff(qd_message_t *msg);
+
+/**
+ * Test if attempt to retreive message data through qd_message_recv should block
+ * due to Q2 input holdoff limit being exceeded. This message has enough
+ * buffers in the internal buffer chain and any calls to to qd_message_receive
+ * will not result in a call to pn_link_receive to retrieve more data.
+ *
+ * @param msg A pointer to the message
+ */
+bool qd_message_Q2_holdoff_should_block(qd_message_t *msg);
+
+/**
+ * Test if a message that is blocked by Q2 input holdoff has enough room
+ * to begin receiving again. This message has transmitted and disposed of
+ * enough buffers to begin receiving more data from the underlying proton link.
+ *
+ * @param msg A pointer to the message
+ */
+bool qd_message_Q2_holdoff_should_unblock(qd_message_t *msg);
+
///@}
#endif
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ece8bfea/src/message.c
----------------------------------------------------------------------
diff --git a/src/message.c b/src/message.c
index 6074ebb..12b09ce 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1865,3 +1865,27 @@ int qd_message_get_phase_val(qd_message_t *msg)
{
return ((qd_message_pvt_t*)msg)->content->ma_int_phase;
}
+
+
+void qd_message_set_Q2_input_holdoff(qd_message_t *msg, bool holdoff)
+{
+ ((qd_message_pvt_t*)msg)->q2_input_holdoff = holdoff;
+}
+
+
+bool qd_message_get_Q2_input_holdoff(qd_message_t *msg)
+{
+ return ((qd_message_pvt_t*)msg)->q2_input_holdoff;
+}
+
+
+bool qd_message_Q2_holdoff_should_block(qd_message_t *msg)
+{
+ return DEQ_SIZE(((qd_message_pvt_t*)msg)->content->buffers) >= QD_QLIMIT_Q2_UPPER;
+}
+
+
+bool qd_message_Q2_holdoff_should_unblock(qd_message_t *msg)
+{
+ return DEQ_SIZE(((qd_message_pvt_t*)msg)->content->buffers) < QD_QLIMIT_Q2_LOWER;
+}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ece8bfea/src/message_private.h
----------------------------------------------------------------------
diff --git a/src/message_private.h b/src/message_private.h
index eab4ae0..aa01831 100644
--- a/src/message_private.h
+++ b/src/message_private.h
@@ -127,6 +127,7 @@ typedef struct {
qd_buffer_list_t ma_ingress; // ingress field in outgoing message annotations
int ma_phase; // phase for the override address
bool strip_annotations_in;
+ bool q2_input_holdoff;// hold off calling pn_link_recv
} qd_message_pvt_t;
ALLOC_DECLARE(qd_message_t);
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ece8bfea/tests/message_test.c
----------------------------------------------------------------------
diff --git a/tests/message_test.c b/tests/message_test.c
index 116e304..0ef1d8b 100644
--- a/tests/message_test.c
+++ b/tests/message_test.c
@@ -61,6 +61,17 @@ static void set_content(qd_message_content_t *content, size_t len)
}
+static void set_content_bufs(qd_message_content_t *content, int nbufs)
+{
+ for (; nbufs > 0; nbufs--) {
+ qd_buffer_t *buf = qd_buffer();
+ size_t segment = qd_buffer_capacity(buf);
+ qd_buffer_insert(buf, segment);
+ DEQ_INSERT_TAIL(content->buffers, buf);
+ }
+}
+
+
static char* test_send_to_messenger(void *context)
{
qd_message_t *msg = qd_message();
@@ -314,6 +325,27 @@ static char* test_send_message_annotations(void *context)
}
+static char* test_q2_input_holdoff_sensing(void *context)
+{
+ if (QD_QLIMIT_Q2_LOWER >= QD_QLIMIT_Q2_UPPER)
+ return "QD_LIMIT_Q2 lower limit is bigger than upper limit";
+
+ for (int nbufs=1; nbufs<QD_QLIMIT_Q2_UPPER + 1; nbufs++) {
+ qd_message_t *msg = qd_message();
+ qd_message_content_t *content = MSG_CONTENT(msg);
+
+ set_content_bufs(content, nbufs);
+ if (qd_message_Q2_holdoff_should_block(msg) != (nbufs >= QD_QLIMIT_Q2_UPPER))
+ return "qd_message_holdoff_would_block was miscalculated";
+ if (qd_message_Q2_holdoff_should_unblock(msg) != (nbufs < QD_QLIMIT_Q2_LOWER))
+ return "qd_message_holdoff_would_unblock was miscalculated";
+
+ qd_message_free(msg);
+ }
+ return 0;
+}
+
+
int message_tests(void)
{
int result = 0;
@@ -324,6 +356,7 @@ int message_tests(void)
TEST_CASE(test_message_properties, 0);
TEST_CASE(test_check_multiple, 0);
TEST_CASE(test_send_message_annotations, 0);
+ TEST_CASE(test_q2_input_holdoff_sensing, 0);
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[6/7] qpid-dispatch git commit: DISPATCH-807: Implement Q3 limits
based on send session outgoing bytes
Posted by ch...@apache.org.
DISPATCH-807: Implement Q3 limits based on send session outgoing bytes
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/47be10f5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/47be10f5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/47be10f5
Branch: refs/heads/DISPATCH-807-1
Commit: 47be10f59dc7b0ae16275a3409b7f40aef177783
Parents: ff9d9ed
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Sep 14 17:00:09 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
include/qpid/dispatch/message.h | 3 +++
src/message.c | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/47be10f5/include/qpid/dispatch/message.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/message.h b/include/qpid/dispatch/message.h
index 61e810e..3ad11b0 100644
--- a/include/qpid/dispatch/message.h
+++ b/include/qpid/dispatch/message.h
@@ -42,6 +42,9 @@
// Q2 defines the number of buffers allowed in a message's buffer chain
#define QD_QLIMIT_Q2_UPPER 128
#define QD_QLIMIT_Q2_LOWER 120
+//
+// Q3 defines the number of bytes allowed in a session's outgoing_bytes
+#define QD_QLIMIT_Q3_UPPER (256 * 1000)
// Callback for status change (confirmed persistent, loaded-in-memory, etc.)
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/47be10f5/src/message.c
----------------------------------------------------------------------
diff --git a/src/message.c b/src/message.c
index f82fd47..16ced8c 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1497,10 +1497,11 @@ void qd_message_send(qd_message_t *in_msg,
}
buf = msg->cursor.buffer;
-
assert (buf);
- while (buf) {
+ pn_session_t *pns = pn_link_session(pnl);
+
+ while (buf && pn_session_outgoing_bytes(pns) < QD_QLIMIT_Q3_UPPER) {
size_t buf_size = qd_buffer_size(buf);
// This will send the remaining data in the buffer if any.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/7] qpid-dispatch git commit: DISPATCH-807: remove asserts for
items that disappear regularly
Posted by ch...@apache.org.
DISPATCH-807: remove asserts for items that disappear regularly
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ff9d9ed8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ff9d9ed8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ff9d9ed8
Branch: refs/heads/DISPATCH-807-1
Commit: ff9d9ed8d2c500d9088553ba2622d70aa194e70b
Parents: c46cb01
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Sep 14 16:47:33 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Sep 15 14:47:26 2017 -0400
----------------------------------------------------------------------
src/router_node.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ff9d9ed8/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 25e4fe7..a7f50fa 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -1147,10 +1147,12 @@ static void CORE_link_deliver(void *context, qdr_link_t *link, qdr_delivery_t *d
if (restart_rx) {
qd_link_t *qdl_in = qd_message_get_receiving_link(msg_out);
- assert(qdl_in);
- qd_connection_t *qdc_in = qd_link_connection(qdl_in);
- assert(qdc_in);
- qd_connection_invoke_deferred(qdc_in, deferred_AMQP_rx_handler, qdl_in);
+ if (qdl_in) {
+ qd_connection_t *qdc_in = qd_link_connection(qdl_in);
+ if (qdc_in) {
+ qd_connection_invoke_deferred(qdc_in, deferred_AMQP_rx_handler, qdl_in);
+ }
+ }
}
bool send_complete = qdr_delivery_send_complete(dlv);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org