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

Rhizome direct operations: push, pull, sync #9

Closed
quixotique opened this issue Aug 27, 2012 · 4 comments
Closed

Rhizome direct operations: push, pull, sync #9

quixotique opened this issue Aug 27, 2012 · 4 comments
Assignees

Comments

@quixotique
Copy link
Member

To support Rhizome file sharing and MeshMS via infrastructure, it must be possible to configure Rhizome to connect directly to other Rhizome servers at know locations.

This issue will support a single, optional remote Rhizome instance defined by the configuration items:

  • rhizome.direct.address a string passed to getaddrinfo(3)
  • rhizome.direct.port a port number in decimal

Setting either of these without the other will log a warning and ignore it when any of the commands described below is invoked.

The following new servald commands will query servald for local bundles, then connect directly to the configured remote instance, send IHAVE announcements in batches to announce all locally stored bundles, then receive IHAVE and SENDME replies from the remote instance, then perform GET and/or POST operations to exchange bundles:

  • servald rhizome push will only perform POST operations to satisfy the SENDME replies from the direct remote
  • servald rhizome pull will only perform GET operations to fetch any bundles discovered from IHAVE announcements from the direct remote
  • servald rhizome sync will perform a mixture of POST and GET operations, equivalent to performing a push and a pull

These commands will terminate when all bundles identified by the initial IHAVE/SENDME exchange have been transferred. If other bundles become available during the session, these will not be detected.

@ghost ghost assigned gardners Aug 27, 2012
quixotique pushed a commit that referenced this issue Aug 27, 2012
See issue #9.

These commands are not yet implemented, so of course the new
tests fail.
quixotique pushed a commit that referenced this issue Aug 27, 2012
... where they should have been in the first place.

Also, clean up the RHIZOME HTTP SERVER START log message.

Issue #9.
gardners added a commit that referenced this issue Aug 31, 2012
when starting, so that same server code can be shared for rhizome transfers
and rhizome direct. #9
gardners added a commit that referenced this issue Aug 31, 2012
different request parser, but otherwise share code between
rhizome transfers and rhizome direct. #9
gardners added a commit that referenced this issue Aug 31, 2012
Doesn't know how to do POST yet, which is needed for all rhizome
direct operations. #9
gardners added a commit that referenced this issue Aug 31, 2012
and content-type, and complaining if they aren't in the format we
expect. #9
gardners added a commit that referenced this issue Sep 5, 2012
Added call to new (currently stub) function for processing bytes
received from a HTTP POST multipart encoded form. #9
gardners added a commit that referenced this issue Sep 5, 2012
feels like a much simpler and cleaner design. Still more to do. #9
gardners added a commit that referenced this issue Sep 5, 2012
need for any parser look-ahead, i.e., it is now LALR(1), and well
suited to parsing streaming data. #9
gardners added a commit that referenced this issue Sep 5, 2012
gardners added a commit that referenced this issue Sep 5, 2012
partially implemented that recognises the field elements being
submitted and complains if they are wrong. #9
gardners added a commit that referenced this issue Sep 5, 2012
everything except actually write manifest and data to files
for importing. #9
gardners added a commit that referenced this issue Sep 5, 2012
the boundary string at the end of the form. #9
gardners added a commit that referenced this issue Sep 5, 2012
gardners added a commit that referenced this issue Sep 5, 2012
gardners added a commit that referenced this issue Sep 5, 2012
add actual call to servald rhizome import bundle.
seems to work, though yet to be tested with a genuine bundle. #9
gardners added a commit that referenced this issue Sep 6, 2012
bundles can be imported via HTTP POST multi-part form. #9
@gardners
Copy link
Member

gardners commented Sep 7, 2012

PULL syncing will use mostly GETs, but will still need to do a POST to do the initial negotiation with the remote end to work out what needs to be PULLed. But once that is known, then the existing GET-based requests can be used to implement that.

