mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-27 11:55:15 +00:00
transport: Make type_codec::type_id_to_type thread-local
Data type objects are thread-local so the lookup map also needs to be thread-local. Fixes SMP issues when prepared statements are enabled which exercise the type encoders. Spotted by Tomek. Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
This commit is contained in:
@@ -963,7 +963,7 @@ private:
|
||||
boost::bimaps::unordered_set_of<type_id>,
|
||||
boost::bimaps::unordered_set_of<data_type>>;
|
||||
|
||||
static const type_id_to_type_type type_id_to_type;
|
||||
static thread_local const type_id_to_type_type type_id_to_type;
|
||||
public:
|
||||
static void encode(cql_server::response& r, data_type type) {
|
||||
type = type->underlying_type();
|
||||
@@ -984,7 +984,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
const type_codec::type_id_to_type_type type_codec::type_id_to_type = boost::assign::list_of<type_id_to_type_type::relation>
|
||||
thread_local const type_codec::type_id_to_type_type type_codec::type_id_to_type = boost::assign::list_of<type_id_to_type_type::relation>
|
||||
(type_id::ASCII , ascii_type)
|
||||
(type_id::BIGINT , long_type)
|
||||
(type_id::BLOB , bytes_type)
|
||||
|
||||
Reference in New Issue
Block a user