Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[privatemessaging] Setting Batch Namespace to NetworkName for Retried/Resubmitted Operations #122

Open
wants to merge 2 commits into
base: release-v1.3.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/dataexchange/ffdx/ffdx.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2024 Kaleido, Inc.

Check failure on line 1 in internal/dataexchange/ffdx/ffdx.go

View workflow job for this annotation

GitHub Actions / build

Expected:2025, Actual: 2024 Kaleido, Inc. (goheader)
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -79,6 +79,7 @@
}

func (cb *callbacks) DXEvent(ctx context.Context, namespace, recipient string, event dataexchange.DXEvent) error {
log.L(ctx).Debugf("Finding node for DX event '%s' namespace='%s' recipient='%s'", event.EventID(), namespace, recipient)
node := cb.plugin.findNode(namespace, recipient)
if node != nil {
key := namespace + ":" + node.Name
Expand All @@ -88,7 +89,7 @@
log.L(ctx).Errorf("No handler found for DX event '%s' namespace=%s node=%s", event.EventID(), namespace, node.Name)
event.Ack()
} else {
log.L(ctx).Errorf("Unknown local node for DX event '%s' recipient=%s", event.EventID(), recipient)
log.L(ctx).Errorf("Unknown local node for DX event '%s' namespace='%s' recipient=%s", event.EventID(), namespace, recipient)
event.Ack()
}
return nil
Expand Down Expand Up @@ -333,6 +334,7 @@
h.initMutex.Lock()
defer h.initMutex.Unlock()

log.L(ctx).Debugf("Adding DX peer namespace='%s' node='%s'", networkNamespace, h.GetPeerID(peer))
key := networkNamespace + ":" + h.GetPeerID(peer)
h.nodes[key] = &dxNode{
Peer: peer,
Expand Down
1 change: 1 addition & 0 deletions internal/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2024 Kaleido, Inc.

Check failure on line 1 in internal/orchestrator/orchestrator.go

View workflow job for this annotation

GitHub Actions / build

Expected:2025, Actual: 2024 Kaleido, Inc. (goheader)
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -451,6 +451,7 @@
return err
}
for _, node := range nodes {
log.L(ctx).Debugf("Adding node '%s', identity '%s' to data exchange: %v", node.Name, node.ID, node.Profile)
err = or.plugins.DataExchange.Plugin.AddNode(ctx, or.namespace.NetworkName, node.Name, node.Profile)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/privatemessaging/operations.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 Kaleido, Inc.

Check failure on line 1 in internal/privatemessaging/operations.go

View workflow job for this annotation

GitHub Actions / build

Expected:2025, Actual: 2023 Kaleido, Inc. (goheader)
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -129,6 +129,7 @@
if err != nil {
return nil, err
}
batch.Namespace = pm.namespace.NetworkName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find.

So when we put the network namespace concept in here:
dispatchBatchCommon

We missed it in the recovery of a prepared operation path.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And - if you named your namespace the same as the network name, you'd never notice this bug when retrying operations.

transport := &core.TransportWrapper{Group: group, Batch: batch}
return opSendBatch(op, node, transport), nil

Expand Down
Loading