gardners added a commit that referenced this issue Sep 7, 2012
for use in Rhizome Direct synchronisation requests. #9
gardners added a commit that referenced this issue Sep 8, 2012
size of associated data in a bundle, so that we can synchronise
small things first.  Also preliminary work on making a general
cursor-type wrapper function for get_bars() so that it is easy
for any rhizome direct transport driver to iterate over the
known bundles in a rhizome datastore. #9
gardners added a commit that referenced this issue Oct 3, 2012
were recently made to rhizome direct push test. Now to implement
the rhizome direct http pull functionality so that they work... #9
gardners added a commit that referenced this issue Oct 3, 2012
gardners added a commit that referenced this issue Oct 3, 2012
gardners added a commit that referenced this issue Oct 3, 2012
data we need to allow the prefix2manifest reception to launch
the file body request via normal rhizome http fetch process. #9
gardners added a commit that referenced this issue Oct 3, 2012
Now actually triggers the http request to obtain the file, but
the peer address is 0.0.0.0:0.  Investigating. #9
gardners added a commit that referenced this issue Oct 3, 2012
gardners added a commit that referenced this issue Oct 3, 2012
associated file before checking if it was already in the database.
Rhizome Direct can supply a manifest without associated file if
the file is already in the database, and so it was breaking.
Also removed "assert bundle_received_by"'s from rhizome direct
pull and sync tests because they are not needed, and were failing
because the same file contents was used for the files being
exchanged, and so file storage was not occurring, and thus the log
message being looked for was not being produced.
Push, pull and sync tests in rhizomeprotocol now pass, leaving
only two tests in error.  #9
gardners added a commit that referenced this issue Oct 3, 2012
(something broken in merge of AB and PGS changes -- will investigate
once merge complete). #9
gardners added a commit that referenced this issue Oct 3, 2012
Must be enabled by using rhizome.api.addfile.*
Certainly polishing to be done, including using filename supplied
during HTTP POST.  Now to fix that, and make it all work with
final rhizomeprotocol test case.
rhizomeprotocol test cases 8 and 9 currently fail post-merge. #9
gardners added a commit that referenced this issue Oct 3, 2012
gardners added a commit that referenced this issue Oct 3, 2012
file import. It now rungs in rhizomeprotocol test suite, but fails
because the BK= field is missing (but the file is imported).
Also removed the assertions about receiving bundles from the push
test as it was non-deterministic.  The bundle reception is already
tested, so there is no loss.
Investigating missing BK=.
Also test 8 (sync) fails post-merge, although push and pull work
intepdendently. Will investigate that post-merge. #9
gardners added a commit that referenced this issue Oct 3, 2012
as hex if not supplying a manifest template.
modified rhizomeprotocol test of manifest-less HTTP import to set
that option.  That test now passes.
ALL rhizomeprotocol tests now pass. #9
gardners added a commit that referenced this issue Oct 3, 2012
gardners added a commit that referenced this issue Oct 3, 2012
direct sync enquiry request.  Still something else broken
post-merge, but we are getting closer. #9
gardners added a commit that referenced this issue Oct 3, 2012
an integer not text column, so that FILESIZE BETWEEN clauses behave
numerically rather than lexographically.  Added an index for good
measure. #9
gardners added a commit that referenced this issue Oct 3, 2012
rhizome direct push/pull/sync tests from working. #9
gardners added a commit that referenced this issue Oct 3, 2012
and made corresponding adjustments.  Oddly push and pull work again.
Maybe there is some subtle bug in the test framework?
Anyway, now to fix the sync test. #9
gardners added a commit that referenced this issue Oct 3, 2012
All rhizomeprotocol tests now PASS with merged changes. #9
gardners added a commit that referenced this issue Oct 3, 2012
quixotique pushed a commit that referenced this issue Oct 4, 2012
The warning was that 'fd' could be used uninitialised in rhizome_store_file(),
and it was true!
quixotique pushed a commit that referenced this issue Oct 4, 2012
Also add checks for the "version", "date" and ".inserttime" columns, that they
match the corresponding manifest or are at least well formed.

Issue #9.
quixotique pushed a commit that referenced this issue Oct 4, 2012
Rename Push, Pull, Sync to DirectPush, DirectPull, DirectSync.

Move HttpAdd test to just after HttpImport test.

Tighten up the assertions in Rhizome Direct test cases.

Factor the "assert_rhizome_list" test out of assert_received() to avoid having
to water down assert_rhizome_list(), which currently takes an exact list of all
files that must be present in the list, and is more valuable that way.
quixotique pushed a commit that referenced this issue Oct 4, 2012
It turns out that if the DB is locked, sqlite_prepare_v2() call can return
SQLITE_BUSY.  The retry logic (implemented for issue #2) only provided for
sqlite_step() to return SQLITE_BUSY.  It was a fairly straightforward matter to
extend the retry logic to cover statement preparation in an equally general
fashion.

The problem was observed while diagnosing failures in the rhizomeprotocol
DirectPush test case: the "servald rhizome list" command was failing due to a
locked database.  See issue #9.
quixotique pushed a commit that referenced this issue Oct 4, 2012
quixotique pushed a commit that referenced this issue Oct 4, 2012
The "rhizome direct push" command (and also sync) was not waiting for the
server's HTTP response, so it was exiting before the server had finished
storing the bundle, which led to a race with the subsequent "assert
bundle_received_by" test.  Fixed by adding the missing code to receive the HTTP
response.

Refactored the code used for parsing HTTP responses in rhizome_fetch.c, and
used it in rhizome_direct_http.c.
@quixotique
Copy link
Member Author

The Rhizome Direct code branch has been merged into the master branch (89343c6) and remaining issues with failing tests have been resolved (as of 8b95056).

The Rhizome Direct code still needs a lot of improvement, such as:

All of this work falls under the scope of other issue reports, so closing this issue now as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants