if free_string:
out.append("".join(free_string))
- if self.version >= 2:
+ if self.version >= 2 and common.OPTIONS.cache_size is not None:
# Sanity check: abort if we're going to need more stash space than
# the allowed size (cache_size * threshold). There are two purposes
# of having a threshold here. a) Part of the cache may have been
if self.version >= 2:
max_stashed_size = max_stashed_blocks * self.tgt.blocksize
- max_allowed = common.OPTIONS.cache_size * common.OPTIONS.stash_threshold
- print("max stashed blocks: %d (%d bytes), limit: %d bytes (%.2f%%)\n" % (
- max_stashed_blocks, max_stashed_size, max_allowed,
- max_stashed_size * 100.0 / max_allowed))
+ OPTIONS = common.OPTIONS
+ if OPTIONS.cache_size is not None:
+ max_allowed = OPTIONS.cache_size * OPTIONS.stash_threshold
+ print("max stashed blocks: %d (%d bytes), "
+ "limit: %d bytes (%.2f%%)\n" % (
+ max_stashed_blocks, max_stashed_size, max_allowed,
+ max_stashed_size * 100.0 / max_allowed))
+ else:
+ print("max stashed blocks: %d (%d bytes), limit: <unknown>\n" % (
+ max_stashed_blocks, max_stashed_size))
def ReviseStashSize(self):
print("Revising stash size...")
self.source_info_dict = None
self.target_info_dict = None
self.worker_threads = None
+ # Stash size cannot exceed cache_size * threshold.
+ self.cache_size = None
+ self.stash_threshold = 0.8
OPTIONS = Options()
cache_size = OPTIONS.info_dict.get("cache_size", None)
if cache_size is None:
- raise RuntimeError("can't determine the cache partition size")
+ print "--- can't determine the cache partition size ---"
OPTIONS.cache_size = cache_size
if OPTIONS.incremental_source is None: