projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '13064-arv-mount-perf' closes #13064
[arvados.git]
/
sdk
/
python
/
arvados
/
arvfile.py
diff --git
a/sdk/python/arvados/arvfile.py
b/sdk/python/arvados/arvfile.py
index 2c653d7f09333a7e02621f8647e52c6bcace740e..f4580f346bbed43a5642e974d54c8e5922c24efd 100644
(file)
--- a/
sdk/python/arvados/arvfile.py
+++ b/
sdk/python/arvados/arvfile.py
@@
-1,3
+1,7
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
from __future__ import absolute_import
from __future__ import division
from future import standard_library
from __future__ import absolute_import
from __future__ import division
from future import standard_library
@@
-799,7
+803,7
@@
class _BlockManager(object):
if v.state() != _BufferBlock.COMMITTED and v.owner:
# Ignore blocks with a list of owners, as if they're not in COMMITTED
# state, they're already being committed asynchronously.
if v.state() != _BufferBlock.COMMITTED and v.owner:
# Ignore blocks with a list of owners, as if they're not in COMMITTED
# state, they're already being committed asynchronously.
- if
not isinstance(v.owner, list
):
+ if
isinstance(v.owner, ArvadosFile
):
v.owner.flush(sync=False)
with self.lock:
v.owner.flush(sync=False)
with self.lock:
@@
-824,7
+828,7
@@
class _BlockManager(object):
# of repacking small blocks, so don't delete it when flushing
# its owners, just do it after flushing them all.
for owner in v.owner:
# of repacking small blocks, so don't delete it when flushing
# its owners, just do it after flushing them all.
for owner in v.owner:
- owner.flush(sync=True
, delete_bufferblock=False
)
+ owner.flush(sync=True)
self.delete_bufferblock(k)
def block_prefetch(self, locator):
self.delete_bufferblock(k)
def block_prefetch(self, locator):
@@
-862,6
+866,9
@@
class ArvadosFile(object):
"""
"""
+ __slots__ = ('parent', 'name', '_writers', '_committed',
+ '_segments', 'lock', '_current_bblock', 'fuse_entry')
+
def __init__(self, parent, name, stream=[], segments=[]):
"""
ArvadosFile constructor.
def __init__(self, parent, name, stream=[], segments=[]):
"""
ArvadosFile constructor.
@@
-1129,7
+1136,7
@@
class ArvadosFile(object):
return len(data)
@synchronized
return len(data)
@synchronized
- def flush(self, sync=True, num_retries=0
, delete_bufferblock=True
):
+ def flush(self, sync=True, num_retries=0):
"""Flush the current bufferblock to Keep.
:sync:
"""Flush the current bufferblock to Keep.
:sync:
@@
-1155,8
+1162,10
@@
class ArvadosFile(object):
self.parent._my_block_manager().commit_bufferblock(bb, sync=True)
to_delete.add(s.locator)
s.locator = bb.locator()
self.parent._my_block_manager().commit_bufferblock(bb, sync=True)
to_delete.add(s.locator)
s.locator = bb.locator()
- if delete_bufferblock:
- for s in to_delete:
+ for s in to_delete:
+ # Don't delete the bufferblock if it's owned by many files. It'll be
+ # deleted after all of its owners are flush()ed.
+ if self.parent._my_block_manager().get_bufferblock(s).owner is self:
self.parent._my_block_manager().delete_bufferblock(s)
self.parent.notify(MOD, self.parent, self.name, (self, self))
self.parent._my_block_manager().delete_bufferblock(s)
self.parent.notify(MOD, self.parent, self.name, (self, self))