Add VERSION_INT (ClickHouse version in integer format like 18014009) to system.metrics and system.build_options

This commit is contained in:
proller 2018-11-22 21:24:38 +03:00
parent 2afabbe05c
commit f410c93fb1
7 changed files with 9 additions and 0 deletions

View File

@ -22,3 +22,5 @@ endif ()
set (VERSION_NAME "${PROJECT_NAME}" CACHE STRING "")
set (VERSION_FULL "${VERSION_NAME} ${VERSION_STRING}" CACHE STRING "")
set (VERSION_SO "${VERSION_STRING}" CACHE STRING "")
math (EXPR VERSION_INT "${VERSION_PATCH} + ${VERSION_MINOR}*1000 + ${VERSION_MAJOR}*1000000")

View File

@ -55,6 +55,7 @@
namespace CurrentMetrics
{
extern const Metric Revision;
extern const Metric VersionInt;
}
namespace DB
@ -109,6 +110,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
registerStorages();
CurrentMetrics::set(CurrentMetrics::Revision, ClickHouseRevision::get());
CurrentMetrics::set(CurrentMetrics::VersionInt, ClickHouseRevision::getVersionInt());
/** Context contains all that query execution is dependent:
* settings, available functions, data types, aggregate functions, databases...

View File

@ -4,4 +4,5 @@
namespace ClickHouseRevision
{
unsigned get() { return VERSION_REVISION; }
unsigned getVersionInt() { return VERSION_INT; }
}

View File

@ -3,4 +3,5 @@
namespace ClickHouseRevision
{
unsigned get();
unsigned getVersionInt();
}

View File

@ -40,6 +40,7 @@
M(StorageBufferBytes, "Number of bytes in buffers of Buffer tables") \
M(DictCacheRequests, "Number of requests in fly to data sources of dictionaries of cache type.") \
M(Revision, "Revision of the server. It is a number incremented for every release or release candidate.") \
M(VersionInt, "Version of the server. It is a number incremented for every release.") \
M(RWLockWaitingReaders, "Number of threads waiting for read on a table RWLock.") \
M(RWLockWaitingWriters, "Number of threads waiting for write on a table RWLock.") \
M(RWLockActiveReaders, "Number of threads holding read lock in a table RWLock.") \

View File

@ -23,6 +23,7 @@
#cmakedefine VERSION_FULL "@VERSION_FULL@"
#cmakedefine VERSION_DESCRIBE "@VERSION_DESCRIBE@"
#cmakedefine VERSION_GITHASH "@VERSION_GITHASH@"
#cmakedefine VERSION_INT @VERSION_INT@
#if defined(VERSION_MAJOR)
#define DBMS_VERSION_MAJOR VERSION_MAJOR

View File

@ -6,6 +6,7 @@ const char * auto_config_build[]
"VERSION_DESCRIBE", "@VERSION_DESCRIBE@",
"VERSION_GITHASH", "@VERSION_GITHASH@",
"VERSION_REVISION", "@VERSION_REVISION@",
"VERSION_INT", "@VERSION_INT@",
"BUILD_DATE", "@BUILD_DATE@",
"BUILD_TYPE", "@CMAKE_BUILD_TYPE@",
"SYSTEM", "@CMAKE_SYSTEM@",