mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-22 08:50:07 +00:00
Change the maximum mutable share size to 69105 TB, and add a maximum-mutable-share-size field to the version announcement. Includes a test. refs #1778
This commit is contained in:
@ -71,6 +71,8 @@ HEADER_LENGTH = struct.calcsize(HEADER)
|
|||||||
OFFSETS = ">LLLLQQ"
|
OFFSETS = ">LLLLQQ"
|
||||||
OFFSETS_LENGTH = struct.calcsize(OFFSETS)
|
OFFSETS_LENGTH = struct.calcsize(OFFSETS)
|
||||||
|
|
||||||
|
MAX_MUTABLE_SHARE_SIZE = 69105*1000*1000*1000*1000 # 69105 TB, kind of arbitrary
|
||||||
|
|
||||||
|
|
||||||
# These are still used for some tests of SDMF files.
|
# These are still used for some tests of SDMF files.
|
||||||
def unpack_header(data):
|
def unpack_header(data):
|
||||||
|
@ -7,6 +7,8 @@ from allmydata.util.hashutil import constant_time_compare
|
|||||||
from allmydata.storage.lease import LeaseInfo
|
from allmydata.storage.lease import LeaseInfo
|
||||||
from allmydata.storage.common import UnknownMutableContainerVersionError, \
|
from allmydata.storage.common import UnknownMutableContainerVersionError, \
|
||||||
DataTooLargeError
|
DataTooLargeError
|
||||||
|
from allmydata.mutable.layout import MAX_MUTABLE_SHARE_SIZE
|
||||||
|
|
||||||
|
|
||||||
# the MutableShareFile is like the ShareFile, but used for mutable data. It
|
# the MutableShareFile is like the ShareFile, but used for mutable data. It
|
||||||
# has a different layout. See docs/mutable.txt for more details.
|
# has a different layout. See docs/mutable.txt for more details.
|
||||||
@ -48,7 +50,7 @@ class MutableShareFile:
|
|||||||
# like a sharefile.
|
# like a sharefile.
|
||||||
MAGIC = "Tahoe mutable container v1\n" + "\x75\x09\x44\x03\x8e"
|
MAGIC = "Tahoe mutable container v1\n" + "\x75\x09\x44\x03\x8e"
|
||||||
assert len(MAGIC) == 32
|
assert len(MAGIC) == 32
|
||||||
MAX_SIZE = 2*1000*1000*1000 # 2GB, kind of arbitrary
|
MAX_SIZE = MAX_MUTABLE_SHARE_SIZE
|
||||||
# TODO: decide upon a policy for max share size
|
# TODO: decide upon a policy for max share size
|
||||||
|
|
||||||
def __init__(self, filename, parent=None):
|
def __init__(self, filename, parent=None):
|
||||||
|
@ -13,6 +13,7 @@ _pyflakes_hush = [si_b2a, si_a2b, storage_index_to_dir] # re-exported
|
|||||||
from allmydata.storage.lease import LeaseInfo
|
from allmydata.storage.lease import LeaseInfo
|
||||||
from allmydata.storage.mutable import MutableShareFile, EmptyShare, \
|
from allmydata.storage.mutable import MutableShareFile, EmptyShare, \
|
||||||
create_mutable_sharefile
|
create_mutable_sharefile
|
||||||
|
from allmydata.mutable.layout import MAX_MUTABLE_SHARE_SIZE
|
||||||
from allmydata.storage.immutable import ShareFile, BucketWriter, BucketReader
|
from allmydata.storage.immutable import ShareFile, BucketWriter, BucketReader
|
||||||
from allmydata.storage.crawler import BucketCountingCrawler
|
from allmydata.storage.crawler import BucketCountingCrawler
|
||||||
from allmydata.storage.expirer import LeaseCheckingCrawler
|
from allmydata.storage.expirer import LeaseCheckingCrawler
|
||||||
@ -225,6 +226,7 @@ class StorageServer(service.MultiService, Referenceable):
|
|||||||
|
|
||||||
version = { "http://allmydata.org/tahoe/protocols/storage/v1" :
|
version = { "http://allmydata.org/tahoe/protocols/storage/v1" :
|
||||||
{ "maximum-immutable-share-size": remaining_space,
|
{ "maximum-immutable-share-size": remaining_space,
|
||||||
|
"maximum-mutable-share-size": MAX_MUTABLE_SHARE_SIZE,
|
||||||
"tolerates-immutable-read-overrun": True,
|
"tolerates-immutable-read-overrun": True,
|
||||||
"delete-mutable-shares-with-zero-length-writev": True,
|
"delete-mutable-shares-with-zero-length-writev": True,
|
||||||
"fills-holes-with-zero-bytes": True,
|
"fills-holes-with-zero-bytes": True,
|
||||||
|
@ -179,6 +179,7 @@ class NativeStorageServer:
|
|||||||
VERSION_DEFAULTS = {
|
VERSION_DEFAULTS = {
|
||||||
"http://allmydata.org/tahoe/protocols/storage/v1" :
|
"http://allmydata.org/tahoe/protocols/storage/v1" :
|
||||||
{ "maximum-immutable-share-size": 2**32,
|
{ "maximum-immutable-share-size": 2**32,
|
||||||
|
"maximum-mutable-share-size": 2*1000*1000*1000, # maximum prior to v1.9.2
|
||||||
"tolerates-immutable-read-overrun": False,
|
"tolerates-immutable-read-overrun": False,
|
||||||
"delete-mutable-shares-with-zero-length-writev": False,
|
"delete-mutable-shares-with-zero-length-writev": False,
|
||||||
},
|
},
|
||||||
|
@ -325,6 +325,13 @@ class Server(unittest.TestCase):
|
|||||||
sv1 = ver['http://allmydata.org/tahoe/protocols/storage/v1']
|
sv1 = ver['http://allmydata.org/tahoe/protocols/storage/v1']
|
||||||
self.failUnless(sv1.get('prevents-read-past-end-of-share-data'), sv1)
|
self.failUnless(sv1.get('prevents-read-past-end-of-share-data'), sv1)
|
||||||
|
|
||||||
|
def test_declares_maximum_share_sizes(self):
|
||||||
|
ss = self.create("test_declares_maximum_share_sizes")
|
||||||
|
ver = ss.remote_get_version()
|
||||||
|
sv1 = ver['http://allmydata.org/tahoe/protocols/storage/v1']
|
||||||
|
self.failUnlessIn('maximum-immutable-share-size', sv1)
|
||||||
|
self.failUnlessIn('maximum-mutable-share-size', sv1)
|
||||||
|
|
||||||
def allocate(self, ss, storage_index, sharenums, size, canary=None):
|
def allocate(self, ss, storage_index, sharenums, size, canary=None):
|
||||||
renew_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
|
renew_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
|
||||||
cancel_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
|
cancel_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
|
||||||
|
Reference in New Issue
Block a user