Browse Source

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.
tags/nilmdb-1.9.7
Jim Paris 10 years ago
parent
commit
c47f28f93a
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      nilmdb/server/bulkdata.py

+ 3
- 0
nilmdb/server/bulkdata.py View File

@@ -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")


Loading…
Cancel
Save