Skip to content

Commit c07c57c

Browse files
committed
Fix: File listing after update.
Issue: Updates to files were not stored in the GEDS internal cache. This resulted in invalid file listings. To mitigate this issue the following changes were added: - Updates are now reflected in the cache. - The metadata server is always queried when the file status is requested. Signed-off-by: Pascal Spörri <[email protected]>
1 parent 64a2721 commit c07c57c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/libgeds/GEDS.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ absl::StatusOr<GEDSFileStatus> GEDS::status(const std::string &bucket, const std
659659
}
660660

661661
// Location is most likely a file.
662-
auto obj = _metadataService.lookup(bucket, key);
662+
auto obj = _metadataService.lookup(bucket, key, true /* invalidate */);
663663
if (obj.ok()) {
664664
return GEDSFileStatus{.key = key, .size = obj->info.size, .isDirectory = false};
665665
}

src/libgeds/MetadataService.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ absl::Status MetadataService::createObject(const geds::Object &obj) {
249249
absl::Status MetadataService::updateObject(const geds::Object &obj) {
250250
METADATASERVICE_CHECK_CONNECTED;
251251

252+
(void)_mdsCache.updateObject(obj);
253+
252254
geds::rpc::Object request;
253255
auto id = request.mutable_id();
254256
id->set_bucket(obj.id.bucket);
@@ -508,4 +510,4 @@ absl::Status MetadataService::unsubscribe(const geds::SubscriptionEvent &event)
508510
return convertStatus(response);
509511
}
510512

511-
} // namespace geds
513+
} // namespace geds

0 commit comments

Comments
 (0)