Skip to content

Commit

Permalink
Fixed common source of errors while deploying newer version of ClickH…
Browse files Browse the repository at this point in the history
…ouse [#CLICKHOUSE-3282].
  • Loading branch information
alexey-milovidov committed Sep 6, 2017
1 parent 76957f7 commit 9c37dfd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dbms/src/Interpreters/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ SharedLibraryPtr Compiler::getOrCount(
}


/// This will guarantee that code will compile only when version of headers match version of running server.
static void addCodeToAssertHeadersMatch(WriteBuffer & out)
{
out <<
"#include <Common/config_version.h>\n"
"#if VERSION_REVISION != " << ClickHouseRevision::get() << "\n"
"#error \"ClickHouse headers revision doesn't match runtime revision of the server.\"\n"
"#endif\n\n";
}


void Compiler::compile(
HashedKey hashed_key,
std::string file_name,
Expand All @@ -197,6 +208,8 @@ void Compiler::compile(

{
WriteBufferFromFile out(cpp_file_path);

addCodeToAssertHeadersMatch(out);
out << get_code();
}

Expand Down

0 comments on commit 9c37dfd

Please sign in to comment.