瀏覽代碼

set MAX_DATA_SIZE = 20971479 bytes in solid stone

Marian Beermann 8 年之前
父節點
當前提交
b0e4f13fba
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 3 1
      src/borg/constants.py
  2. 2 2
      src/borg/repository.py

+ 3 - 1
src/borg/constants.py

@@ -27,7 +27,9 @@ CACHE_TAG_CONTENTS = b'Signature: 8a477f597d28d172789f06886806bc55'
 # bytes. That's why it's 500 MiB instead of 512 MiB.
 DEFAULT_MAX_SEGMENT_SIZE = 500 * 1024 * 1024
 
-MAX_DATA_SIZE = 20 * 1024 * 1024
+# 20 MiB minus 41 bytes for a Repository header (because the "size" field in the Repository includes
+# the header, and the total size was set to 20 MiB).
+MAX_DATA_SIZE = 20971479
 
 # A few hundred files per directory to go easy on filesystems which don't like too many files per dir (NTFS)
 DEFAULT_SEGMENTS_PER_DIR = 500

+ 2 - 2
src/borg/repository.py

@@ -1203,7 +1203,7 @@ class LoggedIO:
         return self.segment - 1  # close_segment() increments it
 
 
-# MAX_OBJECT_SIZE = 20 MiB (MAX_DATA_SIZE) + 41 bytes for a Repository PUT header, which consists of
+# MAX_OBJECT_SIZE = <20 MiB (MAX_DATA_SIZE) + 41 bytes for a Repository PUT header, which consists of
 # a 1 byte tag ID, 4 byte CRC, 4 byte size and 32 bytes for the ID.
 MAX_OBJECT_SIZE = MAX_DATA_SIZE + LoggedIO.put_header_fmt.size
-assert MAX_OBJECT_SIZE == 20971561
+assert MAX_OBJECT_SIZE == 20971520 == 20 * 1024 * 1024