[ARVADOS] created: 2.1.0-1876-g47d28cc62
Git user
git at public.arvados.org
Fri Feb 4 22:20:19 UTC 2022
at 47d28cc62b43fb7279e89e5bffd30c766cdb0fc1 (commit)
commit 47d28cc62b43fb7279e89e5bffd30c766cdb0fc1
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Fri Feb 4 17:18:58 2022 -0500
18719: Make sure to ignore old versions of collections
Also, websocket events are nothing but trouble
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/services/fuse/arvados_fuse/command.py b/services/fuse/arvados_fuse/command.py
index 5f0a1f80f..416764464 100644
--- a/services/fuse/arvados_fuse/command.py
+++ b/services/fuse/arvados_fuse/command.py
@@ -91,7 +91,7 @@ class ArgumentParser(argparse.ArgumentParser):
self.add_argument('--file-cache', type=int, help="File data cache size, in bytes (default 256MiB)", default=256*1024*1024)
self.add_argument('--directory-cache', type=int, help="Directory data cache size, in bytes (default 128MiB)", default=128*1024*1024)
- self.add_argument('--disable-event-listening', action='store_true', help="Don't subscribe to events on the API server", dest="disable_event_listening", default=False)
+ self.add_argument('--disable-event-listening', action='store_true', help="Don't subscribe to events on the API server", dest="disable_event_listening", default=True)
self.add_argument('--read-only', action='store_false', help="Mount will be read only (default)", dest="enable_write", default=False)
self.add_argument('--read-write', action='store_true', help="Mount will be read-write", dest="enable_write", default=False)
diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index a2e33c7b3..c69443089 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -336,6 +336,11 @@ class CollectionDirectoryBase(Directory):
self.inodes.invalidate_inode(item.fuse_entry)
elif name in self._entries:
self.inodes.invalidate_inode(self._entries[name])
+
+ if self.collection_record_file:
+ self.collection_record_file.invalidate()
+ self.inodes.invalidate_inode(self.collection_record_file)
+ _logger.debug("%s invalidated collection record", self)
finally:
while lockcount > 0:
self.collection.lock.acquire()
@@ -512,6 +517,8 @@ class CollectionDirectory(CollectionDirectoryBase):
_logger.debug("%s already processed %s", self.collection_locator, to_record_version)
else:
self.collection.update()
+ new_collection_record = self.collection.api_response()
+ coll_reader = self.collection
else:
if uuid_pattern.match(self.collection_locator):
coll_reader = arvados.collection.Collection(
@@ -534,9 +541,16 @@ class CollectionDirectory(CollectionDirectoryBase):
new_collection_record['storage_classes_desired'] = coll_reader.storage_classes_desired()
# end with llfuse.lock_released, re-acquire lock
+
+ # refresh collection contents if
+ # 1. it is the first time loading the collection
+ # 2. the portable data hash of the working collection differs from upstream
+ # 3. the version number changed
if (new_collection_record is not None and
(self.collection_record is None or
- self.collection_record["portable_data_hash"] != new_collection_record.get("portable_data_hash"))):
+ coll_reader.portable_data_hash() != new_collection_record.get("portable_data_hash") or
+ self.collection_record.get("version") != new_collection_record.get("version"))):
+
self.new_collection(new_collection_record, coll_reader)
self._manifest_size = len(coll_reader.manifest_text())
_logger.debug("%s manifest_size %i", self, self._manifest_size)
@@ -630,29 +644,6 @@ class TmpCollectionDirectory(CollectionDirectoryBase):
self.collection_record_file = None
self.populate(self.mtime())
- def on_event(self, *args, **kwargs):
- super(TmpCollectionDirectory, self).on_event(*args, **kwargs)
- if self.collection_record_file:
-
- # See discussion in CollectionDirectoryBase.on_event
- lockcount = 0
- try:
- while True:
- self.collection.lock.release()
- lockcount += 1
- except RuntimeError:
- pass
-
- try:
- with llfuse.lock:
- with self.collection.lock:
- self.collection_record_file.invalidate()
- self.inodes.invalidate_inode(self.collection_record_file)
- _logger.debug("%s invalidated collection record", self)
- finally:
- while lockcount > 0:
- self.collection.lock.acquire()
- lockcount -= 1
def collection_record(self):
with llfuse.lock_released:
@@ -973,11 +964,13 @@ class ProjectDirectory(Directory):
uuid=self.project_uuid,
filters=[["uuid", "is_a", "arvados#group"],
["groups.group_class", "in", ["project","filter"]]]))
- contents.extend(arvados.util.keyset_list_all(self.api.groups().contents,
+ contents.extend(filter(lambda i: i["current_version_uuid"] == i["uuid"],
+ arvados.util.keyset_list_all(self.api.groups().contents,
order_key="uuid",
num_retries=self.num_retries,
uuid=self.project_uuid,
- filters=[["uuid", "is_a", "arvados#collection"]]))
+ filters=[["uuid", "is_a", "arvados#collection"]])))
+
# end with llfuse.lock_released, re-acquire lock
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list