mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix TSAN race in transform
This commit is contained in:
parent
bf10989515
commit
2508e91856
@ -154,7 +154,7 @@ namespace
|
||||
ColumnPtr executeImpl(
|
||||
const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override
|
||||
{
|
||||
initialize(arguments, result_type);
|
||||
std::call_once(once, [&] { initialize(arguments, result_type); });
|
||||
|
||||
const auto * in = arguments[0].column.get();
|
||||
|
||||
@ -672,11 +672,9 @@ namespace
|
||||
ColumnPtr default_column;
|
||||
|
||||
bool is_empty = false;
|
||||
bool initialized = false;
|
||||
|
||||
std::mutex mutex;
|
||||
};
|
||||
|
||||
mutable std::once_flag once;
|
||||
mutable Cache cache;
|
||||
|
||||
|
||||
@ -706,10 +704,6 @@ namespace
|
||||
/// Can be called from different threads. It works only on the first call.
|
||||
void initialize(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type) const
|
||||
{
|
||||
std::lock_guard lock(cache.mutex);
|
||||
if (cache.initialized)
|
||||
return;
|
||||
|
||||
const DataTypePtr & from_type = arguments[0].type;
|
||||
|
||||
if (from_type->onlyNull())
|
||||
@ -824,8 +818,6 @@ namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache.initialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user