From c47f28f93a8e8e5e19257e21d17f3e28cc19904f Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Fri, 16 Aug 2013 15:30:56 -0400 Subject: [PATCH] Fix cache issue in stream_rename We saw a bug where renamed streams had missing data at the end. I think what happened is: - Write data to /old/path - Rename to /new/path - Write data to /new/path - Cache entry for /old/path gets evicted, file gets truncated Instead, make sure we evict /old/path right away when renaming. --- nilmdb/server/bulkdata.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nilmdb/server/bulkdata.py b/nilmdb/server/bulkdata.py index 4f97352..2841fd0 100644 --- a/nilmdb/server/bulkdata.py +++ b/nilmdb/server/bulkdata.py @@ -194,6 +194,9 @@ class BulkData(object): if oldospath == newospath: raise ValueError("old and new paths are the same") + # Remove Table object at old path from cache + self.getnode.cache_remove(self, oldunicodepath) + # Move the table to a temporary location tmpdir = tempfile.mkdtemp(prefix = "rename-", dir = self.root) tmppath = os.path.join(tmpdir, "table")