Commit 362177db authored by owsla's avatar owsla

Optimize --check-destination and other functions by determining the increment

files server-side instead of client-side. (Patch from Josh Nisly)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@902 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent d9c63358
New in v1.1.17 (????/??/??) New in v1.1.17 (????/??/??)
--------------------------- ---------------------------
Optimize --check-destination and other functions by determining the increment
files server-side instead of client-side. (Patch from Josh Nisly)
Actually make rdiff-backup robust to failure to read an ACL because the file Actually make rdiff-backup robust to failure to read an ACL because the file
cannot be found. (Andrew Ferguson) cannot be found. (Andrew Ferguson)
......
...@@ -47,8 +47,10 @@ def get_inclist(inc_rpath): ...@@ -47,8 +47,10 @@ def get_inclist(inc_rpath):
inc_list = [] inc_list = []
for filename in parent_dir.listdir(): for filename in parent_dir.listdir():
inc_info = rpath.get_incfile_info(filename)
if inc_info and inc_info[3] == basename:
inc = parent_dir.append(filename) inc = parent_dir.append(filename)
if inc.isincfile() and inc.getincbase_str() == basename: assert inc.isincfile()
inc_list.append(inc) inc_list.append(inc)
return inc_list return inc_list
......
...@@ -297,6 +297,26 @@ def open_local_read(rpath): ...@@ -297,6 +297,26 @@ def open_local_read(rpath):
assert rpath.conn is Globals.local_connection assert rpath.conn is Globals.local_connection
return open(rpath.path, "rb") return open(rpath.path, "rb")
def get_incfile_info(basename):
"""Returns None or tuple of
(is_compressed, timestr, type, and basename)"""
dotsplit = basename.split(".")
if dotsplit[-1] == "gz":
compressed = 1
if len(dotsplit) < 4: return None
timestring, ext = dotsplit[-3:-1]
else:
compressed = None
if len(dotsplit) < 3: return None
timestring, ext = dotsplit[-2:]
if Time.stringtotime(timestring) is None: return None
if not (ext == "snapshot" or ext == "dir" or
ext == "missing" or ext == "diff" or ext == "data"):
return None
if compressed: basestr = ".".join(dotsplit[:-3])
else: basestr = ".".join(dotsplit[:-2])
return (compressed, timestring, ext, basestr)
class RORPath: class RORPath:
"""Read Only RPath - carry information about a path """Read Only RPath - carry information about a path
...@@ -1112,25 +1132,17 @@ class RPath(RORPath): ...@@ -1112,25 +1132,17 @@ class RPath(RORPath):
Also sets various inc information used by the *inc* functions. Also sets various inc information used by the *inc* functions.
""" """
if self.index: dotsplit = self.index[-1].split(".") if self.index: basename = self.index[-1]
else: dotsplit = self.base.split(".") else: basename = self.base
if dotsplit[-1] == "gz":
self.inc_compressed = 1 inc_info = get_incfile_info(basename)
if len(dotsplit) < 4: return None
timestring, ext = dotsplit[-3:-1] if inc_info:
self.inc_compressed, self.inc_timestr, \
self.inc_type, self.inc_basestr = inc_info
return 1
else: else:
self.inc_compressed = None
if len(dotsplit) < 3: return None
timestring, ext = dotsplit[-2:]
if Time.stringtotime(timestring) is None: return None
if not (ext == "snapshot" or ext == "dir" or
ext == "missing" or ext == "diff" or ext == "data"):
return None return None
self.inc_timestr = timestring
self.inc_type = ext
if self.inc_compressed: self.inc_basestr = ".".join(dotsplit[:-3])
else: self.inc_basestr = ".".join(dotsplit[:-2])
return 1
def isinccompressed(self): def isinccompressed(self):
"""Return true if inc file is compressed""" """Return true if inc file is compressed"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment