cql3: fix query_options::DEFAULT not smp safe

Contains a shared_ptr (inside specific_options), so cannot be global.  Make
it thread_local instead.
This commit is contained in:
Avi Kivity
2015-04-07 17:28:37 +03:00
committed by Tomasz Grabiec
parent d81320a2dd
commit 538c7fdf2a
2 changed files with 4 additions and 4 deletions

View File

@@ -26,9 +26,9 @@
namespace cql3 {
const query_options::specific_options query_options::specific_options::DEFAULT{-1, {}, {}, api::missing_timestamp};
thread_local const query_options::specific_options query_options::specific_options::DEFAULT{-1, {}, {}, api::missing_timestamp};
default_query_options query_options::DEFAULT{db::consistency_level::ONE,
thread_local default_query_options query_options::DEFAULT{db::consistency_level::ONE,
{}, false, query_options::specific_options::DEFAULT, 3, serialization_format::use_32_bit()};
}

View File

@@ -47,7 +47,7 @@ public:
explicit query_options(serialization_format sf) : _serialization_format(sf) {}
// Options that are likely to not be present in most queries
struct specific_options final {
static const specific_options DEFAULT;
static thread_local const specific_options DEFAULT;
const int32_t page_size;
const ::shared_ptr<service::pager::paging_state> state;
@@ -56,7 +56,7 @@ public:
};
// It can't be const because of prepare()
static default_query_options DEFAULT;
static thread_local default_query_options DEFAULT;
virtual ~query_options() {}