Commit Graph

254 Commits

Author SHA1 Message Date
kevan
70d27cfa7c mutable/publish: handle unknown mutable share formats when handling errors 2011-09-24 17:43:05 -07:00
kevan
e8afe84813 mutable/layout: break unpack_checkstring into unpack_mdmf_checkstring and unpack_sdmf_checkstring, add distinguisher function for checkstrings 2011-09-24 17:41:34 -07:00
kevan
a911e15783 mutable/publish: use unpack_mdmf_checkstring and unpack_sdmf_checkstring instead of unpack_checkstring. fixes #1540 2011-09-24 16:51:37 -07:00
david-sarah
1fa5c729b7 mutable/publish.py: copy the self.writers dict before iterating over it, since we remove elements from it during the iteration. refs #393 2011-09-24 14:12:08 -07:00
david-sarah
f94eb86fc9 mutable/publish.py: simplify by refactoring self.outstanding to self.num_outstanding. refs #393 2011-09-24 13:50:04 -07:00
kevan
8c7406508a mutable/publish: add errback immediately after write, don't consume errors from other parts of the publisher 2011-09-17 16:47:08 -07:00
Brian Warner
bd709c4833 Retrieve._activate_enough_peers: rewrite Verify logic 2011-09-09 11:11:50 -07:00
Brian Warner
a15ce96846 Retrieve: implement/test stopProducing 2011-09-09 11:11:50 -07:00
Brian Warner
425152c34e retrieve.py: remove vestigal self._validated_readers 2011-09-09 11:11:50 -07:00
Brian Warner
df07060f93 Retrieve: rewrite flow-control: use a top-level loop() to catch all errors
This ought to close the potential for dropped errors and hanging downloads.
Verify needs to be examined, I may have broken it, although all tests pass.
2011-09-09 11:11:50 -07:00
Brian Warner
53bbc1d06a Retrieve: merge _validate_active_prefixes into _add_active_peers 2011-09-09 11:11:50 -07:00
Brian Warner
2edfb1a334 Retrieve: remove the initial prefix-is-still-good check
This check needs to be done with each fetch from the storage server, to
detect when someone has changed the share (i.e. our servermap goes stale).
Doing it just once at the beginning of retrieve isn't enough: a write might
occur after the first segment but before the second, etc.

_try_to_validate_prefix() was not removed: it will be used by the future
check-with-each-fetch code.

test_mutable.Roundtrip.test_corrupt_all_seqnum_late was disabled, since it
fails until this check is brought back. (the corruption it applies only
touches the prefix, not the block data, so the check-less retrieve actually
tolerates it). Don't forget to re-enable it once the check is brought back.
2011-09-09 11:11:50 -07:00
Brian Warner
2b4f2b7fa3 MDMFSlotReadProxy: remove the queue
This is a neat trick to reduce Foolscap overhead, but the need for an
explicit flush() complicates the Retrieve path and makes it prone to
lost-progress bugs.

Also change test_mutable.FakeStorageServer to tolerate multiple reads of the
same share in a row, a limitation exposed by turning off the queue.
2011-09-09 11:11:50 -07:00
Brian Warner
1597aafea1 rearrange Retrieve: first step, shouldn't change order of execution 2011-09-09 11:11:49 -07:00
Kevan Carstensen
32e30c9023 mutable/retrieve: handle the case where self._read_length is 0.
Note that the downloader will still fetch a segment for a zero-length
read, which is wasteful. Fixing that isn't specifically required to fix
#1512, but it should probably be fixed before 1.9.
2011-08-30 14:01:41 -07:00
Brian Warner
9756146d61 Fix mutable publish/retrieve timing status displays. Fixes #1505.
publish:
* encrypt and encode times are cumulative, not just current-segment

retrieve:
* same for decrypt and decode times
* update "current status" to include segment number
* set status to Finished/Failed when download is complete
* set progress to 1.0 when complete

More improvements to consider:
* progress is currently 0% or 100%: should calculate how many segments are
  involved (remembering retrieve can be less than the whole file) and set it
  to a fraction
* "fetch" time is fuzzy: what we want is to know how much of the delay is not
  our own fault, but since we do decode/decrypt work while waiting for more
  shares, it's not straightforward
2011-08-28 16:22:21 -07:00
Brian Warner
0f1d674d76 MutableFileNode.set_downloader_hints: never depend upon order of dict.values()
The old code was calculating the "extension parameters" (a list) from the
downloader hints (a dictionary) with hints.values(), which is not stable, and
would result in corrupted filecaps (with the 'k' and 'segsize' hints
occasionally swapped). The new code always uses [k,segsize].
2011-08-28 00:41:03 -07:00
Brian Warner
4b0078dc49 layout.py: fix MDMF share layout documentation 2011-08-28 00:39:21 -07:00
Brian Warner
370e6f271e SDMF: update filenode with correct k/N after Retrieve. Fixes #1510.
Without this, we get a regression when modifying a mutable file that was
created with more shares (larger N) than our current tahoe.cfg . The
modification attempt creates new versions of the (0,1,..,newN-1) shares, but
leaves the old versions of the (newN,..,oldN-1) shares alone (and throws a
assertion error in SDMFSlotWriteProxy.finish_publishing in the process).

