HuaHuaY commented on code in PR #405:
URL: https://github.com/apache/iceberg-cpp/pull/405#discussion_r2605262254
##########
src/iceberg/catalog/memory/in_memory_catalog.cc:
##########
@@ -443,12 +447,14 @@ Result<std::unique_ptr<Table>> InMemoryCatalog::LoadTable(
Result<std::shared_ptr<Table>> InMemoryCatalog::RegisterTable(
const TableIdentifier& identifier, const std::string&
metadata_file_location) {
- std::lock_guard guard(mutex_);
- if (!root_namespace_->NamespaceExists(identifier.ns)) {
- return NoSuchNamespace("table namespace does not exist.");
- }
- if (!root_namespace_->RegisterTable(identifier, metadata_file_location)) {
- return UnknownError("The registry failed.");
+ {
+ std::unique_lock lock(mutex_);
+ if (!root_namespace_->NamespaceExists(identifier.ns)) {
+ return NoSuchNamespace("table namespace does not exist.");
+ }
+ if (!root_namespace_->RegisterTable(identifier, metadata_file_location)) {
+ return UnknownError("The registry failed.");
+ }
}
return LoadTable(identifier);
Review Comment:
How do you think about this scene?
1. thread a: line 458 register table A
2. thread b: drop A and register same name table A'
3. thread a: line 459 load A'
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]