You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by ganeshmurthy <gi...@git.apache.org> on 2017/06/19 15:02:28 UTC

[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

GitHub user ganeshmurthy opened a pull request:

    https://github.com/apache/qpid-dispatch/pull/167

    DISPATCH-788 - First attempt at adding a core thread API around handl…

    …ing of peers. The next step is to introduce a list to hold more than one peer

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ganeshmurthy/qpid-dispatch DISPATCH-788-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-dispatch/pull/167.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #167
    
----
commit aca3494ee3f51fa253be657aa3bdd095ec9a2adf
Author: Ganesh Murthy <gm...@redhat.com>
Date:   2017-06-19T14:57:26Z

    DISPATCH-788 - First attempt at adding a core thread API around handling of peers. The next step is to introduce a list to hold more than one peer

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ganeshmurthy <gi...@git.apache.org>.
Github user ganeshmurthy closed the pull request at:

    https://github.com/apache/qpid-dispatch/pull/167


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r122777702
  
    --- Diff: src/router_core/forwarder.c ---
    @@ -101,33 +101,26 @@ static void qdr_forward_find_closest_remotes_CT(qdr_core_t *core, qdr_address_t
     
     qdr_delivery_t *qdr_forward_new_delivery_CT(qdr_core_t *core, qdr_delivery_t *in_dlv, qdr_link_t *link, qd_message_t *msg)
     {
    -    qdr_delivery_t *dlv = new_qdr_delivery_t();
    -    uint64_t       *tag = (uint64_t*) dlv->tag;
    -
    -    ZERO(dlv);
    -    sys_atomic_init(&dlv->ref_count, 0);
    -    dlv->link       = link;
    -    dlv->msg        = qd_message_copy(msg);
    -    dlv->settled    = !in_dlv || in_dlv->settled;
    -    dlv->presettled = dlv->settled;
    +    qdr_delivery_t *out_dlv = new_qdr_delivery_t();
    +    uint64_t       *tag = (uint64_t*) out_dlv->tag;
    +
    +    ZERO(out_dlv);
    +    sys_atomic_init(&out_dlv->ref_count, 0);
    +    out_dlv->link       = link;
    +    out_dlv->msg        = qd_message_copy(msg);
    +    out_dlv->settled    = !in_dlv || in_dlv->settled;
    +    out_dlv->presettled = out_dlv->settled;
         *tag            = core->next_tag++;
    -    dlv->tag_length = 8;
    -    dlv->error      = 0;
    +    out_dlv->tag_length = 8;
    +    out_dlv->error      = 0;
     
         //
    -    // Create peer linkage only if the delivery is not settled
    +    // Create peer linkage only if the outgoing delivery is not settled
         //
    -    if (!dlv->settled) {
    -        if (in_dlv && in_dlv->peer == 0) {
    --- End diff --
    
    You've lost the in_dlv->peer == 0 check


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r123020082
  
    --- Diff: src/router_core/router_core_private.h ---
    @@ -693,6 +694,28 @@ void qdr_delivery_release_CT(qdr_core_t *core, qdr_delivery_t *delivery);
     void qdr_delivery_failed_CT(qdr_core_t *core, qdr_delivery_t *delivery);
     bool qdr_delivery_settled_CT(qdr_core_t *core, qdr_delivery_t *delivery);
     void qdr_delivery_decref_CT(qdr_core_t *core, qdr_delivery_t *delivery);
    +
    +/**
    + * Links the in_dlv to the out_dlv and increments ref counts of both deliveries
    + */
    +void qdr_delivery_link_peers_CT(qdr_delivery_t *in_dlv, qdr_delivery_t *out_dlv);
    +
    +/**
    + * Zeroes out peer references from both peers and decrefs ref counts.
    + */
    +void qdr_delivery_unlink_peers_CT(qdr_core_t *core, qdr_delivery_t *dlv, qdr_delivery_t *peer);
    +
    +/**
    + * Called before the call to qdr_delivery_next_peer_CT. This positions the peer pointer to the first peer position.
    --- End diff --
    
    The comments for qdr_delivery_{first,next}_peer are incorrect.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ganeshmurthy <gi...@git.apache.org>.
Github user ganeshmurthy commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r122779756
  
    --- Diff: src/router_core/forwarder.c ---
    @@ -101,33 +101,26 @@ static void qdr_forward_find_closest_remotes_CT(qdr_core_t *core, qdr_address_t
     
     qdr_delivery_t *qdr_forward_new_delivery_CT(qdr_core_t *core, qdr_delivery_t *in_dlv, qdr_link_t *link, qd_message_t *msg)
     {
    -    qdr_delivery_t *dlv = new_qdr_delivery_t();
    -    uint64_t       *tag = (uint64_t*) dlv->tag;
    -
    -    ZERO(dlv);
    -    sys_atomic_init(&dlv->ref_count, 0);
    -    dlv->link       = link;
    -    dlv->msg        = qd_message_copy(msg);
    -    dlv->settled    = !in_dlv || in_dlv->settled;
    -    dlv->presettled = dlv->settled;
    +    qdr_delivery_t *out_dlv = new_qdr_delivery_t();
    +    uint64_t       *tag = (uint64_t*) out_dlv->tag;
    +
    +    ZERO(out_dlv);
    +    sys_atomic_init(&out_dlv->ref_count, 0);
    +    out_dlv->link       = link;
    +    out_dlv->msg        = qd_message_copy(msg);
    +    out_dlv->settled    = !in_dlv || in_dlv->settled;
    +    out_dlv->presettled = out_dlv->settled;
         *tag            = core->next_tag++;
    -    dlv->tag_length = 8;
    -    dlv->error      = 0;
    +    out_dlv->tag_length = 8;
    +    out_dlv->error      = 0;
     
         //
    -    // Create peer linkage only if the delivery is not settled
    +    // Create peer linkage only if the outgoing delivery is not settled
         //
    -    if (!dlv->settled) {
    -        if (in_dlv && in_dlv->peer == 0) {
    --- End diff --
    
    I moved this check (in_dlv->peer == 0) into the qdr_delivery_link_peers_CT, so we are good there.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r122775613
  
    --- Diff: src/router_core/transfer.c ---
    @@ -413,6 +413,43 @@ static void qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t *de
     }
     
     
    +void qdr_delivery_link_peers_CT(qdr_delivery_t *in_dlv, qdr_delivery_t *out_dlv)
    +{
    +    if (in_dlv->peer || out_dlv->peer)
    +        // One of the deliveries already has a peer. Don't proceed.
    +        return;
    --- End diff --
    
    You should assert here.  This must never happen.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r122776504
  
    --- Diff: src/router_core/transfer.c ---
    @@ -671,7 +708,8 @@ static void qdr_send_to_CT(qdr_core_t *core, qdr_action_t *action, bool discard)
     static void qdr_update_delivery_CT(qdr_core_t *core, qdr_action_t *action, bool discard)
     {
         qdr_delivery_t *dlv        = action->args.delivery.delivery;
    -    qdr_delivery_t *peer       = dlv->peer;
    +    qdr_delivery_start_peer_CT(dlv);
    --- End diff --
    
    Now that I'm looking at it, a better API might be: qdr_delivery_t qdr_delivery_first_peer_CT(dlv) instead of start_peer.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

Posted by ted-ross <gi...@git.apache.org>.
Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r122776057
  
    --- Diff: src/router_core/transfer.c ---
    @@ -413,6 +413,43 @@ static void qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t *de
     }
     
     
    +void qdr_delivery_link_peers_CT(qdr_delivery_t *in_dlv, qdr_delivery_t *out_dlv)
    +{
    +    if (in_dlv->peer || out_dlv->peer)
    +        // One of the deliveries already has a peer. Don't proceed.
    +        return;
    +
    +    out_dlv->peer = in_dlv;
    +    in_dlv->peer = out_dlv;
    +
    +    qdr_delivery_incref(out_dlv);
    +    qdr_delivery_incref(in_dlv);
    +}
    +
    +
    +void qdr_delivery_unlink_peers_CT(qdr_core_t *core, qdr_delivery_t *dlv, qdr_delivery_t *peer)
    +{
    +    dlv->peer  = 0;
    +    peer->peer = 0;
    +
    +    qdr_delivery_decref_CT(core, dlv);
    --- End diff --
    
    What if these two deliveries weren't linked to one another?  You will cause a data corruption with no indication.  You should assert that the proper mutual linkage is in place before removing it and decrementing reference counts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org