The mixed versions that result (some shares with e.g. N=10, some with N=20,
such that both versions are recoverable) cause problems for the Publish code,
even before MDMF landed. Might be related to refs #1390 and refs #1042.
2011-08-27 15:50:31 -07:00
Brian Warner
b8c90d24fc layout.py: annotate assertion to figure out 'tahoe backup' failure 2011-08-27 12:52:53 -07:00
Brian Warner
522868d5e9 MDMF: more writable/writeable consistentifications 2011-08-27 12:06:02 -07:00
Brian Warner
48544a251d MDMF: s/Writable/Writeable/g, for consistency with existing SDMF code 2011-08-27 11:33:57 -07:00
david-sarah
505ebeb353 mutable/layout.py: fix unused import. refs #393 2011-08-16 15:50:43 -07:00
david-sarah
4b62b53cd6 mutable/retrieve.py: cosmetics and remove a stale comment. refs #393 2011-08-16 14:46:12 -07:00
Kevan Carstensen
62c72881bb mutable/filenode.py: don't fetch more segments than necesasry to update the file 2011-08-13 14:00:05 -07:00
Kevan Carstensen
3423b7d6f7 mutable/retrieve.py: use floor division to calculate segment boundaries, don't fetch more segments than necessary 2011-08-13 11:38:33 -07:00
Kevan Carstensen
a1a334e1a0 mdmf: clean up boolean expressions, correct typos, remove self._paused, and don't unconditionally initialize block hash trees, asll as suggested by davidsarahs' review comments 2011-08-13 11:37:10 -07:00
Brian Warner
eec428ba5f fix SHARE_HASH_CHAIN_SIZE computation 2011-08-11 10:53:50 -07:00
Kevan Carstensen
bb10d685ed mutable/servermap: Rework the servermap to work with MDMF mutable files 2011-08-06 17:42:59 -07:00
Kevan Carstensen
b1b77d3b89 mutable/layout: Define MDMF share format, write tools for working with MDMF share format
The changes in layout.py are mostly concerned with the MDMF share
format. In particular, we define read and write proxy objects used by
retrieval, publishing, and other code to write and read the MDMF share
format. We create equivalent proxies for SDMF objects so that these
objects can be suitably general.
2011-08-01 19:11:20 -07:00
Kevan Carstensen
f80a7fdf18 mutable: train checker and repairer to work with MDMF mutable files 2011-08-01 18:51:40 -07:00
Kevan Carstensen
e4f2b27305 mutable/filenode: Modify mutable filenodes for use with MDMF
In particular:
    - Break MutableFileNode and MutableFileVersion into distinct classes.
    - Implement the interface modifications made for MDMF.
    - Be aware of MDMF caps.
    - Learn how to create and work with MDMF files.
2011-08-01 18:45:01 -07:00
Kevan Carstensen
1576c35d38 mutable/publish: teach the publisher how to publish MDMF mutable files
Like the downloader, the publisher needs some substantial changes to handle multiple segment mutable files.
2011-08-01 18:39:31 -07:00
Kevan Carstensen
ac3b2647dd mutable/retrieve: rework the mutable downloader to handle multiple-segment files
The downloader needs substantial reworking to handle multiple segment
mutable files, which it needs to handle for MDMF.
2011-08-01 18:35:24 -07:00
Zooko O'Whielacronx
299e8ad579 replace remaining .html docs with .rst docs
Remove install.html (long since deprecated).
Also replace some obsolete references to install.html with references to quickstart.rst.
Fix some broken internal references within docs/historical/historical_known_issues.txt.
Thanks to Ravi Pinjala and Patrick McDonald.
refs #1227
2011-05-10 12:16:50 -07:00
Brian Warner
ffd296fc5a Refactor StorageFarmBroker handling of servers
Pass around IServer instance instead of (peerid, rref) tuple. Replace
"descriptor" with "server". Other replacements:

 get_all_servers -> get_connected_servers/get_known_servers
 get_servers_for_index -> get_servers_for_psi (now returns IServers)

This change still needs to be pushed further down: lots of code is now
getting the IServer and then distributing (peerid, rref) internally.
Instead, it ought to distribute the IServer internally and delay
extracting a serverid or rref until the last moment.

