Skip to content

Push tcp #2

Merged
merged 18 commits into from
Dec 7, 2017
Merged

Push tcp #2

merged 18 commits into from
Dec 7, 2017

Conversation

donald
Copy link
Contributor

@donald donald commented Dec 7, 2017

New command

clusterd push files....

can be used to distribute files via tcp. Because unlike clusterd --push file we do not use udp broadcast for the file content, we don't have to limit the file size.

We have a small leak here, that clp sockets keep referenced after the
peer closed. Fix.
The design of Donald::Select makes use of Donald::Callback objects,
which are objects conainting a sub and call arguments. However,
because of the pattern

    sub do_something_later() {
        my ($cb_or_sub,@args)=@_;
            $store_callback_somehere=new Donald::Callback($cb_or_sub,@args);
        }

    do_something_later(\&callback,$arg1,$arg2)

the caller doesn't have a reference to the Donald::Callback object,
which makes its diffucult to identify it, e.g. to cancel the callback.

We want to change the design to accept only references to subs as
callbacks. Instead of passing arguments, we exepect the caller to make
use of closures to pass data to the callback if needed.

    sub do_something_later() {
        my ($cb)=@_;
        $store_callback_somewhere=$cb;
    }

    do_something_later(sub{callback($arg1,$args)});

Instead of changing the API of Donald::Select, we import the code
directly into clusterd to make the modifications here.
Use the namespace My:: for packages declared inside the main script.
We imported some lines which do no longer have a function now. Remove
them.
Non-functional change to bring source into sync with another working
branch.
Use refenerces to subs as callback arguments. If the caller wants to
pass additional arguments, he can use closures.
This hash is not used but it prevents these sockets to be able to
be closed by running out of scope.
The command "clusterd push file..." has a new syntax with a command
verb. (as opposed to "clusterd --push file")

The push command is distributed via the area routers to the cluster
daemons on all nodes. It is intended that the cluster daemons call
back over tcp to the originator to pull the file if needed.
When a daemon receices a push command, it checks whether it already has
the offered file or not. If not, it calls back to the daemon where the
push originated and pulls the file over tcp.
Implement the server side to pull a file over tcp.
While 5 seconds seems to be enough for normal behaviour, we might need
more time if the daemon is slowed down .e.g. by strace.
With 234 hosts pulling a file we failed to service a single on with the
old setting listen=1.
@donald donald merged commit 338cfea into master Dec 7, 2017
@donald donald deleted the push-tcp branch December 7, 2017 13:30
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant