filesystem: add file syncs
The "does the size on disk match the manifest" size checks in I70a7bb5f73d1dddc540e96529784bb8c9bb0b9e3 appear to having a false-positive on some changes. One example job I found failed with Manifest has invalid size for layer sha256:9815a275e5d0f93566302aeb58a49bf71b121debe1a291cf0f64278fe97ec9b5 (size:203129434 actual:185016320) but when I went to look at the file on disk (quite some time later), it was correct $ ls -l ./_local/blobs/sha256:9815a275e5d0f93566302aeb58a49bf71b121debe1a291cf0f64278fe97ec9b5 -rw-r--r-- 1 root root 203129433 Sep 7 01:53 data (well, off by one byte, but that's the problem worked-around by the original change). I think what happened here is that is that when we're getting into multi-hundred megabyte layers there's plenty of chance for the writes to join the upload chunks to have not flushed by the time we check it when the manifest is uploaded. Add some flush and sync points after upload and concatentation writes to avoid this. Change-Id: I46606287d41fa6745de7c8bfb31c6b0d28e32957
This commit is contained in:
parent
95261e654b
commit
7100c360b3
@ -52,6 +52,8 @@ class FilesystemDriver(storageutils.StorageDriver):
|
||||
else:
|
||||
for chunk in data:
|
||||
f.write(chunk)
|
||||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
|
||||
def get_object(self, path):
|
||||
path = os.path.join(self.root, path)
|
||||
@ -117,6 +119,8 @@ class FilesystemDriver(storageutils.StorageDriver):
|
||||
if not d:
|
||||
break
|
||||
outf.write(d)
|
||||
outf.flush()
|
||||
os.fsync(outf.fileno())
|
||||
for chunk in chunks:
|
||||
chunk_path = os.path.join(self.root, chunk['path'])
|
||||
os.unlink(chunk_path)
|
||||
|
Loading…
Reference in New Issue
Block a user