no_network.py was updated to retain parallelism.
2011-02-20 17:58:04 -08:00
david-sarah
4061258c85 make ResponseCache smarter to avoid memory leaks: don't record timestamps, use DataSpans to merge entries, and clear the cache when we see a new seqnum. refs #1045, #1229 2010-10-26 21:33:02 -07:00
Brian Warner
d61d41147c mutable/servermap.py: update comment. Closes #1231. 2010-10-29 02:14:24 -07:00
david-sarah
e76092e16c Change relative imports to absolute 2010-02-26 01:14:33 -07:00
david-sarah
6057bc02cc Prevent mutable objects from being retrieved from an immutable directory, and associated forward-compatibility improvements. 2010-01-26 22:44:30 -08:00
Brian Warner
731d15e56f hush pyflakes-0.4.0 warnings: remove trivial unused variables. For #900. 2010-01-14 14:15:29 -08:00
Brian Warner
d888bf3377 Clean up log.err calls, for one of the issues in #889.
allmydata.util.log.err() either takes a Failure as the first positional
argument, or takes no positional arguments and must be invoked in an
exception handler. Fixed its signature to match both foolscap.logging.log.err
and twisted.python.log.err . Included a brief unit test.
2010-01-11 17:33:43 -08:00
Brian Warner
bacb6fe5aa tidy up DeadReferenceError handling, ignore them in add_lease calls
Stop checking separately for ConnectionDone/ConnectionLost, since those have
been folded into DeadReferenceError since foolscap-0.3.1 . Write
rrefutil.trap_deadref() in terms of rrefutil.trap_and_discard() to improve
code coverage.
2010-01-11 16:07:23 -08:00
Brian Warner
419a076f59 mutable/publish: don't loop() right away upon DeadReferenceError. Closes #877
The bug was that a disconnected server could cause us to re-enter the initial
loop() call, sending multiple queries to a single server, provoking an
incorrect UCWE. To fix it, stall the loop() with an eventual.fireEventually()
2010-01-02 14:08:41 -08:00
Brian Warner
ba0690c9d7 mutable repair: return successful=False when numshares<k (thus repair fails),
instead of weird errors. Closes #874 and #786.

Previously, if the file had 0 shares, this would raise TypeError as it tried
to call download_version(None). If the file had some shares but fewer than
'k', it would incorrectly raise MustForceRepairError.

Added get_successful() to the IRepairResults API, to give repair() a place to
report non-code-bug problems like this.
2009-12-29 15:37:46 -08:00
Brian Warner
794e32738f checker: don't let failures in add-lease affect checker results. Closes #875.
Mutable servermap updates and the immutable checker, when run with
add_lease=True, send both the do-you-have-block and add-lease commands in
parallel, to avoid an extra round trip time. Many older servers have problems
with add-lease and raise various exceptions, which don't generally matter.
The client-side code was catching+ignoring some of them, but unrecognized
exceptions were passed through to the DYHB code, concealing the DYHB results
from the checker, making it think the server had no shares.

The fix is to separate the code paths. Both commands are sent at the same
time, but the errback path from add-lease is handled separately. Known
exceptions are ignored, the others (both unknown-remote and all-local) are
logged (log.WEIRD, which will trigger an Incident), but neither will affect
the DYHB results.

The add-lease message is sent first, and we know that the server handles them
synchronously. So when the checker is done, we can be sure that all the
add-lease messages have been retired. This makes life easier for unit tests.
2009-12-29 15:01:08 -08:00
Brian Warner
47cba4b51a mutable/retrieve.py: stop reaching into private MutableFileNode attributes 2009-12-08 09:29:21 -08:00
Brian Warner
aa3caf812d mutable/servermap.py: stop reaching into private MutableFileNode attributes 2009-12-08 09:26:08 -08:00
Brian Warner
eb18686284 mutable/servermap.py: oops, query N+e servers in MODE_WRITE, not k+e
under normal conditions, this wouldn't cause any problems, but if the shares
are really sparse (perhaps because new servers were added), then
file-modifies might stop looking too early and leave old shares in place
2009-12-08 09:11:56 -08:00
Brian Warner
a980ea337b remove MutableFileNode.download(), prefer download_best_version() instead 2009-12-01 17:54:38 -05:00
david-sarah
c4d38ad4c5 make status of finished operations consistently "Finished" 2009-11-20 22:15:43 -08:00
Brian Warner
e046744f40 make get_size/get_current_size consistent for all IFilesystemNode classes
* stop caching most_recent_size in dirnode, rely upon backing filenode for it
* start caching most_recent_size in MutableFileNode
* return None when you don't know, not "?"
* only render None as "?" in the web "more info" page
* add get_size/get_current_size to UnknownNode
2009-11-18 11:16:24 -08:00
Brian Warner
cc422f8dc0 stop using IURI()/etc as an adapter 2009-11-11 14:45:42 -08:00
Brian Warner
131e05b155 clean up uri-vs-cap terminology, emphasize cap instances instead of URI strings
* "cap" means a python instance which encapsulates a filecap/dircap (uri.py)
 * "uri" means a string with a "URI:" prefix
 * FileNode instances are created with (and retain) a cap instance, and
   generate uri strings on demand
 * .get_cap/get_readcap/get_verifycap/get_repaircap return cap instances
 * .get_uri/get_readonly_uri return uri strings

* add filenode.download_to_filename() for control.py, should find a better way
* use MutableFileNode.init_from_cap, not .init_from_uri
* directory URI instances: use get_filenode_cap, not get_filenode_uri
* update/cleanup bench_dirnode.py to match, add Makefile target to run it
2009-11-11 14:26:19 -08:00
Brian Warner
c2520e4ec7 client.create_mutable_file(contents=) now accepts a callable, which is
invoked with the new MutableFileNode and is supposed to return the initial
contents. This can be used by e.g. a new dirnode which needs the filenode's
writekey to encrypt its initial children.

create_mutable_file() still accepts a bytestring too, or None for an empty
file.
2009-10-12 20:12:32 -07:00
Brian Warner
0d5dc51617 Overhaul IFilesystemNode handling, to simplify tests and use POLA internally.
* stop using IURI as an adapter
* pass cap strings around instead of URI instances
* move filenode/dirnode creation duties from Client to new NodeMaker class
* move other Client duties to KeyGenerator, SecretHolder, History classes
* stop passing Client reference to dirnode/filenode constructors
  - pass less-powerful references instead, like StorageBroker or Uploader
* always create DirectoryNodes by wrapping a filenode (mutable for now)
* remove some specialized mock classes from unit tests

Detailed list of changes (done one at a time, then merged together)

always pass a string to create_node_from_uri(), not an IURI instance
always pass a string to IFilesystemNode constructors, not an IURI instance
stop using IURI() as an adapter, switch on cap prefix in create_node_from_uri()
client.py: move SecretHolder code out to a separate class
test_web.py: hush pyflakes
client.py: move NodeMaker functionality out into a separate object
LiteralFileNode: stop storing a Client reference
immutable Checker: remove Client reference, it only needs a SecretHolder
immutable Upload: remove Client reference, leave SecretHolder and StorageBroker
immutable Repairer: replace Client reference with StorageBroker and SecretHolder
immutable FileNode: remove Client reference
mutable.Publish: stop passing Client
mutable.ServermapUpdater: get StorageBroker in constructor, not by peeking into Client reference
MutableChecker: reference StorageBroker and History directly, not through Client
mutable.FileNode: removed unused indirection to checker classes
mutable.FileNode: remove Client reference
client.py: move RSA key generation into a separate class, so it can be passed to the nodemaker
move create_mutable_file() into NodeMaker
test_dirnode.py: stop using FakeClient mockups, use NoNetworkGrid instead. This simplifies the code, but takes longer to run (17s instead of 6s). This should come down later when other cleanups make it possible to use simpler (non-RSA) fake mutable files for dirnode tests.
test_mutable.py: clean up basedir names
client.py: move create_empty_dirnode() into NodeMaker
dirnode.py: get rid of DirectoryNode.create
remove DirectoryNode.init_from_uri, refactor NodeMaker for customization, simplify test_web's mock Client to match
stop passing Client to DirectoryNode, make DirectoryNode.create_with_mutablefile the normal DirectoryNode constructor, start removing client from NodeMaker
remove Client from NodeMaker
move helper status into History, pass History to web.Status instead of Client
test_mutable.py: fix minor typo
2009-08-15 04:28:46 -07:00
Brian Warner
d8ba8c2eb5 Allow tests to pass with -OO by turning some AssertionErrors (the ones that
we actually exercise during tests) into more specific exceptions, so they
don't get optimized away. The best rule to follow is probably this: if an
exception is worth testing, then it's part of the API, and AssertionError
should never be part of the API. Closes #749.
2009-07-14 23:45:10 -07:00
Brian Warner
e330abc3c3 mutable repairer: skip repair of readcaps instead of throwing an exception.
This should improve the behavior of #625 a bit: at least all the files will
get repaired.
2009-06-30 18:13:43 -07:00
Brian Warner
52fa421430 use 522-bit RSA keys in all unit tests (except one)
This reduces the total test time on my laptop from 400s to 283s.
* src/allmydata/test/test_system.py (SystemTest.test_mutable._test_debug):
  Remove assertion about container_size/data_size, this changes with keysize
  and was too variable anyways.
* src/allmydata/mutable/filenode.py (MutableFileNode.create): add keysize=
* src/allmydata/dirnode.py (NewDirectoryNode.create): same
* src/allmydata/client.py (Client.DEFAULT_MUTABLE_KEYSIZE): add default,
  this overrides the one in MutableFileNode
2009-06-29 15:31:24 -07:00
Brian Warner
c6ae255847 remove trailing whitespace 2009-06-29 13:03:58 -07:00
Brian Warner
d0f80579a5 repairer: raise a better exception when faced with a readonly filenode. Still
produces an error, though.
2009-06-25 23:32:30 -07:00
Brian Warner
97ffc8a418 mutable/filenode.py: set _writekey to None, rather than leaving it missing
This will at least turn the really really weird error when a repair of a
readonly mutable file is attempted into a merely really weird assertion that
mentions "repair currently requires a writecap".
2009-06-25 23:20:22 -07:00
Brian Warner
bd6ecc9f44 Split out NoSharesError, stop adding attributes to NotEnoughSharesError, change humanize_failure to include the original exception string, update tests, behave better if humanize_failure fails. 2009-06-24 19:17:07 -07:00
Brian Warner
711c09bc5d clean up storage_broker interface: should fix #732 2009-06-21 16:51:19 -07:00
Brian Warner
f14004eeb3 hush pyflakes with recent FileTooLarge removal 2009-06-21 16:17:57 -07:00
kevan
db939750a8 remove upper limit on SDMF filesize 2009-06-20 14:31:30 -07:00
Brian Warner
b1290633b8 more storage_broker refactoring: downloader gets a broker instead of a client,
use Client.get_storage_broker() accessor instead of direct attribute access.
2009-06-01 19:25:11 -07:00
Brian Warner
c516361fd2 start to factor server-connection-management into a distinct 'StorageServerFarmBroker' object, separate from the client and the introducer. This is the starting point for #467: static server selection 2009-06-01 14:06:04 -07:00
Brian Warner
d29281c9c5 mutable: catch and display first error, so code bugs which break all servers get displayed better 2009-06-01 14:04:07 -07:00
Brian Warner
1863aee0aa switch to using RemoteException instead of 'wrapped' RemoteReferences. Should fix #653, the rref-EQ problem 2009-05-21 17:46:32 -07:00
Brian Warner
c9803d5217 switch all foolscap imports to use foolscap.api or foolscap.logging 2009-05-21 17:38:23 -07:00
Zooko O'Whielacronx
9729753692 dirnode: add 'tahoe'/'linkcrtime' and 'tahoe'/'linkmotime' to take the place of what 'mtime'/'ctime' originally did, and make the 'tahoe' subdict be unwritable through the set_children API
Also add extensive documentation in docs/frontends/webapi.txt about the behaviors of these values.  See ticket #628.
2009-04-11 15:52:05 -07:00
Brian Warner
67571eb033 add more information to NotEnoughSharesError, split out new exceptions for no-servers and no-source-of-ueb-hash 2009-03-03 19:37:15 -07:00
Brian Warner
99ebf6eaf5 servermap add-lease: fix the code that's supposed to catch remote IndexErrors, I forgot that they present as ServerFailures instead. This should stop the deluge of Incidents that occur when you do add-lease against 1.3.0 servers 2009-02-27 01:04:26 -07:00
Brian Warner
c23d051d3f mutable/publish: stop using RuntimeError, for #639 2009-02-22 17:30:56 -07:00
Brian Warner
ef53da2b12 break storage.py into smaller pieces in storage/*.py . No behavioral changes. 2009-02-18 14:46:55 -07:00
Brian Warner
bce4a5385b add --add-lease to 'tahoe check', 'tahoe deep-check', and webapi. 2009-02-17 19:32:43 -07:00
Brian Warner
d8b3505cf5 filenode: add get_repair_cap(), which uses the read-write filecap for immutable files, and the verifycap for immutable files 2009-01-22 21:38:36 -07:00
Brian Warner
2fe099a0b3 mutable: move recent operation history management code (MutableWatcher) into history.py, have History provide stats 2009-01-14 17:36:20 -07:00
Zooko O'Whielacronx
ef60e85ec6 naming: finish renaming "CheckerResults" to "CheckResults" 2009-01-09 18:00:52 -07:00
Zooko O'Whielacronx
5e6f90a015 rename "checker results" to "check results", because it is more parallel to "check-and-repair results" 2009-01-06 13:37:03 -07:00
Zooko O'Whielacronx
471e1f1b9b try to tidy up uri-as-string vs. uri-as-object
I get confused about whether a given argument or return value is a uri-as-string or uri-as-object.  This patch adds a lot of assertions that it is one or the other, and also changes CheckerResults to take objects not strings.
In the future, I hope that we generally use Python objects except when importing into or exporting from the Python interpreter e.g. over the wire, the UI, or a stored file.
2008-12-19 08:39:24 -07:00
Brian Warner
278c47b9bd mutable publish: if we are surprised by shares that match what we would have written anyways, don't be surprised. This should fix one of the two #546 problems, in which we re-use a server and forget that we already sent them a share. 2008-12-09 22:44:49 -07:00
Zooko O'Whielacronx
c456ff8591 rename "get_verifier()" to "get_verify_cap()" 2008-12-08 12:44:11 -07:00
Zooko O'Whielacronx
b58875fe43 mutable: rename mutable/node.py to mutable/filenode.py and mutable/repair.py to mutable/repairer.py
To be more consistent with the immutable layout that I am working on.
2008-12-07 08:20:08 -07:00
Brian Warner
ffb5985146 mutable.modify(): after UCWE, publish even if the second invocation of the modifier didn't modify anything. For #551. 2008-12-05 22:49:23 -07:00
Brian Warner
fb9af2c7a0 MutableFileNode.modify: pass first_time= and servermap= to the modifier callback 2008-12-05 22:07:10 -07:00
Zooko O'Whielacronx
b315619d6b download: refactor handling of URI Extension Block and crypttext hash tree, simplify things
Refactor into a class the logic of asking each server in turn until one of them gives an answer 
that validates.  It is called ValidatedThingObtainer.

Refactor the downloading and verification of the URI Extension Block into a class named 
ValidatedExtendedURIProxy.

The new logic of validating UEBs is minimalist: it doesn't require the UEB to contain any 
unncessary information, but of course it still accepts such information for backwards 
compatibility (so that this new download code is able to download files uploaded with old, and 
for that matter with current, upload code).

The new logic of validating UEBs follows the practice of doing all validation up front.  This 
practice advises one to isolate the validation of incoming data into one place, so that all of 
the rest of the code can assume only valid data.

If any redundant information is present in the UEB+URI, the new code cross-checks and asserts 
that it is all fully consistent.  This closes some issues where the uploader could have 
uploaded inconsistent redundant data, which would probably have caused the old downloader to 
simply reject that download after getting a Python exception, but perhaps could have caused 
greater harm to the old downloader.

I removed the notion of selecting an erasure codec from codec.py based on the string that was 
passed in the UEB.  Currently "crs" is the only such string that works, so 
"_assert(codec_name == 'crs')" is simpler and more explicit.  This is also in keeping with the 
"validate up front" strategy -- now if someone sets a different string than "crs" in their UEB, 
the downloader will reject the download in the "validate this UEB" function instead of in a 
separate "select the codec instance" function.

I removed the code to check plaintext hashes and plaintext Merkle Trees.  Uploaders do not 
produce this information any more (since it potentially exposes confidential information about 
the file), and the unit tests for it were disabled.  The downloader before this patch would 
check that plaintext hash or plaintext merkle tree if they were present, but not complain if 
they were absent.  The new downloader in this patch complains if they are present and doesn't 
check them.  (We might in the future re-introduce such hashes over the plaintext, but encrypt 
the hashes which are stored in the UEB to preserve confidentiality.  This would be a double-
check on the correctness of our own source code -- the current Merkle Tree over the ciphertext 
is already sufficient to guarantee the integrity of the download unless there is a bug in our 
Merkle Tree or AES implementation.) 

This patch increases the lines-of-code count by 8 (from 17,770 to 17,778), and reduces the 
uncovered-by-tests lines-of-code count by 24 (from 1408 to 1384).  Those numbers would be more 
meaningful if we omitted src/allmydata/util/ from the test-coverage statistics.
2008-12-05 08:17:54 -07:00
Brian Warner
7ea0a1316a mutable publish: reinstate the foolscap-reference-token-bug workaround, both for the original reasons and because of an apparent new foolscap bug that's triggered by reference tokens. See #541 for details. 2008-11-25 14:27:35 -07:00
Brian Warner
6f6556da22 mutable: respect the new tahoe.cfg 'shares.needed' and 'shares.total' settings 2008-11-19 14:05:01 -07:00
Brian Warner
dfa2408157 checker: add is_recoverable() to checker results, make our stub immutable-verifier not throw an exception on unrecoverable files, add tests 2008-11-06 22:35:47 -07:00
Brian Warner
b1db6d9ff2 web: add 'Repair' button to checker results when they indicate unhealthyness. Also add the object's uri to the CheckerResults instance. 2008-10-29 18:09:17 -07:00
Brian Warner
914655c52b interfaces.py: promote immutable.encode.NotEnoughSharesError.. it isn't just for immutable files any more 2008-10-27 13:34:49 -07:00
Brian Warner
9f21f7cf65 mutable: call remove_advise_corrupt_share when we see share corruption in mapupdate/download/check, tolerate servers that do not implement it 2008-10-24 13:21:28 -07:00
Brian Warner
6dbef907ac mutable/servermap.py: fix needs_merge(), it was incorrectly claiming that mixed shares with distinct seqnums needed a merge, causing repair(force=False) to fail 2008-10-23 21:00:24 -07:00
Brian Warner
54c0ffd214 mutable/checker: announce the mapupdate op on the 'recent uploads+downloads' page 2008-10-23 16:03:19 -07:00
Brian Warner
977c6ac510 more #514: pass a Monitor to all checker operations, make mutable-checker honor the cancel flag 2008-10-22 01:38:18 -07:00
Brian Warner
0a59991ce6 various: use util.log.err instead of twisted.log.err, so we get both Incidents and trial-test-flunking 2008-09-20 10:35:45 -07:00
Brian Warner
f570ad7ba5 disallow deep-check on non-directories, simplifies the code a bit 2008-09-10 13:44:58 -07:00
Brian Warner
1d2d6a35a6 checker results: add output=JSON to webapi, add tests, clean up APIs
to make the internal ones use binary strings (nodeid, storage index) and
the web/JSON ones use base32-encoded strings. The immutable verifier is
still incomplete (it returns imaginary healty results).
2008-09-09 19:45:17 -07:00
Brian Warner
7fb3308498 mutable checker: even more tests. Everything in ICheckerResults should be covered now, except for immutable-verify which is incomplete 2008-09-09 17:57:06 -07:00
Brian Warner
9676586732 mutable checker: oops, fix redefinition of 'healthy' (numshares < N, not numshares < k, which is 'recoverable' not 'healthy') 2008-09-09 17:28:53 -07:00
Brian Warner
f895e39d48 checker results: more tests, more results. immutable verifier tests are disabled until they emit more complete results 2008-09-09 17:15:46 -07:00
Brian Warner
3408d552cd checker: overhaul checker results, split check/check_and_repair into separate methods, improve web displays 2008-09-07 12:44:56 -07:00
Brian Warner
3b06aa6a79 servermap: don't log late arrivals, and don't log DeadReferenceError at log.WEIRD 2008-08-26 17:37:29 -07:00
Brian Warner
1668401c16 mutable: make mutable-repair work for non-verifier runs, add tests 2008-08-26 16:34:54 -07:00
Zooko O'Whielacronx
f7b4c45d46 mutable: remove work-around for a flaw in an older version of foolscap
We now require "foolscap[secure_connections] >= 0.3.0", per [source:_auto_deps.py].
2008-08-26 08:50:55 -07:00
Brian Warner
a94af879ff logging: add 'unique-message-ids' (or 'umids') to each WEIRD-or-higher log.msg call, to make it easier to correlate log message with source code 2008-08-25 18:57:59 -07:00
Brian Warner
735aa895b9 logging cleanups: lower DeadReferenceError from WEIRD (which provokes Incidents) to merely UNUSUAL, don't pre-format Failures in others 2008-08-25 17:51:55 -07:00
Brian Warner
eb695f1c58 mutable/checker: log a WEIRD-level event when we see a hash failure, to trigger an Incident 2008-08-12 20:50:20 -07:00
Brian Warner
e82d77c3cf mutable/servermap: lower the priority of many log messages 2008-08-12 20:35:06 -07:00
Brian Warner
d43baa2ad7 mutable: add get_size_of_best_version to the interface, to simplify the web HEAD code, and tests 2008-08-12 19:02:52 -07:00
Brian Warner
79576cf75b checker_results.problems: don't str the whole Failure, just extract the reason string 2008-08-11 21:23:06 -07:00
Brian Warner
d106e411af checker: add information to results, add some deep-check tests, fix a bug in which unhealthy files were not counted 2008-08-11 21:03:26 -07:00
Brian Warner
17d7f7d983 mutable/checker: rearrange a bit, change checker-results to have a status_report string 2008-08-11 20:20:33 -07:00
Brian Warner
a15ae52122 mutable/servermap: add summarize_version 2008-08-11 20:19:30 -07:00
Brian Warner
c7c57bd85c mutable: more repair tests, one with force=True to check out merging 2008-08-06 12:06:07 -07:00
Brian Warner
dd6ec73efa mutable: start adding Repair tests, fix a simple bug 2008-08-05 23:12:39 -07:00
Brian Warner
879fefe5f3 first pass at a mutable repairer. not tested at all yet, but of course all existing tests pass 2008-07-17 21:09:23 -07:00
Brian Warner
923c9c242a oops, fix import/pyflakes problems 2008-07-17 17:06:20 -07:00
Brian Warner
67db0a4967 deep-check: add webapi, add 'DEEP-CHECK' button to wui, add tests, rearrange checker API a bit 2008-07-17 16:47:09 -07:00
Brian Warner
9289433ba3 first pass at deep-checker, no webapi yet, probably big problems with it, only minimal tests 2008-07-16 18:20:57 -07:00
Brian Warner
3e9322bcb6 checker: re-enable checker web results (although they just say 'Healthy' right now) 2008-07-16 15:42:56 -07:00
Brian Warner
7394607141 move encode/upload/download/checker.py into a new immutable/ directory. No behavior changes expected. 2008-07-16 13:14:39 -07:00
Brian Warner
94e619c1f6 overhaul checker invocation
Removed the Checker service, removed checker results storage (both in-memory
and the tiny stub of sqlite-based storage). Added ICheckable, all
check/verify is now done by calling the check() method on filenodes and
dirnodes (immutable files, literal files, mutable files, and directory
instances).

Checker results are returned in a Results instance, with an html() method for
display. Checker results have been temporarily removed from the wui directory
listing until we make some other fixes.

Also fixed client.create_node_from_uri() to create LiteralFileNodes properly,
since they have different checking behavior. Previously we were creating full
FileNodes with LIT uris inside, which were downloadable but not checkable.
2008-07-15 17:23:25 -07:00
Brian Warner
a7aa6f8686 implement a mutable checker+verifier. No repair yet. Part of #205. 2008-07-07 17:36:00 -07:00
Brian Warner
a0de01e971 servermap.shares_available: report N too, not just k 2008-07-07 15:06:15 -07:00
Brian Warner
91c7e0f689 mutable: if there are no servers available, return an error, rather than hanging forever 2008-07-07 00:17:41 -07:00
Brian Warner
f4496bd553 mutable/publish.py: raise FileTooLargeError instead of an ugly assertion when the SDMF restrictions are exceeded 2008-06-03 00:02:10 -07:00
Brian Warner
fe44b8fb4b util.dictutil: move DictOfSets out to a separate utility module 2008-05-21 09:43:49 -07:00
Brian Warner
154dca10a0 servermap.py: add size_of_version(), to retrieve the size of a mutable file version 2008-05-19 14:16:02 -07:00
Brian Warner
4b3adb3fcf mutable stats: track mutable bytes published too 2008-04-29 18:20:05 -07:00
Brian Warner
13eb00145e mutable: improve test coverage in Retrieve, when shares change after mapupdate 2008-04-22 17:25:14 -07:00
Brian Warner
a7632a345e mutable/servermap: improve test coverage 2008-04-22 16:47:52 -07:00
Brian Warner
e6074f5dfc mutable: test write failures, uncoordinated write detection 2008-04-22 11:49:53 -07:00
Brian Warner
7e1f9761e8 mutable: remove some dead code, rearrange use of populate_pubkey 2008-04-21 17:51:22 -07:00
Brian Warner
6af124dc3e mutable read: enable the cache (written during mapupdate, read during retrieve). This speeds up small-file reads by about 30% over a link with an average 25ms RTT 2008-04-21 17:27:50 -07:00
Brian Warner
e8b0f3d3cb mutable status: use google-chart-API to draw server response times for servermap update 2008-04-21 16:16:55 -07:00
Brian Warner
a04c2866b1 mutable: improve test coverage slightly 2008-04-21 15:10:50 -07:00
Brian Warner
09dcfeae22 mutable: improve test coverage, fix bug in privkey fetching, add .finished to stats, remove dead code 2008-04-18 19:55:12 -07:00
Brian Warner
fc7b75e55f mutable.node: avoid reentrancy problems in Deferred code on twisted2.5, by adding an eventual-send call 2008-04-18 00:43:29 -07:00
Zooko O'Whielacronx
a504f3395f let MutableFileNode.__repr__() return something useful even if it isn't not initialize yet
This is because I sometimes log or examine a repr of an object from a function which is being called from that object's own __init__()...
(I'm committing this patch in order to test our patch management infrastructure.)
2008-04-17 21:32:38 -07:00
Brian Warner
004d3c14bf mutable: implement MutableFileNode.modify, plus tests 2008-04-17 19:12:42 -07:00
Brian Warner
a379690b04 mutable: replace MutableFileNode API, update tests. Changed all callers to use overwrite(), but that will change soon 2008-04-17 17:51:38 -07:00
Brian Warner
ee218c262d mutable WIP: use fireOnOneErrback when using a DeferredList 2008-04-17 13:11:48 -07:00
Brian Warner
e1838ba217 mutable WIP: clean up status handling, shrink the code a lot, improve test coverage 2008-04-17 13:02:22 -07:00
Brian Warner
a1670497a8 mutable WIP: add servermap update status pages 2008-04-16 19:05:41 -07:00
Brian Warner
f35f20e10b mutable WIP: publish status doesn't know its size early enough to update the stats_provider 2008-04-16 17:55:17 -07:00
Brian Warner
749c42fa2c mutable WIP: re-enable publish/retrieve status 2008-04-16 17:49:06 -07:00
Brian Warner
4f07d96667 mutable WIP: improve logging a bit 2008-04-16 15:22:30 -07:00