summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-09-25 09:21:38 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-09-25 09:21:38 +0000
commit10ab6a77101e19fce1142b4c74a889bf9aa97b08 (patch)
tree15d1cfba7cc674a05956afcab4ace560819d7ae9
parent50c1696f4771c21c715b9ded73a409debaf21955 (diff)
downloadrdiff-backup-10ab6a77101e19fce1142b4c74a889bf9aa97b08.tar.gz
Possibly fixed logic error in rf caching
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@452 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG3
-rw-r--r--rdiff-backup/rdiff_backup/restore.py14
2 files changed, 12 insertions, 5 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index 2669533..9d1cee8 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -7,6 +7,9 @@ Fixed bug in --test-server when using --restrict security options
--list-changed-since and --list-at-time now work remotely.
Thanks to Morten Werner Olsen for bug report.
+Fixed logic bug that could make restoring extremely slow and waste
+memory. Thanks for Jacques Botha for report.
+
New in v0.12.4 (2003/09/13)
---------------------------
diff --git a/rdiff-backup/rdiff_backup/restore.py b/rdiff-backup/rdiff_backup/restore.py
index a7b6b3e..31fa5a5 100644
--- a/rdiff-backup/rdiff_backup/restore.py
+++ b/rdiff-backup/rdiff_backup/restore.py
@@ -298,11 +298,15 @@ class CachedRF:
while 1:
if not self.rf_list:
if not self.add_rfs(index): return None
- rf = self.rf_list.pop(0)
- if rf.index < index: continue
- elif rf.index == index: return rf
- self.rf_list.insert(0, rf)
- if not self.add_rfs(index): return None
+ rf = self.rf_list[0]
+ if rf.index == index: return rf
+ elif rf.index > index:
+ # Try to add earlier indicies. But if first is
+ # already from same directory, or we can't find any
+ # from that directory, then we know it can't be added.
+ if (index[:-1] == rf.index[:-1] or not
+ self.add_rfs(index)): return None
+ else: del self.rf_list[0]
def get_fp(self, index):
"""Return the file object (for reading) of given index"""