提交 9862f17a 编写于 作者: A Alexey Milovidov

Merge branch 'master' of github.com:yandex/ClickHouse

......@@ -139,7 +139,8 @@ struct MergeTreeDataPart
std::atomic<UInt64> size_in_bytes {0}; /// size in bytes, 0 - if not counted;
/// is used from several threads without locks (it is changed with ALTER).
time_t modification_time = 0;
mutable std::atomic<time_t> remove_time { std::numeric_limits<time_t>::max() }; /// When the part is removed from the working set. Changes once.
/// When the part is removed from the working set. Changes once.
mutable std::atomic<time_t> remove_time { std::numeric_limits<time_t>::max() };
/// If true, the destructor will delete the directory with the part.
bool is_temp = false;
......
......@@ -66,7 +66,9 @@ void StorageSystemParts::processNextStorage(MutableColumns & columns, const Stor
columns[i++]->insert(static_cast<UInt64>(part->rows_count));
columns[i++]->insert(static_cast<UInt64>(part->size_in_bytes));
columns[i++]->insert(static_cast<UInt64>(part->modification_time));
columns[i++]->insert(static_cast<UInt64>(part->remove_time.load(std::memory_order_relaxed)));
time_t remove_time = part->remove_time.load(std::memory_order_relaxed);
columns[i++]->insert(static_cast<UInt64>(remove_time == std::numeric_limits<time_t>::max() ? 0 : remove_time));
/// For convenience, in returned refcount, don't add references that was due to local variables in this method: all_parts, active_parts.
columns[i++]->insert(static_cast<UInt64>(part.use_count() - 1));
......
......@@ -70,6 +70,7 @@ private:
std::string time_zone;
/// We can correctly process only timestamps that less DATE_LUT_MAX (i.e. up to 2105 year inclusively)
inline size_t findIndex(time_t t) const
{
/// First guess.
......@@ -242,8 +243,10 @@ public:
{
size_t index = findIndex(t);
/// If it is not 1970 year (findIndex found nothing appropriate),
/// than limit number of hours to avoid insane results like 1970-01-01 89:28:15
if (unlikely(index == 0))
return (t + offset_at_start_of_epoch) / 3600;
return static_cast<unsigned>((t + offset_at_start_of_epoch) / 3600) % 24;
time_t res = t - lut[index].date;
......
......@@ -64,7 +64,7 @@ DateLUTImpl::DateLUTImpl(const std::string & time_zone_)
{
cctz::time_zone::civil_lookup lookup = cctz_time_zone.lookup(date);
start_of_day = std::chrono::system_clock::to_time_t(lookup.pre); /// Ambiguouty is possible.
start_of_day = std::chrono::system_clock::to_time_t(lookup.pre); /// Ambiguity is possible.
Values & values = lut[i];
values.year = date.year();
......
......@@ -15,6 +15,7 @@ target_link_libraries (date_lut3 common ${PLATFORM_LIBS})
target_link_libraries (date_lut4 common ${PLATFORM_LIBS})
target_link_libraries (date_lut_default_timezone common ${PLATFORM_LIBS})
target_link_libraries (multi_version common)
add_check(multi_version)
add_executable (unit_tests_libcommon gtest_json_test.cpp gtest_strong_typedef.cpp)
target_link_libraries (unit_tests_libcommon gtest_main common)
......
......@@ -19,7 +19,7 @@ void thread1(MV & x, T & result)
void thread2(MV & x, const char * result)
{
x.set(std::make_shared<T>(result));
x.set(std::make_unique<T>(result));
}
......@@ -31,7 +31,7 @@ int main(int argc, char ** argv)
const char * s2 = "Goodbye!";
size_t n = 1000;
MV x(std::make_shared<T>(s1));
MV x(std::make_unique<T>(s1));
Results results(n);
ThreadPool tp(8);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册