From 1143c9def94a3c8b8a0945a354d79d482452494d Mon Sep 17 00:00:00 2001 From: Sergey Magidovich Date: Mon, 25 May 2015 17:10:30 +0300 Subject: [PATCH 1/4] statdaemons: Add test. [#MOBMET-1661] --- dbms/include/DB/Common/SipHash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/include/DB/Common/SipHash.h b/dbms/include/DB/Common/SipHash.h index bcfe81b93ed..2892929fc09 100644 --- a/dbms/include/DB/Common/SipHash.h +++ b/dbms/include/DB/Common/SipHash.h @@ -12,7 +12,7 @@ */ #include - +#include #define ROTL(x,b) (u64)( ((x) << (b)) | ( (x) >> (64 - (b))) ) From 541f051cd146f1f5b80e8eeb7b1485290f14be3c Mon Sep 17 00:00:00 2001 From: Pavel Kartavyy Date: Wed, 1 Jul 2015 11:55:31 +0300 Subject: [PATCH 2/4] zkutil: remove ctor [#METR-17045] --- libs/libzkutil/include/zkutil/ZooKeeper.h | 1 - libs/libzkutil/src/ZooKeeper.cpp | 7 ------- 2 files changed, 8 deletions(-) diff --git a/libs/libzkutil/include/zkutil/ZooKeeper.h b/libs/libzkutil/include/zkutil/ZooKeeper.h index a402470e8bf..d7c7c077d01 100644 --- a/libs/libzkutil/include/zkutil/ZooKeeper.h +++ b/libs/libzkutil/include/zkutil/ZooKeeper.h @@ -47,7 +47,6 @@ public: */ ZooKeeper(const Poco::Util::AbstractConfiguration & config, const std::string & config_name); - ZooKeeper(const Poco::Util::AbstractConfiguration & config, const std::string & config_name, int32_t session_timeout_ms); ~ZooKeeper(); diff --git a/libs/libzkutil/src/ZooKeeper.cpp b/libs/libzkutil/src/ZooKeeper.cpp index 06ed54d65d4..52b0a0eb545 100644 --- a/libs/libzkutil/src/ZooKeeper.cpp +++ b/libs/libzkutil/src/ZooKeeper.cpp @@ -128,13 +128,6 @@ ZooKeeper::ZooKeeper(const Poco::Util::AbstractConfiguration & config, const std init(args.hosts, args.session_timeout_ms); } -ZooKeeper::ZooKeeper(const Poco::Util::AbstractConfiguration& config, const std::string& config_name, int32_t session_timeout_ms_) -{ - ZooKeeperArgs args(config, config_name); - init(args.hosts, session_timeout_ms_); -} - - void * ZooKeeper::watchForEvent(EventPtr event) { if (event) From d71b7ca1b020004b5fa7074355a757529b2e332b Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 1 Jul 2015 23:14:23 +0300 Subject: [PATCH 3/4] dbms: better diagnostics [#METR-12542]. --- dbms/src/Storages/StorageLog.cpp | 10 +++++++++- dbms/src/Storages/StorageTinyLog.cpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dbms/src/Storages/StorageLog.cpp b/dbms/src/Storages/StorageLog.cpp index 8527fd32f54..f4bc9b587ae 100644 --- a/dbms/src/Storages/StorageLog.cpp +++ b/dbms/src/Storages/StorageLog.cpp @@ -233,7 +233,15 @@ Block LogBlockInputStream::readImpl() else column.column = column.type->createColumn(); - readData(*it, *column.type, *column.column, max_rows_to_read, 0, read_offsets); + try + { + readData(*it, *column.type, *column.column, max_rows_to_read, 0, read_offsets); + } + catch (Exception & e) + { + e.addMessage("while reading column " + *it + " at " + storage.path + escapeForFileName(storage.name)); + throw; + } if (column.column->size()) res.insert(column); diff --git a/dbms/src/Storages/StorageTinyLog.cpp b/dbms/src/Storages/StorageTinyLog.cpp index c8c357ddad5..acde326fb58 100644 --- a/dbms/src/Storages/StorageTinyLog.cpp +++ b/dbms/src/Storages/StorageTinyLog.cpp @@ -198,7 +198,15 @@ Block TinyLogBlockInputStream::readImpl() else column.column = column.type->createColumn(); - readData(*it, *column.type, *column.column, block_size, 0, read_offsets); + try + { + readData(*it, *column.type, *column.column, block_size, 0, read_offsets); + } + catch (Exception & e) + { + e.addMessage("while reading column " + *it + " at " + storage.full_path()); + throw; + } if (column.column->size()) res.insert(column); From efddabd212f0eaa9f0fb683c143d021f2a45f4ec Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 1 Jul 2015 23:42:42 +0300 Subject: [PATCH 4/4] Merge --- dbms/src/Storages/StorageChunkMerger.cpp | 15 ++++++++------- dbms/src/Storages/StorageChunks.cpp | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dbms/src/Storages/StorageChunkMerger.cpp b/dbms/src/Storages/StorageChunkMerger.cpp index 964d4af9a7e..e314f127b08 100644 --- a/dbms/src/Storages/StorageChunkMerger.cpp +++ b/dbms/src/Storages/StorageChunkMerger.cpp @@ -545,7 +545,8 @@ bool StorageChunkMerger::MergeTask::mergeChunks(const Storages & chunks) { LOG_INFO(log, "Shutdown requested while merging chunks."); output->writeSuffix(); - new_storage.removeReference(); /// После этого временные данные удалятся. + output = nullptr; + executeQuery("DROP TABLE IF EXISTS " + new_table_full_name, context, true); return false; } @@ -575,14 +576,16 @@ bool StorageChunkMerger::MergeTask::mergeChunks(const Storages & chunks) /// Отцепляем исходную таблицу. Ее данные и метаданные остаются на диске. tables_to_drop.push_back(context.detachTable(chunk_merger.source_database, src_name)); - /// Создаем на ее месте ChunkRef. Это возможно только потому что у ChunkRef нет ни, ни метаданных. + /// Создаем на ее месте ChunkRef. Это возможно только потому что у ChunkRef нет ни данных, ни метаданных. try { - context.addTable(chunk_merger.source_database, src_name, StorageChunkRef::create(src_name, context, chunk_merger.source_database, new_table_name, false)); + context.addTable(chunk_merger.source_database, src_name, + StorageChunkRef::create(src_name, context, chunk_merger.source_database, new_table_name, false)); } catch (...) { - LOG_ERROR(log, "Chunk " + src_name + " was removed but not replaced. Its data is stored in table " << new_table_name << ". You may need to resolve this manually."); + LOG_ERROR(log, "Chunk " + src_name + " was removed but not replaced. Its data is stored in table " + << new_table_name << ". You may need to resolve this manually."); throw; } @@ -601,9 +604,6 @@ bool StorageChunkMerger::MergeTask::mergeChunks(const Storages & chunks) /// что-нибудь может сломаться. } - /// Сейчас на new_storage ссылаются таблицы типа ChunkRef. Удалим лишнюю ссылку, которая была при создании. - new_storage.removeReference(); - LOG_TRACE(log, "Merged chunks."); return true; @@ -613,6 +613,7 @@ bool StorageChunkMerger::MergeTask::mergeChunks(const Storages & chunks) Poco::ScopedLock lock(context.getMutex()); currently_written_groups.erase(new_table_full_name); + executeQuery("DROP TABLE IF EXISTS " + new_table_full_name, context, true); throw; } diff --git a/dbms/src/Storages/StorageChunks.cpp b/dbms/src/Storages/StorageChunks.cpp index 68ec39e358d..aa55c1b43c0 100644 --- a/dbms/src/Storages/StorageChunks.cpp +++ b/dbms/src/Storages/StorageChunks.cpp @@ -161,9 +161,6 @@ StorageChunks::StorageChunks( context(context_), log(&Logger::get("StorageChunks")) { - if (!attach) - reference_counter.add(1, true); - _table_column_name = "_table" + VirtualColumnUtils::chooseSuffix(getColumnsList(), "_table"); try