Conversation
|
|
|
Some considerations:
Also, IMHO, |
src/Storages/StorageJoin.h
Outdated
| /// Access the innards. | ||
| HashJoinPtr & getJoin() { return join; } | ||
| std::shared_ptr<HashJoinHolder> getJoin() { return std::make_shared<HashJoinHolder>(rwlock, join); } | ||
| HashJoinPtr getJoin(std::shared_ptr<TableJoin> analyzed_join) const; |
There was a problem hiding this comment.
I think this method should actually return HashJoinHolder (looks a little bit more logical then having shared_lock inside HashJoin) .
There was a problem hiding this comment.
We discussed that it will requires changes in ExpressionAnalyzer, it will have to handle this lock. So decided to keep lock in HashJoin.
Move joinGet into StorageJoin Protect JoinSource with lock, add test Add comments about locking logic
We discussed that it will requires changes in ExpressionAnalyzer, it will have to handle this lock. So decided to keep lock in HashJoin and add mote detailed comments to code.
Yes, lock removed accidentally, I fixed it and added into test.
I moved |
src/Functions/FunctionJoinGet.h
Outdated
| public: | ||
| ExecutableFunctionJoinGet(HashJoinPtr join_, const DB::Block & result_columns_) | ||
| : join(std::move(join_)), result_columns(result_columns_) {} | ||
| ExecutableFunctionJoinGet(StorageJoinPtr storage_join_, const DB::Block & result_columns_) |
There was a problem hiding this comment.
I think we also need to hold TableLockHolder here along with storage.
src/Interpreters/HashJoin.cpp
Outdated
|
|
||
| { | ||
| std::unique_lock lock(data->rwlock); | ||
| assert(storage_join_lock.mutex() == nullptr); |
There was a problem hiding this comment.
Hm, I think exception will be better here, cause it is not a class invariant.
| DataTypePtr joinGetCheckAndGetReturnType(const DataTypes & data_types, const String & column_name, bool or_null) const; | ||
| ColumnWithTypeAndName joinGet(const Block & block, const Block & block_with_columns_to_add) const; |
There was a problem hiding this comment.
Need some comments for this methods.
Backport #21009 to 21.2: Fix race in storage join
Backport #21009 to 21.1: Fix race in storage join
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix race introduced in PR #20079