mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge branch 'master' into extra-warnings
This commit is contained in:
commit
f7107f12b4
42
.travis.yml
42
.travis.yml
@ -4,27 +4,27 @@ matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
# We need to have gcc7 headers to compile c++17 code on clang
|
||||
- os: linux
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
timeout: 1000
|
||||
directories:
|
||||
- /home/travis/.ccache
|
||||
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
packages: [ ninja-build, g++-7, clang-5.0, lld-5.0, libicu-dev, libreadline-dev, libmysqlclient-dev, unixodbc-dev, libltdl-dev, libssl-dev, libboost-dev, zlib1g-dev, libdouble-conversion-dev, libsparsehash-dev, librdkafka-dev, libcapnp-dev, libsparsehash-dev, libgoogle-perftools-dev, bash, expect, python, python-lxml, python-termcolor, curl, perl, sudo, openssl]
|
||||
|
||||
env:
|
||||
- MATRIX_EVAL="export CC=clang-5.0 CXX=clang++-5.0"
|
||||
|
||||
script:
|
||||
- utils/travis/normal.sh
|
||||
# - os: linux
|
||||
#
|
||||
# cache:
|
||||
# ccache: true
|
||||
# timeout: 1000
|
||||
# directories:
|
||||
# - /home/travis/.ccache
|
||||
#
|
||||
# addons:
|
||||
# apt:
|
||||
# update: true
|
||||
# sources:
|
||||
# - ubuntu-toolchain-r-test
|
||||
# - llvm-toolchain-trusty-5.0
|
||||
# packages: [ ninja-build, g++-7, clang-5.0, lld-5.0, libicu-dev, libreadline-dev, libmysqlclient-dev, unixodbc-dev, libltdl-dev, libssl-dev, libboost-dev, zlib1g-dev, libdouble-conversion-dev, libsparsehash-dev, librdkafka-dev, libcapnp-dev, libsparsehash-dev, libgoogle-perftools-dev, bash, expect, python, python-lxml, python-termcolor, curl, perl, sudo, openssl]
|
||||
#
|
||||
# env:
|
||||
# - MATRIX_EVAL="export CC=clang-5.0 CXX=clang++-5.0"
|
||||
#
|
||||
# script:
|
||||
# - utils/travis/normal.sh
|
||||
|
||||
- os: linux
|
||||
|
||||
|
@ -403,6 +403,10 @@ public:
|
||||
}
|
||||
|
||||
|
||||
#ifndef __clang__
|
||||
#pragma GCC optimize("-fno-var-tracking-assignments")
|
||||
#endif
|
||||
|
||||
int mainEntryClickHouseBenchmark(int argc, char ** argv)
|
||||
{
|
||||
using namespace DB;
|
||||
|
@ -63,6 +63,10 @@
|
||||
#include "Suggest.h"
|
||||
#endif
|
||||
|
||||
#ifndef __clang__
|
||||
#pragma GCC optimize("-fno-var-tracking-assignments")
|
||||
#endif
|
||||
|
||||
|
||||
/// http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
|
||||
|
@ -31,6 +31,11 @@
|
||||
#include <Poco/XML/XMLStream.h>
|
||||
#include <Common/InterruptListener.h>
|
||||
|
||||
#ifndef __clang__
|
||||
#pragma GCC optimize("-fno-var-tracking-assignments")
|
||||
#endif
|
||||
|
||||
|
||||
/** Tests launcher for ClickHouse.
|
||||
* The tool walks through given or default folder in order to find files with
|
||||
* tests' descriptions and launches it.
|
||||
@ -1387,6 +1392,7 @@ static void getFilesFromDir(const fs::path & dir, std::vector<String> & input_fi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int mainEntryClickHousePerformanceTest(int argc, char ** argv)
|
||||
try
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <Common/escapeForFileName.h>
|
||||
#include <Common/getFQDNOrHostName.h>
|
||||
#include <Common/CurrentThread.h>
|
||||
#include <Common/setThreadName.h>
|
||||
#include <IO/ReadBufferFromIStream.h>
|
||||
#include <IO/ZlibInflatingReadBuffer.h>
|
||||
#include <IO/ReadBufferFromString.h>
|
||||
@ -644,6 +645,8 @@ void HTTPHandler::trySendExceptionToClient(const std::string & s, int exception_
|
||||
|
||||
void HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response)
|
||||
{
|
||||
setThreadName("HTTPHandler");
|
||||
|
||||
Output used_output;
|
||||
|
||||
/// In case of exception, send stack trace to client.
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <common/logger_useful.h>
|
||||
|
||||
#include <Common/HTMLForm.h>
|
||||
#include <Common/setThreadName.h>
|
||||
#include <IO/CompressedWriteBuffer.h>
|
||||
#include <IO/ReadBufferFromIStream.h>
|
||||
#include <IO/WriteBufferFromHTTPServerResponse.h>
|
||||
@ -86,6 +87,8 @@ void InterserverIOHTTPHandler::processQuery(Poco::Net::HTTPServerRequest & reque
|
||||
|
||||
void InterserverIOHTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response)
|
||||
{
|
||||
setThreadName("IntersrvHandler");
|
||||
|
||||
/// In order to work keep-alive.
|
||||
if (request.getVersion() == Poco::Net::HTTPServerRequest::HTTP_1_1)
|
||||
response.setChunkedTransferEncoding(true);
|
||||
|
@ -85,7 +85,7 @@ void MetricsTransmitter::transmit(std::vector<ProfileEvents::Count> & prev_count
|
||||
const auto counter_increment = counter - prev_counters[i];
|
||||
prev_counters[i] = counter;
|
||||
|
||||
std::string key{ProfileEvents::getDescription(static_cast<ProfileEvents::Event>(i))};
|
||||
std::string key{ProfileEvents::getName(static_cast<ProfileEvents::Event>(i))};
|
||||
key_vals.emplace_back(profile_events_path_prefix + key, counter_increment);
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ void MetricsTransmitter::transmit(std::vector<ProfileEvents::Count> & prev_count
|
||||
{
|
||||
const auto value = CurrentMetrics::values[i].load(std::memory_order_relaxed);
|
||||
|
||||
std::string key{CurrentMetrics::getDescription(static_cast<CurrentMetrics::Metric>(i))};
|
||||
std::string key{CurrentMetrics::getName(static_cast<CurrentMetrics::Metric>(i))};
|
||||
key_vals.emplace_back(current_metrics_path_prefix + key, value);
|
||||
}
|
||||
}
|
||||
|
@ -369,9 +369,11 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
#if defined(__linux__)
|
||||
if (!TaskStatsInfoGetter::checkPermissions())
|
||||
{
|
||||
LOG_INFO(log, "It looks like the process has no CAP_NET_ADMIN capability, some performance statistics will be disabled."
|
||||
LOG_INFO(log, "It looks like the process has no CAP_NET_ADMIN capability, 'taskstats' performance statistics will be disabled."
|
||||
" It could happen due to incorrect ClickHouse package installation."
|
||||
" You could resolve the problem manually with 'sudo setcap cap_net_admin=+ep /usr/bin/clickhouse'");
|
||||
" You could resolve the problem manually with 'sudo setcap cap_net_admin=+ep /usr/bin/clickhouse'."
|
||||
" Note that it will not work on 'nosuid' mounted filesystems."
|
||||
" It also doesn't work if you run clickhouse-server inside network namespace as it happens in some containers.");
|
||||
}
|
||||
#else
|
||||
LOG_INFO(log, "TaskStats is not implemented for this OS. IO accounting will be disabled.");
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <Common/ClickHouseRevision.h>
|
||||
#include <Common/Stopwatch.h>
|
||||
#include <Common/NetException.h>
|
||||
#include <Common/setThreadName.h>
|
||||
#include <Common/config_version.h>
|
||||
#include <IO/Progress.h>
|
||||
#include <IO/CompressedReadBuffer.h>
|
||||
@ -49,6 +50,8 @@ namespace ErrorCodes
|
||||
|
||||
void TCPHandler::runImpl()
|
||||
{
|
||||
setThreadName("TCPHandler");
|
||||
|
||||
connection_context = server.context();
|
||||
connection_context.setSessionContext(connection_context);
|
||||
|
||||
|
@ -59,10 +59,11 @@ private:
|
||||
size_t old_size = state.dynamic_array_size;
|
||||
if (old_size < new_size)
|
||||
{
|
||||
state.array_of_aggregate_datas = arena.realloc(
|
||||
state.array_of_aggregate_datas = arena.alignedRealloc(
|
||||
state.array_of_aggregate_datas,
|
||||
old_size * nested_size_of_data,
|
||||
new_size * nested_size_of_data);
|
||||
new_size * nested_size_of_data,
|
||||
nested_func->alignOfData());
|
||||
|
||||
size_t i = old_size;
|
||||
char * nested_state = state.array_of_aggregate_datas + i * nested_size_of_data;
|
||||
|
@ -31,20 +31,23 @@ class AggregateFunctionNullBase : public IAggregateFunctionHelper<Derived>
|
||||
{
|
||||
protected:
|
||||
AggregateFunctionPtr nested_function;
|
||||
size_t prefix_size;
|
||||
|
||||
/** In addition to data for nested aggregate function, we keep a flag
|
||||
* indicating - was there at least one non-NULL value accumulated.
|
||||
* In case of no not-NULL values, the function will return NULL.
|
||||
*
|
||||
* We use prefix_size bytes for flag to satisfy the alignment requirement of nested state.
|
||||
*/
|
||||
|
||||
static AggregateDataPtr nestedPlace(AggregateDataPtr place) noexcept
|
||||
AggregateDataPtr nestedPlace(AggregateDataPtr place) const noexcept
|
||||
{
|
||||
return place + (result_is_nullable ? 1 : 0);
|
||||
return place + prefix_size;
|
||||
}
|
||||
|
||||
static ConstAggregateDataPtr nestedPlace(ConstAggregateDataPtr place) noexcept
|
||||
ConstAggregateDataPtr nestedPlace(ConstAggregateDataPtr place) const noexcept
|
||||
{
|
||||
return place + (result_is_nullable ? 1 : 0);
|
||||
return place + prefix_size;
|
||||
}
|
||||
|
||||
static void initFlag(AggregateDataPtr place) noexcept
|
||||
@ -68,6 +71,10 @@ public:
|
||||
AggregateFunctionNullBase(AggregateFunctionPtr nested_function_)
|
||||
: nested_function{nested_function_}
|
||||
{
|
||||
if (result_is_nullable)
|
||||
prefix_size = nested_function->alignOfData();
|
||||
else
|
||||
prefix_size = 0;
|
||||
}
|
||||
|
||||
String getName() const override
|
||||
@ -101,12 +108,12 @@ public:
|
||||
|
||||
size_t sizeOfData() const override
|
||||
{
|
||||
return 1 + nested_function->sizeOfData();
|
||||
return prefix_size + nested_function->sizeOfData();
|
||||
}
|
||||
|
||||
size_t alignOfData() const override
|
||||
{
|
||||
return 1; /// NOTE This works fine on x86_64 and ok on AArch64. Doesn't work under UBSan.
|
||||
return nested_function->alignOfData();
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena * arena) const override
|
||||
|
@ -3,11 +3,14 @@
|
||||
#include <DataStreams/ColumnGathererStream.h>
|
||||
#include <IO/WriteBufferFromArena.h>
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int PARAMETER_OUT_OF_BOUND;
|
||||
@ -283,7 +286,7 @@ void ColumnAggregateFunction::insert(const Field & x)
|
||||
|
||||
Arena & arena = createOrGetArena();
|
||||
|
||||
getData().push_back(arena.alloc(function->sizeOfData()));
|
||||
getData().push_back(arena.alignedAlloc(function->sizeOfData(), function->alignOfData()));
|
||||
function->create(getData().back());
|
||||
ReadBufferFromString read_buffer(x.get<const String &>());
|
||||
function->deserialize(getData().back(), read_buffer, &arena);
|
||||
@ -295,7 +298,7 @@ void ColumnAggregateFunction::insertDefault()
|
||||
|
||||
Arena & arena = createOrGetArena();
|
||||
|
||||
getData().push_back(arena.alloc(function->sizeOfData()));
|
||||
getData().push_back(arena.alignedAlloc(function->sizeOfData(), function->alignOfData()));
|
||||
function->create(getData().back());
|
||||
}
|
||||
|
||||
@ -316,7 +319,7 @@ const char * ColumnAggregateFunction::deserializeAndInsertFromArena(const char *
|
||||
*/
|
||||
Arena & dst_arena = createOrGetArena();
|
||||
|
||||
getData().push_back(dst_arena.alloc(function->sizeOfData()));
|
||||
getData().push_back(dst_arena.alignedAlloc(function->sizeOfData(), function->alignOfData()));
|
||||
function->create(getData().back());
|
||||
|
||||
/** We will read from src_arena.
|
||||
@ -410,7 +413,7 @@ void ColumnAggregateFunction::getExtremes(Field & min, Field & max) const
|
||||
{
|
||||
/// Place serialized default values into min/max.
|
||||
|
||||
PODArrayWithStackMemory<char, 16> place_buffer(func->sizeOfData());
|
||||
AlignedBuffer place_buffer(func->sizeOfData(), func->alignOfData());
|
||||
AggregateDataPtr place = place_buffer.data();
|
||||
|
||||
String serialized;
|
||||
|
49
dbms/src/Common/AlignedBuffer.cpp
Normal file
49
dbms/src/Common/AlignedBuffer.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include <Common/AlignedBuffer.h>
|
||||
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/formatReadable.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int CANNOT_ALLOCATE_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
void AlignedBuffer::alloc(size_t size, size_t alignment)
|
||||
{
|
||||
void * new_buf;
|
||||
int res = ::posix_memalign(&new_buf, std::max(alignment, sizeof(void*)), size);
|
||||
if (0 != res)
|
||||
throwFromErrno("Cannot allocate memory (posix_memalign), size: "
|
||||
+ formatReadableSizeWithBinarySuffix(size) + ", alignment: " + formatReadableSizeWithBinarySuffix(alignment) + ".",
|
||||
ErrorCodes::CANNOT_ALLOCATE_MEMORY, res);
|
||||
buf = new_buf;
|
||||
}
|
||||
|
||||
void AlignedBuffer::dealloc()
|
||||
{
|
||||
if (buf)
|
||||
::free(buf);
|
||||
}
|
||||
|
||||
void AlignedBuffer::reset(size_t size, size_t alignment)
|
||||
{
|
||||
dealloc();
|
||||
alloc(size, alignment);
|
||||
}
|
||||
|
||||
AlignedBuffer::AlignedBuffer(size_t size, size_t alignment)
|
||||
{
|
||||
alloc(size, alignment);
|
||||
}
|
||||
|
||||
AlignedBuffer::~AlignedBuffer()
|
||||
{
|
||||
dealloc();
|
||||
}
|
||||
|
||||
}
|
36
dbms/src/Common/AlignedBuffer.h
Normal file
36
dbms/src/Common/AlignedBuffer.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/** Aligned piece of memory.
|
||||
* It can only be allocated and destroyed.
|
||||
* MemoryTracker is not used. It is intended for small pieces of memory.
|
||||
*/
|
||||
class AlignedBuffer : private boost::noncopyable
|
||||
{
|
||||
private:
|
||||
void * buf = nullptr;
|
||||
|
||||
void alloc(size_t size, size_t alignment);
|
||||
void dealloc();
|
||||
|
||||
public:
|
||||
AlignedBuffer() {}
|
||||
AlignedBuffer(size_t size, size_t alignment);
|
||||
AlignedBuffer(AlignedBuffer && old) { std::swap(buf, old.buf); }
|
||||
~AlignedBuffer();
|
||||
|
||||
void reset(size_t size, size_t alignment);
|
||||
|
||||
char * data() { return static_cast<char *>(buf); }
|
||||
const char * data() const { return static_cast<const char *>(buf); }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -124,6 +124,26 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Get peice of memory with alignment
|
||||
char * alignedAlloc(size_t size, size_t alignment)
|
||||
{
|
||||
do
|
||||
{
|
||||
void * head_pos = head->pos;
|
||||
size_t space = head->end - head->pos;
|
||||
|
||||
auto res = static_cast<char *>(std::align(alignment, size, head_pos, space));
|
||||
if (res)
|
||||
{
|
||||
head->pos = static_cast<char *>(head_pos);
|
||||
head->pos += size;
|
||||
return res;
|
||||
}
|
||||
|
||||
addChunk(size + alignment);
|
||||
} while (true);
|
||||
}
|
||||
|
||||
/** Rollback just performed allocation.
|
||||
* Must pass size not more that was just allocated.
|
||||
*/
|
||||
@ -132,7 +152,7 @@ public:
|
||||
head->pos -= size;
|
||||
}
|
||||
|
||||
/** Begin or expand allocation of contiguous piece of memory.
|
||||
/** Begin or expand allocation of contiguous piece of memory without alignment.
|
||||
* 'begin' - current begin of piece of memory, if it need to be expanded, or nullptr, if it need to be started.
|
||||
* If there is no space in chunk to expand current piece of memory - then copy all piece to new chunk and change value of 'begin'.
|
||||
* NOTE This method is usable only for latest allocation. For earlier allocations, see 'realloc' method.
|
||||
@ -168,6 +188,14 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
char * alignedRealloc(const char * old_data, size_t old_size, size_t new_size, size_t alignment)
|
||||
{
|
||||
char * res = alignedAlloc(new_size, alignment);
|
||||
if (old_data)
|
||||
memcpy(res, old_data, old_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// Insert string without alignment.
|
||||
const char * insert(const char * data, size_t size)
|
||||
{
|
||||
|
@ -1,13 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <common/likely.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/formatReadable.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int CANNOT_ALLOCATE_MEMORY;
|
||||
}
|
||||
|
||||
/** An array of (almost) unchangable size:
|
||||
* the size is specified in the constructor;
|
||||
* `resize` method removes old data, and necessary only for
|
||||
@ -20,6 +27,7 @@ namespace DB
|
||||
* `sizeof` is equal to the size of one pointer.
|
||||
*
|
||||
* Not exception-safe.
|
||||
*
|
||||
* Copying is supported via assign() method. Moving empties the original object.
|
||||
* That is, it is inconvenient to use this array in many cases.
|
||||
*
|
||||
@ -207,6 +215,11 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr size_t alignment = alignof(T);
|
||||
/// Bytes allocated to store size of array before data. It is padded to have minimum size as alignment.
|
||||
/// Padding is at left and the size is stored at right (just before the first data element).
|
||||
static constexpr size_t prefix_size = std::max(sizeof(size_t), alignment);
|
||||
|
||||
char * data;
|
||||
|
||||
size_t & m_size()
|
||||
@ -234,20 +247,27 @@ private:
|
||||
data = const_cast<char *>(reinterpret_cast<const char *>(&empty_auto_array_helper)) + sizeof(size_t);
|
||||
}
|
||||
|
||||
void init(size_t size_, bool dont_init_elems)
|
||||
void init(size_t new_size, bool dont_init_elems)
|
||||
{
|
||||
if (!size_)
|
||||
if (!new_size)
|
||||
{
|
||||
setEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
data = new char[size_ * sizeof(T) + sizeof(size_t)];
|
||||
data += sizeof(size_t);
|
||||
m_size() = size_;
|
||||
void * new_data = nullptr;
|
||||
int res = posix_memalign(&new_data, alignment, prefix_size + new_size * sizeof(T));
|
||||
if (0 != res)
|
||||
throwFromErrno("Cannot allocate memory (posix_memalign) " + formatReadableSizeWithBinarySuffix(new_size) + ".",
|
||||
ErrorCodes::CANNOT_ALLOCATE_MEMORY, res);
|
||||
|
||||
data = static_cast<char *>(new_data);
|
||||
data += prefix_size;
|
||||
|
||||
m_size() = new_size;
|
||||
|
||||
if (!dont_init_elems)
|
||||
for (size_t i = 0; i < size_; ++i)
|
||||
for (size_t i = 0; i < new_size; ++i)
|
||||
new (place(i)) T();
|
||||
}
|
||||
|
||||
@ -255,13 +275,13 @@ private:
|
||||
{
|
||||
size_t s = size();
|
||||
|
||||
if (likely(s))
|
||||
if (s)
|
||||
{
|
||||
for (size_t i = 0; i < s; ++i)
|
||||
elem(i).~T();
|
||||
|
||||
data -= sizeof(size_t);
|
||||
delete[] data;
|
||||
data -= prefix_size;
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -3,68 +3,80 @@
|
||||
|
||||
/// Available metrics. Add something here as you wish.
|
||||
#define APPLY_FOR_METRICS(M) \
|
||||
M(Query) \
|
||||
M(Merge) \
|
||||
M(PartMutation) \
|
||||
M(ReplicatedFetch) \
|
||||
M(ReplicatedSend) \
|
||||
M(ReplicatedChecks) \
|
||||
M(BackgroundPoolTask) \
|
||||
M(BackgroundSchedulePoolTask) \
|
||||
M(DiskSpaceReservedForMerge) \
|
||||
M(DistributedSend) \
|
||||
M(QueryPreempted) \
|
||||
M(TCPConnection) \
|
||||
M(HTTPConnection) \
|
||||
M(InterserverConnection) \
|
||||
M(OpenFileForRead) \
|
||||
M(OpenFileForWrite) \
|
||||
M(Read) \
|
||||
M(Write) \
|
||||
M(SendExternalTables) \
|
||||
M(QueryThread) \
|
||||
M(ReadonlyReplica) \
|
||||
M(LeaderReplica) \
|
||||
M(MemoryTracking) \
|
||||
M(MemoryTrackingInBackgroundProcessingPool) \
|
||||
M(MemoryTrackingInBackgroundSchedulePool) \
|
||||
M(MemoryTrackingForMerges) \
|
||||
M(LeaderElection) \
|
||||
M(EphemeralNode) \
|
||||
M(ZooKeeperSession) \
|
||||
M(ZooKeeperWatch) \
|
||||
M(ZooKeeperRequest) \
|
||||
M(DelayedInserts) \
|
||||
M(ContextLockWait) \
|
||||
M(StorageBufferRows) \
|
||||
M(StorageBufferBytes) \
|
||||
M(DictCacheRequests) \
|
||||
M(Revision) \
|
||||
M(RWLockWaitingReaders) \
|
||||
M(RWLockWaitingWriters) \
|
||||
M(RWLockActiveReaders) \
|
||||
M(RWLockActiveWriters)
|
||||
M(Query, "Number of executing queries") \
|
||||
M(Merge, "Number of executing background merges") \
|
||||
M(PartMutation, "Number of mutations (ALTER DELETE/UPDATE)") \
|
||||
M(ReplicatedFetch, "Number of data parts fetching from replica") \
|
||||
M(ReplicatedSend, "Number of data parts sending to replicas") \
|
||||
M(ReplicatedChecks, "Number of data parts checking for consistency") \
|
||||
M(BackgroundPoolTask, "Number of active tasks in BackgroundProcessingPool (merges, mutations, fetches or replication queue bookkeeping)") \
|
||||
M(BackgroundSchedulePoolTask, "Number of active tasks in BackgroundSchedulePool. This pool is used for periodic tasks of ReplicatedMergeTree like cleaning old data parts, altering data parts, replica re-initialization, etc.") \
|
||||
M(DiskSpaceReservedForMerge, "Disk space reserved for currently running background merges. It is slightly more than total size of currently merging parts.") \
|
||||
M(DistributedSend, "Number of connections sending data, that was INSERTed to Distributed tables, to remote servers. Both synchronous and asynchronous mode.") \
|
||||
M(QueryPreempted, "Number of queries that are stopped and waiting due to 'priority' setting.") \
|
||||
M(TCPConnection, "Number of connections to TCP server (clients with native interface)") \
|
||||
M(HTTPConnection, "Number of connections to HTTP server") \
|
||||
M(InterserverConnection, "Number of connections from other replicas to fetch parts") \
|
||||
M(OpenFileForRead, "Number of files open for reading") \
|
||||
M(OpenFileForWrite, "Number of files open for writing") \
|
||||
M(Read, "Number of read (read, pread, io_getevents, etc.) syscalls in fly") \
|
||||
M(Write, "Number of write (write, pwrite, io_getevents, etc.) syscalls in fly") \
|
||||
M(SendExternalTables, "Number of connections that are sending data for external tables to remote servers. External tables are used to implement GLOBAL IN and GLOBAL JOIN operators with distributed subqueries.") \
|
||||
M(QueryThread, "Number of query processing threads") \
|
||||
M(ReadonlyReplica, "Number of Replicated tables that are currently in readonly state due to re-initialization after ZooKeeper session loss or due to startup without ZooKeeper configured.") \
|
||||
M(LeaderReplica, "Number of Replicated tables that are leaders. Leader replica is responsible for assigning merges, cleaning old blocks for deduplications and a few more bookkeeping tasks. There may be no more than one leader across all replicas at one moment of time. If there is no leader it will be elected soon or it indicate an issue.") \
|
||||
M(MemoryTracking, "Total amount of memory (bytes) allocated in currently executing queries. Note that some memory allocations may not be accounted.") \
|
||||
M(MemoryTrackingInBackgroundProcessingPool, "Total amount of memory (bytes) allocated in background processing pool (that is dedicated for backround merges, mutations and fetches). Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa. This happens naturally due to caches for tables indexes and doesn't indicate memory leaks.") \
|
||||
M(MemoryTrackingInBackgroundSchedulePool, "Total amount of memory (bytes) allocated in background schedule pool (that is dedicated for bookkeeping tasks of Replicated tables).") \
|
||||
M(MemoryTrackingForMerges, "Total amount of memory (bytes) allocated for background merges. Included in MemoryTrackingInBackgroundProcessingPool. Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa. This happens naturally due to caches for tables indexes and doesn't indicate memory leaks.") \
|
||||
M(LeaderElection, "Number of Replicas participating in leader election. Equals to total number of replicas in usual cases.") \
|
||||
M(EphemeralNode, "Number of ephemeral nodes hold in ZooKeeper.") \
|
||||
M(ZooKeeperSession, "Number of sessions (connections) to ZooKeeper. Should be no more than one, because using more than one connection to ZooKeeper may lead to bugs due to lack of linearizability (stale reads) that ZooKeeper consistency model allows.") \
|
||||
M(ZooKeeperWatch, "Number of watches (event subscriptions) in ZooKeeper.") \
|
||||
M(ZooKeeperRequest, "Number of requests to ZooKeeper in fly.") \
|
||||
M(DelayedInserts, "Number of INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree table.") \
|
||||
M(ContextLockWait, "Number of threads waiting for lock in Context. This is global lock.") \
|
||||
M(StorageBufferRows, "Number of rows in buffers of Buffer tables") \
|
||||
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(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.") \
|
||||
M(RWLockActiveWriters, "Number of threads holding write lock in a table RWLock.") \
|
||||
|
||||
|
||||
namespace CurrentMetrics
|
||||
{
|
||||
#define M(NAME) extern const Metric NAME = __COUNTER__;
|
||||
#define M(NAME, DOCUMENTATION) extern const Metric NAME = __COUNTER__;
|
||||
APPLY_FOR_METRICS(M)
|
||||
#undef M
|
||||
constexpr Metric END = __COUNTER__;
|
||||
|
||||
std::atomic<Value> values[END] {}; /// Global variable, initialized by zeros.
|
||||
|
||||
const char * getDescription(Metric event)
|
||||
const char * getName(Metric event)
|
||||
{
|
||||
static const char * descriptions[] =
|
||||
static const char * strings[] =
|
||||
{
|
||||
#define M(NAME) #NAME,
|
||||
#define M(NAME, DOCUMENTATION) #NAME,
|
||||
APPLY_FOR_METRICS(M)
|
||||
#undef M
|
||||
};
|
||||
|
||||
return descriptions[event];
|
||||
return strings[event];
|
||||
}
|
||||
|
||||
const char * getDocumentation(Metric event)
|
||||
{
|
||||
static const char * strings[] =
|
||||
{
|
||||
#define M(NAME, DOCUMENTATION) DOCUMENTATION,
|
||||
APPLY_FOR_METRICS(M)
|
||||
#undef M
|
||||
};
|
||||
|
||||
return strings[event];
|
||||
}
|
||||
|
||||
Metric end() { return END; }
|
||||
|
@ -24,8 +24,10 @@ namespace CurrentMetrics
|
||||
using Metric = size_t;
|
||||
using Value = DB::Int64;
|
||||
|
||||
/// Get name of metric by identifier. Returns statically allocated string.
|
||||
const char * getName(Metric event);
|
||||
/// Get text description of metric by identifier. Returns statically allocated string.
|
||||
const char * getDescription(Metric event);
|
||||
const char * getDocumentation(Metric event);
|
||||
|
||||
/// Metric identifier -> current value of metric.
|
||||
extern std::atomic<Value> values[];
|
||||
|
@ -5,176 +5,174 @@
|
||||
|
||||
/// Available events. Add something here as you wish.
|
||||
#define APPLY_FOR_EVENTS(M) \
|
||||
M(Query) \
|
||||
M(SelectQuery) \
|
||||
M(InsertQuery) \
|
||||
M(FileOpen) \
|
||||
M(FileOpenFailed) \
|
||||
M(Seek) \
|
||||
M(ReadBufferFromFileDescriptorRead) \
|
||||
M(ReadBufferFromFileDescriptorReadFailed) \
|
||||
M(ReadBufferFromFileDescriptorReadBytes) \
|
||||
M(WriteBufferFromFileDescriptorWrite) \
|
||||
M(WriteBufferFromFileDescriptorWriteFailed) \
|
||||
M(WriteBufferFromFileDescriptorWriteBytes) \
|
||||
M(ReadBufferAIORead) \
|
||||
M(ReadBufferAIOReadBytes) \
|
||||
M(WriteBufferAIOWrite) \
|
||||
M(WriteBufferAIOWriteBytes) \
|
||||
M(ReadCompressedBytes) \
|
||||
M(CompressedReadBufferBlocks) \
|
||||
M(CompressedReadBufferBytes) \
|
||||
M(UncompressedCacheHits) \
|
||||
M(UncompressedCacheMisses) \
|
||||
M(UncompressedCacheWeightLost) \
|
||||
M(IOBufferAllocs) \
|
||||
M(IOBufferAllocBytes) \
|
||||
M(ArenaAllocChunks) \
|
||||
M(ArenaAllocBytes) \
|
||||
M(FunctionExecute) \
|
||||
M(TableFunctionExecute) \
|
||||
M(MarkCacheHits) \
|
||||
M(MarkCacheMisses) \
|
||||
M(CreatedReadBufferOrdinary) \
|
||||
M(CreatedReadBufferAIO) \
|
||||
M(CreatedWriteBufferOrdinary) \
|
||||
M(CreatedWriteBufferAIO) \
|
||||
M(DiskReadElapsedMicroseconds) \
|
||||
M(DiskWriteElapsedMicroseconds) \
|
||||
M(NetworkReceiveElapsedMicroseconds) \
|
||||
M(NetworkSendElapsedMicroseconds) \
|
||||
M(ThrottlerSleepMicroseconds) \
|
||||
M(Query, "Number of queries started to be interpreted and maybe executed. Does not include queries that are failed to parse, that are rejected due to AST size limits; rejected due to quota limits or limits on number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.") \
|
||||
M(SelectQuery, "Same as Query, but only for SELECT queries.") \
|
||||
M(InsertQuery, "Same as Query, but only for INSERT queries.") \
|
||||
M(FileOpen, "Number of files opened.") \
|
||||
M(Seek, "Number of times the 'lseek' function was called.") \
|
||||
M(ReadBufferFromFileDescriptorRead, "Number of reads (read/pread) from a file descriptor. Does not include sockets.") \
|
||||
M(ReadBufferFromFileDescriptorReadFailed, "Number of times the read (read/pread) from a file descriptor have failed.") \
|
||||
M(ReadBufferFromFileDescriptorReadBytes, "Number of bytes read from file descriptors. If the file is compressed, this will show compressed data size.") \
|
||||
M(WriteBufferFromFileDescriptorWrite, "Number of writes (write/pwrite) to a file descriptor. Does not include sockets.") \
|
||||
M(WriteBufferFromFileDescriptorWriteFailed, "Number of times the write (write/pwrite) to a file descriptor have failed.") \
|
||||
M(WriteBufferFromFileDescriptorWriteBytes, "Number of bytes written to file descriptors. If the file is compressed, this will show compressed data size.") \
|
||||
M(ReadBufferAIORead, "") \
|
||||
M(ReadBufferAIOReadBytes, "") \
|
||||
M(WriteBufferAIOWrite, "") \
|
||||
M(WriteBufferAIOWriteBytes, "") \
|
||||
M(ReadCompressedBytes, "") \
|
||||
M(CompressedReadBufferBlocks, "") \
|
||||
M(CompressedReadBufferBytes, "") \
|
||||
M(UncompressedCacheHits, "") \
|
||||
M(UncompressedCacheMisses, "") \
|
||||
M(UncompressedCacheWeightLost, "") \
|
||||
M(IOBufferAllocs, "") \
|
||||
M(IOBufferAllocBytes, "") \
|
||||
M(ArenaAllocChunks, "") \
|
||||
M(ArenaAllocBytes, "") \
|
||||
M(FunctionExecute, "") \
|
||||
M(TableFunctionExecute, "") \
|
||||
M(MarkCacheHits, "") \
|
||||
M(MarkCacheMisses, "") \
|
||||
M(CreatedReadBufferOrdinary, "") \
|
||||
M(CreatedReadBufferAIO, "") \
|
||||
M(CreatedWriteBufferOrdinary, "") \
|
||||
M(CreatedWriteBufferAIO, "") \
|
||||
M(DiskReadElapsedMicroseconds, "Total time spent waiting for read syscall. This include reads from page cache.") \
|
||||
M(DiskWriteElapsedMicroseconds, "Total time spent waiting for write syscall. This include writes to page cache.") \
|
||||
M(NetworkReceiveElapsedMicroseconds, "") \
|
||||
M(NetworkSendElapsedMicroseconds, "") \
|
||||
M(ThrottlerSleepMicroseconds, "Total time a query was sleeping to conform the 'max_network_bandwidth' setting.") \
|
||||
\
|
||||
M(ReplicatedPartFetches) \
|
||||
M(ReplicatedPartFailedFetches) \
|
||||
M(ObsoleteReplicatedParts) \
|
||||
M(ReplicatedPartMerges) \
|
||||
M(ReplicatedPartFetchesOfMerged) \
|
||||
M(ReplicatedPartMutations) \
|
||||
M(ReplicatedPartChecks) \
|
||||
M(ReplicatedPartChecksFailed) \
|
||||
M(ReplicatedDataLoss) \
|
||||
M(ReplicatedPartFetches, "Number of times a data part was downloaded from replica of a ReplicatedMergeTree table.") \
|
||||
M(ReplicatedPartFailedFetches, "") \
|
||||
M(ObsoleteReplicatedParts, "") \
|
||||
M(ReplicatedPartMerges, "") \
|
||||
M(ReplicatedPartFetchesOfMerged, "Number of times we prefer to download already merged part from replica of ReplicatedMergeTree table instead of performing a merge ourself (usually we prefer doing a merge ourself to save network traffic). This happens when we have not all source parts to perform a merge or when the data part is old enough.") \
|
||||
M(ReplicatedPartMutations, "") \
|
||||
M(ReplicatedPartChecks, "") \
|
||||
M(ReplicatedPartChecksFailed, "") \
|
||||
M(ReplicatedDataLoss, "Number of times a data part that we wanted doesn't exist on any replica (even on replicas that are offline right now). That data parts are definitely lost. This is normal due to asynchronous replication (if quorum inserts were not enabled), when the replica on which the data part was written was failed and when it became online after fail it doesn't contain that data part.") \
|
||||
\
|
||||
M(InsertedRows) \
|
||||
M(InsertedBytes) \
|
||||
M(DelayedInserts) \
|
||||
M(RejectedInserts) \
|
||||
M(DelayedInsertsMilliseconds) \
|
||||
M(DuplicatedInsertedBlocks) \
|
||||
M(InsertedRows, "Number of rows INSERTed to all tables.") \
|
||||
M(InsertedBytes, "Number of bytes (uncompressed; for columns as they stored in memory) INSERTed to all tables.") \
|
||||
M(DelayedInserts, "Number of times the INSERT of a block to a MergeTree table was throttled due to high number of active data parts for partition.") \
|
||||
M(RejectedInserts, "Number of times the INSERT of a block to a MergeTree table was rejected with 'Too many parts' exception due to high number of active data parts for partition.") \
|
||||
M(DelayedInsertsMilliseconds, "Total number of milliseconds spent while the INSERT of a block to a MergeTree table was throttled due to high number of active data parts for partition.") \
|
||||
M(DuplicatedInsertedBlocks, "Number of times the INSERTed block to a ReplicatedMergeTree table was deduplicated.") \
|
||||
\
|
||||
M(ZooKeeperInit) \
|
||||
M(ZooKeeperTransactions) \
|
||||
M(ZooKeeperList) \
|
||||
M(ZooKeeperCreate) \
|
||||
M(ZooKeeperRemove) \
|
||||
M(ZooKeeperExists) \
|
||||
M(ZooKeeperGet) \
|
||||
M(ZooKeeperSet) \
|
||||
M(ZooKeeperMulti) \
|
||||
M(ZooKeeperCheck) \
|
||||
M(ZooKeeperClose) \
|
||||
M(ZooKeeperWatchResponse) \
|
||||
M(ZooKeeperUserExceptions) \
|
||||
M(ZooKeeperHardwareExceptions) \
|
||||
M(ZooKeeperOtherExceptions) \
|
||||
M(ZooKeeperWaitMicroseconds) \
|
||||
M(ZooKeeperBytesSent) \
|
||||
M(ZooKeeperBytesReceived) \
|
||||
M(ZooKeeperInit, "") \
|
||||
M(ZooKeeperTransactions, "") \
|
||||
M(ZooKeeperList, "") \
|
||||
M(ZooKeeperCreate, "") \
|
||||
M(ZooKeeperRemove, "") \
|
||||
M(ZooKeeperExists, "") \
|
||||
M(ZooKeeperGet, "") \
|
||||
M(ZooKeeperSet, "") \
|
||||
M(ZooKeeperMulti, "") \
|
||||
M(ZooKeeperCheck, "") \
|
||||
M(ZooKeeperClose, "") \
|
||||
M(ZooKeeperWatchResponse, "") \
|
||||
M(ZooKeeperUserExceptions, "") \
|
||||
M(ZooKeeperHardwareExceptions, "") \
|
||||
M(ZooKeeperOtherExceptions, "") \
|
||||
M(ZooKeeperWaitMicroseconds, "") \
|
||||
M(ZooKeeperBytesSent, "") \
|
||||
M(ZooKeeperBytesReceived, "") \
|
||||
\
|
||||
M(DistributedConnectionFailTry) \
|
||||
M(DistributedConnectionMissingTable) \
|
||||
M(DistributedConnectionStaleReplica) \
|
||||
M(DistributedConnectionFailAtAll) \
|
||||
M(DistributedConnectionFailTry, "") \
|
||||
M(DistributedConnectionMissingTable, "") \
|
||||
M(DistributedConnectionStaleReplica, "") \
|
||||
M(DistributedConnectionFailAtAll, "") \
|
||||
\
|
||||
M(CompileAttempt) \
|
||||
M(CompileSuccess) \
|
||||
M(CompileAttempt, "Number of times a compilation of generated C++ code was initiated.") \
|
||||
M(CompileSuccess, "Number of times a compilation of generated C++ code was successful.") \
|
||||
\
|
||||
M(CompileFunction) \
|
||||
M(CompileFunction, "Number of times a compilation of generated LLVM code (to create fused function for complex expressions) was initiated.") \
|
||||
\
|
||||
M(ExternalSortWritePart) \
|
||||
M(ExternalSortMerge) \
|
||||
M(ExternalAggregationWritePart) \
|
||||
M(ExternalAggregationMerge) \
|
||||
M(ExternalAggregationCompressedBytes) \
|
||||
M(ExternalAggregationUncompressedBytes) \
|
||||
M(ExternalSortWritePart, "") \
|
||||
M(ExternalSortMerge, "") \
|
||||
M(ExternalAggregationWritePart, "") \
|
||||
M(ExternalAggregationMerge, "") \
|
||||
M(ExternalAggregationCompressedBytes, "") \
|
||||
M(ExternalAggregationUncompressedBytes, "") \
|
||||
\
|
||||
M(SlowRead) \
|
||||
M(ReadBackoff) \
|
||||
M(SlowRead, "Number of reads from a file that were slow. This indicate system overload. Thresholds are controlled by read_backoff_* settings.") \
|
||||
M(ReadBackoff, "Number of times the number of query processing threads was lowered due to slow reads.") \
|
||||
\
|
||||
M(ReplicaYieldLeadership) \
|
||||
M(ReplicaPartialShutdown) \
|
||||
M(ReplicaYieldLeadership, "Number of times Replicated table was yielded its leadership due to large replication lag relative to other replicas.") \
|
||||
M(ReplicaPartialShutdown, "") \
|
||||
\
|
||||
M(SelectedParts) \
|
||||
M(SelectedRanges) \
|
||||
M(SelectedMarks) \
|
||||
M(SelectedParts, "Number of data parts selected to read from a MergeTree table.") \
|
||||
M(SelectedRanges, "Number of (non-adjacent) ranges in all data parts selected to read from a MergeTree table.") \
|
||||
M(SelectedMarks, "Number of marks (index granules) selected to read from a MergeTree table.") \
|
||||
\
|
||||
M(MergedRows) \
|
||||
M(MergedUncompressedBytes) \
|
||||
M(MergesTimeMilliseconds)\
|
||||
M(MergedRows, "Rows read for background merges. This is the number of rows before merge.") \
|
||||
M(MergedUncompressedBytes, "Uncompressed bytes (for columns as they stored in memory) that was read for background merges. This is the number before merge.") \
|
||||
M(MergesTimeMilliseconds, "Total time spent for background merges.")\
|
||||
\
|
||||
M(MergeTreeDataWriterRows) \
|
||||
M(MergeTreeDataWriterUncompressedBytes) \
|
||||
M(MergeTreeDataWriterCompressedBytes) \
|
||||
M(MergeTreeDataWriterBlocks) \
|
||||
M(MergeTreeDataWriterBlocksAlreadySorted) \
|
||||
M(MergeTreeDataWriterRows, "Number of rows INSERTed to MergeTree tables.") \
|
||||
M(MergeTreeDataWriterUncompressedBytes, "Uncompressed bytes (for columns as they stored in memory) INSERTed to MergeTree tables.") \
|
||||
M(MergeTreeDataWriterCompressedBytes, "Bytes written to filesystem for data INSERTed to MergeTree tables.") \
|
||||
M(MergeTreeDataWriterBlocks, "Number of blocks INSERTed to MergeTree tables. Each block forms a data part of level zero.") \
|
||||
M(MergeTreeDataWriterBlocksAlreadySorted, "Number of blocks INSERTed to MergeTree tables that appeared to be already sorted.") \
|
||||
\
|
||||
M(ObsoleteEphemeralNode) \
|
||||
M(CannotRemoveEphemeralNode) \
|
||||
M(LeaderElectionAcquiredLeadership) \
|
||||
M(CannotRemoveEphemeralNode, "Number of times an error happened while trying to remove ephemeral node. This is not an issue, because our implementation of ZooKeeper library guarantee that the session will expire and the node will be removed.") \
|
||||
M(LeaderElectionAcquiredLeadership, "Number of times a ReplicatedMergeTree table became a leader. Leader replica is responsible for assigning merges, cleaning old blocks for deduplications and a few more bookkeeping tasks.") \
|
||||
\
|
||||
M(RegexpCreated) \
|
||||
M(ContextLock) \
|
||||
M(RegexpCreated, "Compiled regular expressions. Identical regular expressions compiled just once and cached forever.") \
|
||||
M(ContextLock, "Number of times the lock of Context was acquired or tried to acquire. This is global lock.") \
|
||||
\
|
||||
M(StorageBufferFlush) \
|
||||
M(StorageBufferErrorOnFlush) \
|
||||
M(StorageBufferPassedAllMinThresholds) \
|
||||
M(StorageBufferPassedTimeMaxThreshold) \
|
||||
M(StorageBufferPassedRowsMaxThreshold) \
|
||||
M(StorageBufferPassedBytesMaxThreshold) \
|
||||
M(StorageBufferFlush, "") \
|
||||
M(StorageBufferErrorOnFlush, "") \
|
||||
M(StorageBufferPassedAllMinThresholds, "") \
|
||||
M(StorageBufferPassedTimeMaxThreshold, "") \
|
||||
M(StorageBufferPassedRowsMaxThreshold, "") \
|
||||
M(StorageBufferPassedBytesMaxThreshold, "") \
|
||||
\
|
||||
M(DictCacheKeysRequested) \
|
||||
M(DictCacheKeysRequestedMiss) \
|
||||
M(DictCacheKeysRequestedFound) \
|
||||
M(DictCacheKeysExpired) \
|
||||
M(DictCacheKeysNotFound) \
|
||||
M(DictCacheKeysHit) \
|
||||
M(DictCacheRequestTimeNs) \
|
||||
M(DictCacheRequests) \
|
||||
M(DictCacheLockWriteNs) \
|
||||
M(DictCacheLockReadNs) \
|
||||
M(DictCacheKeysRequested, "") \
|
||||
M(DictCacheKeysRequestedMiss, "") \
|
||||
M(DictCacheKeysRequestedFound, "") \
|
||||
M(DictCacheKeysExpired, "") \
|
||||
M(DictCacheKeysNotFound, "") \
|
||||
M(DictCacheKeysHit, "") \
|
||||
M(DictCacheRequestTimeNs, "") \
|
||||
M(DictCacheRequests, "") \
|
||||
M(DictCacheLockWriteNs, "") \
|
||||
M(DictCacheLockReadNs, "") \
|
||||
\
|
||||
M(DistributedSyncInsertionTimeoutExceeded) \
|
||||
M(DataAfterMergeDiffersFromReplica) \
|
||||
M(DataAfterMutationDiffersFromReplica) \
|
||||
M(PolygonsAddedToPool) \
|
||||
M(PolygonsInPoolAllocatedBytes) \
|
||||
M(RWLockAcquiredReadLocks) \
|
||||
M(RWLockAcquiredWriteLocks) \
|
||||
M(RWLockReadersWaitMilliseconds) \
|
||||
M(RWLockWritersWaitMilliseconds) \
|
||||
M(NetworkErrors) \
|
||||
M(DistributedSyncInsertionTimeoutExceeded, "") \
|
||||
M(DataAfterMergeDiffersFromReplica, "") \
|
||||
M(DataAfterMutationDiffersFromReplica, "") \
|
||||
M(PolygonsAddedToPool, "") \
|
||||
M(PolygonsInPoolAllocatedBytes, "") \
|
||||
M(RWLockAcquiredReadLocks, "") \
|
||||
M(RWLockAcquiredWriteLocks, "") \
|
||||
M(RWLockReadersWaitMilliseconds, "") \
|
||||
M(RWLockWritersWaitMilliseconds, "") \
|
||||
M(NetworkErrors, "") \
|
||||
\
|
||||
M(RealTimeMicroseconds) \
|
||||
M(UserTimeMicroseconds) \
|
||||
M(SystemTimeMicroseconds) \
|
||||
M(SoftPageFaults) \
|
||||
M(HardPageFaults) \
|
||||
M(VoluntaryContextSwitches) \
|
||||
M(InvoluntaryContextSwitches) \
|
||||
M(RealTimeMicroseconds, "Total (wall clock) time spent in processing (queries and other tasks) threads (not that this is a sum).") \
|
||||
M(UserTimeMicroseconds, "Total time spent in processing (queries and other tasks) threads executing CPU instructions in user space. This include time CPU pipeline was stalled due to cache misses, branch mispredictions, hyper-threading, etc.") \
|
||||
M(SystemTimeMicroseconds, "Total time spent in processing (queries and other tasks) threads executing CPU instructions in OS kernel space. This include time CPU pipeline was stalled due to cache misses, branch mispredictions, hyper-threading, etc.") \
|
||||
M(SoftPageFaults, "") \
|
||||
M(HardPageFaults, "") \
|
||||
M(VoluntaryContextSwitches, "") \
|
||||
M(InvoluntaryContextSwitches, "") \
|
||||
\
|
||||
M(OSIOWaitMicroseconds) \
|
||||
M(OSCPUWaitMicroseconds) \
|
||||
M(OSCPUVirtualTimeMicroseconds) \
|
||||
M(OSReadBytes) \
|
||||
M(OSWriteBytes) \
|
||||
M(OSReadChars) \
|
||||
M(OSWriteChars) \
|
||||
M(OSIOWaitMicroseconds, "Total time a thread spent waiting for a result of IO operation, from the OS point of view. This is real IO that doesn't include page cache.") \
|
||||
M(OSCPUWaitMicroseconds, "Total time a thread was ready for execution but waiting to be scheduled by OS, from the OS point of view.") \
|
||||
M(OSCPUVirtualTimeMicroseconds, "CPU time spent seen by OS. Does not include involuntary waits due to virtualization.") \
|
||||
M(OSReadBytes, "Number of bytes read from disks or block devices. Doesn't include bytes read from page cache. May include excessive data due to block size, readahead, etc.") \
|
||||
M(OSWriteBytes, "Number of bytes written to disks or block devices. Doesn't include bytes that are in page cache dirty pages. May not include data that was written by OS asynchronously.") \
|
||||
M(OSReadChars, "Number of bytes read from filesystem, including page cache.") \
|
||||
M(OSWriteChars, "Number of bytes written to filesystem, including page cache.") \
|
||||
|
||||
|
||||
namespace ProfileEvents
|
||||
{
|
||||
|
||||
#define M(NAME) extern const Event NAME = __COUNTER__;
|
||||
#define M(NAME, DOCUMENTATION) extern const Event NAME = __COUNTER__;
|
||||
APPLY_FOR_EVENTS(M)
|
||||
#undef M
|
||||
constexpr Event END = __COUNTER__;
|
||||
@ -218,16 +216,28 @@ Counters Counters::getPartiallyAtomicSnapshot() const
|
||||
return res;
|
||||
}
|
||||
|
||||
const char * getDescription(Event event)
|
||||
const char * getName(Event event)
|
||||
{
|
||||
static const char * descriptions[] =
|
||||
static const char * strings[] =
|
||||
{
|
||||
#define M(NAME) #NAME,
|
||||
#define M(NAME, DOCUMENTATION) #NAME,
|
||||
APPLY_FOR_EVENTS(M)
|
||||
#undef M
|
||||
};
|
||||
|
||||
return descriptions[event];
|
||||
return strings[event];
|
||||
}
|
||||
|
||||
const char * getDocumentation(Event event)
|
||||
{
|
||||
static const char * strings[] =
|
||||
{
|
||||
#define M(NAME, DOCUMENTATION) DOCUMENTATION,
|
||||
APPLY_FOR_EVENTS(M)
|
||||
#undef M
|
||||
};
|
||||
|
||||
return strings[event];
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,8 +86,11 @@ namespace ProfileEvents
|
||||
/// Increment a counter for event. Thread-safe.
|
||||
void increment(Event event, Count amount = 1);
|
||||
|
||||
/// Get text description of event by identifier. Returns statically allocated string.
|
||||
const char * getDescription(Event event);
|
||||
/// Get name of event by identifier. Returns statically allocated string.
|
||||
const char * getName(Event event);
|
||||
|
||||
/// Get description of event by identifier. Returns statically allocated string.
|
||||
const char * getDocumentation(Event event);
|
||||
|
||||
/// Get index just after last event identifier.
|
||||
Event end();
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
int thread_number = 0;
|
||||
std::time_t enqueue_time = 0;
|
||||
std::time_t start_time = 0;
|
||||
Type type;
|
||||
Type type = Read;
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <common/Types.h>
|
||||
#include <common/unaligned.h>
|
||||
#include <type_traits>
|
||||
|
||||
#define ROTL(x, b) static_cast<UInt64>(((x) << (b)) | ((x) >> (64 - (b))))
|
||||
@ -106,7 +107,7 @@ public:
|
||||
|
||||
while (data + 8 <= end)
|
||||
{
|
||||
current_word = *reinterpret_cast<const UInt64 *>(data);
|
||||
current_word = unalignedLoad<UInt64>(data);
|
||||
|
||||
v3 ^= current_word;
|
||||
SIPROUND;
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace ProfileEvents
|
||||
{
|
||||
extern const Event ObsoleteEphemeralNode;
|
||||
extern const Event LeaderElectionAcquiredLeadership;
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,15 @@ GraphiteRollupSortedBlockInputStream::GraphiteRollupSortedBlockInputStream(
|
||||
params(params), time_of_merge(time_of_merge)
|
||||
{
|
||||
size_t max_size_of_aggregate_state = 0;
|
||||
for (const auto & pattern : params.patterns)
|
||||
if (pattern.function->sizeOfData() > max_size_of_aggregate_state)
|
||||
max_size_of_aggregate_state = pattern.function->sizeOfData();
|
||||
size_t max_alignment_of_aggregate_state = 1;
|
||||
|
||||
place_for_aggregate_state.resize(max_size_of_aggregate_state);
|
||||
for (const auto & pattern : params.patterns)
|
||||
{
|
||||
max_size_of_aggregate_state = std::max(max_size_of_aggregate_state, pattern.function->sizeOfData());
|
||||
max_alignment_of_aggregate_state = std::max(max_alignment_of_aggregate_state, pattern.function->alignOfData());
|
||||
}
|
||||
|
||||
place_for_aggregate_state.reset(max_size_of_aggregate_state, max_alignment_of_aggregate_state);
|
||||
|
||||
/// Memoize column numbers in block.
|
||||
path_column_num = header.getPositionByName(params.path_column_name);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include <Common/OptimizedRegularExpression.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -186,7 +187,7 @@ private:
|
||||
time_t current_time_rounded = 0;
|
||||
|
||||
const Graphite::Pattern * current_pattern = nullptr;
|
||||
std::vector<char> place_for_aggregate_state;
|
||||
AlignedBuffer place_for_aggregate_state;
|
||||
bool aggregate_state_created = false; /// Invariant: if true then current_pattern is not NULL.
|
||||
|
||||
const Graphite::Pattern * selectPatternForPath(StringRef path) const;
|
||||
|
@ -65,7 +65,7 @@ size_t IBlockInputStream::checkDepthImpl(size_t max_depth, size_t level) const
|
||||
}
|
||||
|
||||
|
||||
void IBlockInputStream::dumpTree(std::ostream & ostr, size_t indent, size_t multiplier)
|
||||
void IBlockInputStream::dumpTree(std::ostream & ostr, size_t indent, size_t multiplier) const
|
||||
{
|
||||
ostr << String(indent, ' ') << getName();
|
||||
if (multiplier > 1)
|
||||
@ -78,16 +78,16 @@ void IBlockInputStream::dumpTree(std::ostream & ostr, size_t indent, size_t mult
|
||||
using Multipliers = std::map<String, size_t>;
|
||||
Multipliers multipliers;
|
||||
|
||||
for (BlockInputStreams::const_iterator it = children.begin(); it != children.end(); ++it)
|
||||
++multipliers[(*it)->getTreeID()];
|
||||
for (const auto & child : children)
|
||||
++multipliers[child->getTreeID()];
|
||||
|
||||
for (BlockInputStreams::iterator it = children.begin(); it != children.end(); ++it)
|
||||
for (const auto & child : children)
|
||||
{
|
||||
String id = (*it)->getTreeID();
|
||||
String id = child->getTreeID();
|
||||
size_t & subtree_multiplier = multipliers[id];
|
||||
if (subtree_multiplier != 0) /// Already printed subtrees are marked with zero in the array of multipliers.
|
||||
{
|
||||
(*it)->dumpTree(ostr, indent, subtree_multiplier);
|
||||
child->dumpTree(ostr, indent, subtree_multiplier);
|
||||
subtree_multiplier = 0;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
|
||||
/** Must be called before read, readPrefix.
|
||||
*/
|
||||
void dumpTree(std::ostream & ostr, size_t indent = 0, size_t multiplier = 1);
|
||||
void dumpTree(std::ostream & ostr, size_t indent = 0, size_t multiplier = 1) const;
|
||||
|
||||
/** Check the depth of the pipeline.
|
||||
* If max_depth is specified and the `depth` is greater - throw an exception.
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Core/Row.h>
|
||||
#include <Core/ColumnNumbers.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
#include <DataStreams/MergingSortedBlockInputStream.h>
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
#include <AggregateFunctions/AggregateFunctionFactory.h>
|
||||
@ -74,7 +75,7 @@ private:
|
||||
IAggregateFunction::AddFunc add_function = nullptr;
|
||||
std::vector<size_t> column_numbers;
|
||||
MutableColumnPtr merged_column;
|
||||
std::vector<char> state;
|
||||
AlignedBuffer state;
|
||||
bool created = false;
|
||||
|
||||
/// In case when column has type AggregateFunction: use the aggregate function from itself instead of 'function' above.
|
||||
@ -84,7 +85,7 @@ private:
|
||||
{
|
||||
function = AggregateFunctionFactory::instance().get(function_name, argument_types);
|
||||
add_function = function->getAddressOfAddFunction();
|
||||
state.resize(function->sizeOfData());
|
||||
state.reset(function->sizeOfData(), function->alignOfData());
|
||||
}
|
||||
|
||||
void createState()
|
||||
|
@ -34,7 +34,7 @@ TotalsHavingBlockInputStream::TotalsHavingBlockInputStream(
|
||||
|
||||
IAggregateFunction * function = column->getAggregateFunction().get();
|
||||
auto target = ColumnAggregateFunction::create(column->getAggregateFunction(), Arenas(1, arena));
|
||||
AggregateDataPtr data = arena->alloc(function->sizeOfData());
|
||||
AggregateDataPtr data = arena->alignedAlloc(function->sizeOfData(), function->alignOfData());
|
||||
function->create(data);
|
||||
target->getData().push_back(data);
|
||||
current_totals.emplace_back(std::move(target));
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
|
||||
#include <Formats/FormatSettings.h>
|
||||
#include <DataTypes/DataTypeAggregateFunction.h>
|
||||
@ -82,7 +83,7 @@ void DataTypeAggregateFunction::deserializeBinary(IColumn & column, ReadBuffer &
|
||||
|
||||
Arena & arena = column_concrete.createOrGetArena();
|
||||
size_t size_of_state = function->sizeOfData();
|
||||
AggregateDataPtr place = arena.alloc(size_of_state);
|
||||
AggregateDataPtr place = arena.alignedAlloc(size_of_state, function->alignOfData());
|
||||
|
||||
function->create(place);
|
||||
try
|
||||
@ -123,13 +124,14 @@ void DataTypeAggregateFunction::deserializeBinaryBulk(IColumn & column, ReadBuff
|
||||
vec.reserve(vec.size() + limit);
|
||||
|
||||
size_t size_of_state = function->sizeOfData();
|
||||
size_t align_of_state = function->alignOfData();
|
||||
|
||||
for (size_t i = 0; i < limit; ++i)
|
||||
{
|
||||
if (istr.eof())
|
||||
break;
|
||||
|
||||
AggregateDataPtr place = arena.alloc(size_of_state);
|
||||
AggregateDataPtr place = arena.alignedAlloc(size_of_state, align_of_state);
|
||||
|
||||
function->create(place);
|
||||
|
||||
@ -160,7 +162,7 @@ static void deserializeFromString(const AggregateFunctionPtr & function, IColumn
|
||||
|
||||
Arena & arena = column_concrete.createOrGetArena();
|
||||
size_t size_of_state = function->sizeOfData();
|
||||
AggregateDataPtr place = arena.alloc(size_of_state);
|
||||
AggregateDataPtr place = arena.alignedAlloc(size_of_state, function->alignOfData());
|
||||
|
||||
function->create(place);
|
||||
|
||||
@ -257,7 +259,7 @@ Field DataTypeAggregateFunction::getDefault() const
|
||||
{
|
||||
Field field = String();
|
||||
|
||||
PODArrayWithStackMemory<char, 16> place_buffer(function->sizeOfData());
|
||||
AlignedBuffer place_buffer(function->sizeOfData(), function->alignOfData());
|
||||
AggregateDataPtr place = place_buffer.data();
|
||||
|
||||
function->create(place);
|
||||
|
@ -65,6 +65,7 @@ BlockOutputStreamPtr FormatFactory::getOutput(const String & name, WriteBuffer &
|
||||
format_settings.csv.allow_single_quotes = settings.format_csv_allow_single_quotes;
|
||||
format_settings.csv.allow_double_quotes = settings.format_csv_allow_double_quotes;
|
||||
format_settings.pretty.max_rows = settings.output_format_pretty_max_rows;
|
||||
format_settings.pretty.max_column_pad_width = settings.output_format_pretty_max_column_pad_width;
|
||||
format_settings.pretty.color = settings.output_format_pretty_color;
|
||||
format_settings.write_statistics = settings.output_format_write_statistics;
|
||||
|
||||
|
@ -34,6 +34,7 @@ struct FormatSettings
|
||||
struct Pretty
|
||||
{
|
||||
UInt64 max_rows = 10000;
|
||||
UInt64 max_column_pad_width = 250;
|
||||
bool color = true;
|
||||
};
|
||||
|
||||
|
@ -60,13 +60,15 @@ void PrettyBlockOutputStream::calculateWidths(
|
||||
elem.type->serializeText(*elem.column, j, out, format_settings);
|
||||
}
|
||||
|
||||
widths[i][j] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(serialized_value.data()), serialized_value.size());
|
||||
widths[i][j] = std::min(format_settings.pretty.max_column_pad_width,
|
||||
UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(serialized_value.data()), serialized_value.size()));
|
||||
max_widths[i] = std::max(max_widths[i], widths[i][j]);
|
||||
}
|
||||
|
||||
/// And also calculate widths for names of columns.
|
||||
{
|
||||
name_widths[i] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(elem.name.data()), elem.name.size());
|
||||
name_widths[i] = std::min(format_settings.pretty.max_column_pad_width,
|
||||
UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(elem.name.data()), elem.name.size()));
|
||||
max_widths[i] = std::max(max_widths[i], name_widths[i]);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <Functions/GatherUtils/GatherUtils.h>
|
||||
#include <Common/HashTable/HashMap.h>
|
||||
#include <Common/HashTable/ClearableHashMap.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
#include <Parsers/ExpressionListParsers.h>
|
||||
#include <Parsers/parseQuery.h>
|
||||
#include <Parsers/ASTExpressionList.h>
|
||||
@ -2779,8 +2780,8 @@ DataTypePtr FunctionArrayReduce::getReturnTypeImpl(const ColumnsWithTypeAndName
|
||||
void FunctionArrayReduce::executeImpl(Block & block, const ColumnNumbers & arguments, size_t result, size_t input_rows_count)
|
||||
{
|
||||
IAggregateFunction & agg_func = *aggregate_function.get();
|
||||
std::unique_ptr<char[]> place_holder { new char[agg_func.sizeOfData()] };
|
||||
AggregateDataPtr place = place_holder.get();
|
||||
AlignedBuffer place_holder(agg_func.sizeOfData(), agg_func.alignOfData());
|
||||
AggregateDataPtr place = place_holder.data();
|
||||
|
||||
std::unique_ptr<Arena> arena = agg_func.allocatesMemoryInArena() ? std::make_unique<Arena>() : nullptr;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <Common/UnicodeBar.h>
|
||||
#include <Common/UTF8Helpers.h>
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <Common/AlignedBuffer.h>
|
||||
#include <Common/config_version.h>
|
||||
#include <DataTypes/DataTypeAggregateFunction.h>
|
||||
#include <DataTypes/DataTypeArray.h>
|
||||
@ -1422,14 +1423,9 @@ public:
|
||||
AggregateFunctionPtr aggregate_function_ptr = column_with_states->getAggregateFunction();
|
||||
const IAggregateFunction & agg_func = *aggregate_function_ptr;
|
||||
|
||||
auto deleter = [&agg_func](char * ptr)
|
||||
{
|
||||
agg_func.destroy(ptr);
|
||||
free(ptr);
|
||||
};
|
||||
std::unique_ptr<char, decltype(deleter)> place{reinterpret_cast<char *>(malloc(agg_func.sizeOfData())), deleter};
|
||||
|
||||
agg_func.create(place.get()); /// Not much exception-safe. If an exception is thrown out, destroy will be called in vain.
|
||||
AlignedBuffer place(agg_func.sizeOfData(), agg_func.alignOfData());
|
||||
agg_func.create(place.data());
|
||||
SCOPE_EXIT(agg_func.destroy(place.data()));
|
||||
|
||||
std::unique_ptr<Arena> arena = agg_func.allocatesMemoryInArena() ? std::make_unique<Arena>() : nullptr;
|
||||
|
||||
@ -1441,8 +1437,8 @@ public:
|
||||
for (const auto & state_to_add : states)
|
||||
{
|
||||
/// Will pass empty arena if agg_func does not allocate memory in arena
|
||||
agg_func.merge(place.get(), state_to_add, arena.get());
|
||||
agg_func.insertResultInto(place.get(), result_column);
|
||||
agg_func.merge(place.data(), state_to_add, arena.get());
|
||||
agg_func.insertResultInto(place.data(), result_column);
|
||||
}
|
||||
|
||||
block.getByPosition(result).column = std::move(result_column_ptr);
|
||||
|
@ -87,61 +87,47 @@ struct ExtractBool
|
||||
|
||||
struct ExtractRaw
|
||||
{
|
||||
static constexpr size_t bytes_on_stack = 64;
|
||||
using ExpectChars = PODArray<char, bytes_on_stack, AllocatorWithStackMemory<Allocator<false>, bytes_on_stack>>;
|
||||
|
||||
static void extract(const UInt8 * pos, const UInt8 * end, ColumnString::Chars_t & res_data)
|
||||
{
|
||||
if (pos == end)
|
||||
return;
|
||||
ExpectChars expects_end;
|
||||
UInt8 current_expect_end = 0;
|
||||
|
||||
UInt8 open_char = *pos;
|
||||
UInt8 close_char = 0;
|
||||
switch (open_char)
|
||||
for (auto extract_begin = pos; pos != end; ++pos)
|
||||
{
|
||||
if (*pos == current_expect_end)
|
||||
{
|
||||
expects_end.pop_back();
|
||||
current_expect_end = (UInt8) (expects_end.empty() ? 0 : expects_end.back());
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(*pos)
|
||||
{
|
||||
case '[':
|
||||
close_char = ']';
|
||||
expects_end.push_back((current_expect_end = ']'));
|
||||
break;
|
||||
case '{':
|
||||
close_char = '}';
|
||||
expects_end.push_back((current_expect_end = '}'));
|
||||
break;
|
||||
case '"' :
|
||||
close_char = '"';
|
||||
expects_end.push_back((current_expect_end = '"'));
|
||||
break;
|
||||
}
|
||||
|
||||
if (close_char != 0)
|
||||
{
|
||||
size_t balance = 1;
|
||||
char last_char = 0;
|
||||
|
||||
res_data.push_back(*pos);
|
||||
|
||||
++pos;
|
||||
for (; pos != end && balance > 0; ++pos)
|
||||
{
|
||||
res_data.push_back(*pos);
|
||||
|
||||
if (open_char == '"' && *pos == '"')
|
||||
{
|
||||
if (last_char != '\\')
|
||||
case '\\':
|
||||
/// skip backslash
|
||||
if (pos + 1 < end && pos[1] == '"')
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
default:
|
||||
if (!current_expect_end && (*pos == ',' || *pos == '}'))
|
||||
{
|
||||
if (*pos == open_char)
|
||||
++balance;
|
||||
if (*pos == close_char)
|
||||
--balance;
|
||||
}
|
||||
|
||||
if (last_char == '\\')
|
||||
last_char = 0;
|
||||
else
|
||||
last_char = *pos;
|
||||
res_data.insert(extract_begin, pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; pos != end && *pos != ',' && *pos != '}'; ++pos)
|
||||
res_data.push_back(*pos);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -30,11 +30,8 @@ void MMapReadBufferFromFile::open(const std::string & file_name)
|
||||
fd = ::open(file_name.c_str(), O_RDONLY);
|
||||
|
||||
if (-1 == fd)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
throwFromErrno("Cannot open file " + file_name, errno == ENOENT ? ErrorCodes::FILE_DOESNT_EXIST : ErrorCodes::CANNOT_OPEN_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MMapReadBufferFromFile::MMapReadBufferFromFile(const std::string & file_name, size_t offset, size_t length)
|
||||
|
@ -16,7 +16,6 @@
|
||||
namespace ProfileEvents
|
||||
{
|
||||
extern const Event FileOpen;
|
||||
extern const Event FileOpenFailed;
|
||||
extern const Event ReadBufferAIORead;
|
||||
extern const Event ReadBufferAIOReadBytes;
|
||||
}
|
||||
@ -54,7 +53,6 @@ ReadBufferAIO::ReadBufferAIO(const std::string & filename_, size_t buffer_size_,
|
||||
fd = ::open(filename.c_str(), open_flags);
|
||||
if (fd == -1)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
auto error_code = (errno == ENOENT) ? ErrorCodes::FILE_DOESNT_EXIST : ErrorCodes::CANNOT_OPEN_FILE;
|
||||
throwFromErrno("Cannot open file " + filename, error_code);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
namespace ProfileEvents
|
||||
{
|
||||
extern const Event FileOpen;
|
||||
extern const Event FileOpenFailed;
|
||||
}
|
||||
|
||||
|
||||
@ -42,19 +41,13 @@ ReadBufferFromFile::ReadBufferFromFile(
|
||||
fd = open(file_name.c_str(), flags == -1 ? O_RDONLY : flags);
|
||||
|
||||
if (-1 == fd)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
throwFromErrno("Cannot open file " + file_name, errno == ENOENT ? ErrorCodes::FILE_DOESNT_EXIST : ErrorCodes::CANNOT_OPEN_FILE);
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
if (o_direct)
|
||||
{
|
||||
if (fcntl(fd, F_NOCACHE, 1) == -1)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
throwFromErrno("Cannot set F_NOCACHE on file " + file_name, ErrorCodes::CANNOT_OPEN_FILE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace ProfileEvents
|
||||
{
|
||||
extern const Event FileOpen;
|
||||
extern const Event FileOpenFailed;
|
||||
extern const Event WriteBufferAIOWrite;
|
||||
extern const Event WriteBufferAIOWriteBytes;
|
||||
}
|
||||
@ -54,15 +53,12 @@ WriteBufferAIO::WriteBufferAIO(const std::string & filename_, size_t buffer_size
|
||||
flush_buffer.buffer().resize(this->buffer().size() - DEFAULT_AIO_FILE_BLOCK_SIZE);
|
||||
flush_buffer.internalBuffer().resize(this->internalBuffer().size() - DEFAULT_AIO_FILE_BLOCK_SIZE);
|
||||
|
||||
ProfileEvents::increment(ProfileEvents::FileOpen);
|
||||
|
||||
int open_flags = (flags_ == -1) ? (O_RDWR | O_TRUNC | O_CREAT) : flags_;
|
||||
open_flags |= O_DIRECT;
|
||||
|
||||
fd = ::open(filename.c_str(), open_flags, mode_);
|
||||
if (fd == -1)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
auto error_code = (errno == ENOENT) ? ErrorCodes::FILE_DOESNT_EXIST : ErrorCodes::CANNOT_OPEN_FILE;
|
||||
throwFromErrno("Cannot open file " + filename, error_code);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
namespace ProfileEvents
|
||||
{
|
||||
extern const Event FileOpen;
|
||||
extern const Event FileOpenFailed;
|
||||
}
|
||||
|
||||
namespace DB
|
||||
@ -45,20 +44,14 @@ WriteBufferFromFile::WriteBufferFromFile(
|
||||
fd = open(file_name.c_str(), flags == -1 ? O_WRONLY | O_TRUNC | O_CREAT : flags, mode);
|
||||
|
||||
if (-1 == fd)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
throwFromErrno("Cannot open file " + file_name, errno == ENOENT ? ErrorCodes::FILE_DOESNT_EXIST : ErrorCodes::CANNOT_OPEN_FILE);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (o_direct)
|
||||
{
|
||||
if (fcntl(fd, F_NOCACHE, 1) == -1)
|
||||
{
|
||||
ProfileEvents::increment(ProfileEvents::FileOpenFailed);
|
||||
throwFromErrno("Cannot set F_NOCACHE on file " + file_name, ErrorCodes::CANNOT_OPEN_FILE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ namespace ErrorCodes
|
||||
extern const int TOO_MANY_ROWS;
|
||||
extern const int EMPTY_DATA_PASSED;
|
||||
extern const int CANNOT_MERGE_DIFFERENT_AGGREGATED_DATA_VARIANTS;
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -153,11 +154,32 @@ Aggregator::Aggregator(const Params & params_)
|
||||
total_size_of_aggregate_states = 0;
|
||||
all_aggregates_has_trivial_destructor = true;
|
||||
|
||||
// aggreate_states will be aligned as below:
|
||||
// |<-- state_1 -->|<-- pad_1 -->|<-- state_2 -->|<-- pad_2 -->| .....
|
||||
//
|
||||
// pad_N will be used to match alignment requirement for each next state.
|
||||
// The address of state_1 is aligned based on maximum alignment requirements in states
|
||||
for (size_t i = 0; i < params.aggregates_size; ++i)
|
||||
{
|
||||
offsets_of_aggregate_states[i] = total_size_of_aggregate_states;
|
||||
|
||||
total_size_of_aggregate_states += params.aggregates[i].function->sizeOfData();
|
||||
|
||||
// aggreate states are aligned based on maximum requirement
|
||||
align_aggregate_states = std::max(align_aggregate_states, params.aggregates[i].function->alignOfData());
|
||||
|
||||
// If not the last aggregate_state, we need pad it so that next aggregate_state will be aligned.
|
||||
if (i + 1 < params.aggregates_size)
|
||||
{
|
||||
size_t alignment_of_next_state = params.aggregates[i + 1].function->alignOfData();
|
||||
if ((alignment_of_next_state & (alignment_of_next_state - 1)) != 0)
|
||||
throw Exception("Logical error: alignOfData is not 2^N", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
/// Extend total_size to next alignment requirement
|
||||
/// Add padding by rounding up 'total_size_of_aggregate_states' to be a multiplier of alignment_of_next_state.
|
||||
total_size_of_aggregate_states = (total_size_of_aggregate_states + alignment_of_next_state - 1) / alignment_of_next_state * alignment_of_next_state;
|
||||
}
|
||||
|
||||
if (!params.aggregates[i].function->hasTrivialDestructor())
|
||||
all_aggregates_has_trivial_destructor = false;
|
||||
}
|
||||
@ -610,7 +632,7 @@ void NO_INLINE Aggregator::executeImplCase(
|
||||
|
||||
method.onNewKey(*it, params.keys_size, keys, *aggregates_pool);
|
||||
|
||||
AggregateDataPtr place = aggregates_pool->alloc(total_size_of_aggregate_states);
|
||||
AggregateDataPtr place = aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states);
|
||||
createAggregateStates(place);
|
||||
aggregate_data = place;
|
||||
}
|
||||
@ -728,7 +750,7 @@ bool Aggregator::executeOnBlock(const Block & block, AggregatedDataVariants & re
|
||||
|
||||
if ((params.overflow_row || result.type == AggregatedDataVariants::Type::without_key) && !result.without_key)
|
||||
{
|
||||
AggregateDataPtr place = result.aggregates_pool->alloc(total_size_of_aggregate_states);
|
||||
AggregateDataPtr place = result.aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states);
|
||||
createAggregateStates(place);
|
||||
result.without_key = place;
|
||||
}
|
||||
@ -1889,7 +1911,7 @@ void NO_INLINE Aggregator::mergeStreamsImplCase(
|
||||
|
||||
method.onNewKey(*it, params.keys_size, keys, *aggregates_pool);
|
||||
|
||||
AggregateDataPtr place = aggregates_pool->alloc(total_size_of_aggregate_states);
|
||||
AggregateDataPtr place = aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states);
|
||||
createAggregateStates(place);
|
||||
aggregate_data = place;
|
||||
}
|
||||
@ -1939,7 +1961,7 @@ void NO_INLINE Aggregator::mergeWithoutKeyStreamsImpl(
|
||||
AggregatedDataWithoutKey & res = result.without_key;
|
||||
if (!res)
|
||||
{
|
||||
AggregateDataPtr place = result.aggregates_pool->alloc(total_size_of_aggregate_states);
|
||||
AggregateDataPtr place = result.aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states);
|
||||
createAggregateStates(place);
|
||||
res = place;
|
||||
}
|
||||
@ -1991,7 +2013,7 @@ void Aggregator::mergeStream(const BlockInputStreamPtr & stream, AggregatedDataV
|
||||
* If there is at least one block with a bucket number greater than zero, then there was a two-level aggregation.
|
||||
*/
|
||||
auto max_bucket = bucket_to_blocks.rbegin()->first;
|
||||
size_t has_two_level = max_bucket > 0;
|
||||
size_t has_two_level = max_bucket >= 0;
|
||||
|
||||
if (has_two_level)
|
||||
{
|
||||
|
@ -1154,6 +1154,11 @@ protected:
|
||||
|
||||
Sizes offsets_of_aggregate_states; /// The offset to the n-th aggregate function in a row of aggregate functions.
|
||||
size_t total_size_of_aggregate_states = 0; /// The total size of the row from the aggregate functions.
|
||||
|
||||
// add info to track alignment requirement
|
||||
// If there are states whose alignmentment are v1, ..vn, align_aggregate_states will be max(v1, ... vn)
|
||||
size_t align_aggregate_states = 1;
|
||||
|
||||
bool all_aggregates_has_trivial_destructor = false;
|
||||
|
||||
/// How many RAM were used to process the query before processing the first block.
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
ConnectionPoolWithFailoverPtr pool;
|
||||
/// Connection pool for each replica, contains nullptr for local replicas
|
||||
ConnectionPoolPtrs per_replica_pools;
|
||||
bool has_internal_replication;
|
||||
bool has_internal_replication = false;
|
||||
};
|
||||
|
||||
using ShardsInfo = std::vector<ShardInfo>;
|
||||
|
@ -243,6 +243,9 @@ ExpressionAnalyzer::ExpressionAnalyzer(
|
||||
// Remove duplicated elements from LIMIT BY clause.
|
||||
optimizeLimitBy();
|
||||
|
||||
/// Remove duplicated columns from USING(...).
|
||||
optimizeUsing();
|
||||
|
||||
/// array_join_alias_to_name, array_join_result_to_source.
|
||||
getArrayJoinedColumns();
|
||||
|
||||
@ -638,14 +641,15 @@ void ExpressionAnalyzer::findExternalTables(ASTPtr & ast)
|
||||
}
|
||||
|
||||
static std::shared_ptr<InterpreterSelectWithUnionQuery> interpretSubquery(
|
||||
const ASTPtr & subquery_or_table_name, const Context & context, size_t subquery_depth, const Names & required_source_columns)
|
||||
const ASTPtr & table_expression, const Context & context, size_t subquery_depth, const Names & required_source_columns)
|
||||
{
|
||||
/// Subquery or table name. The name of the table is similar to the subquery `SELECT * FROM t`.
|
||||
const ASTSubquery * subquery = typeid_cast<const ASTSubquery *>(subquery_or_table_name.get());
|
||||
const ASTIdentifier * table = typeid_cast<const ASTIdentifier *>(subquery_or_table_name.get());
|
||||
const ASTSubquery * subquery = typeid_cast<const ASTSubquery *>(table_expression.get());
|
||||
const ASTFunction * function = typeid_cast<const ASTFunction *>(table_expression.get());
|
||||
const ASTIdentifier * table = typeid_cast<const ASTIdentifier *>(table_expression.get());
|
||||
|
||||
if (!subquery && !table)
|
||||
throw Exception("IN/JOIN supports only SELECT subqueries.", ErrorCodes::BAD_ARGUMENTS);
|
||||
if (!subquery && !table && !function)
|
||||
throw Exception("Table expression is undefined, Method: ExpressionAnalyzer::interpretSubquery." , ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
/** The subquery in the IN / JOIN section does not have any restrictions on the maximum size of the result.
|
||||
* Because the result of this query is not the result of the entire query.
|
||||
@ -663,7 +667,7 @@ static std::shared_ptr<InterpreterSelectWithUnionQuery> interpretSubquery(
|
||||
subquery_context.setSettings(subquery_settings);
|
||||
|
||||
ASTPtr query;
|
||||
if (table)
|
||||
if (table || function)
|
||||
{
|
||||
/// create ASTSelectQuery for "SELECT * FROM table" as if written by hand
|
||||
const auto select_with_union_query = std::make_shared<ASTSelectWithUnionQuery>();
|
||||
@ -678,17 +682,28 @@ static std::shared_ptr<InterpreterSelectWithUnionQuery> interpretSubquery(
|
||||
select_query->select_expression_list = select_expression_list;
|
||||
select_query->children.emplace_back(select_query->select_expression_list);
|
||||
|
||||
NamesAndTypesList columns;
|
||||
|
||||
/// get columns list for target table
|
||||
if (function)
|
||||
{
|
||||
auto query_context = const_cast<Context *>(&context.getQueryContext());
|
||||
const auto & storage = query_context->executeTableFunction(table_expression);
|
||||
columns = storage->getColumns().ordinary;
|
||||
select_query->addTableFunction(*const_cast<ASTPtr *>(&table_expression));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto database_table = getDatabaseAndTableNameFromIdentifier(*table);
|
||||
const auto & storage = context.getTable(database_table.first, database_table.second);
|
||||
const auto & columns = storage->getColumns().ordinary;
|
||||
select_expression_list->children.reserve(columns.size());
|
||||
columns = storage->getColumns().ordinary;
|
||||
select_query->replaceDatabaseAndTable(database_table.first, database_table.second);
|
||||
}
|
||||
|
||||
select_expression_list->children.reserve(columns.size());
|
||||
/// manually substitute column names in place of asterisk
|
||||
for (const auto & column : columns)
|
||||
select_expression_list->children.emplace_back(std::make_shared<ASTIdentifier>(column.name));
|
||||
|
||||
select_query->replaceDatabaseAndTable(database_table.first, database_table.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1422,6 +1437,38 @@ void ExpressionAnalyzer::optimizeLimitBy()
|
||||
elems = unique_elems;
|
||||
}
|
||||
|
||||
void ExpressionAnalyzer::optimizeUsing()
|
||||
{
|
||||
if (!select_query)
|
||||
return;
|
||||
|
||||
auto node = const_cast<ASTTablesInSelectQueryElement *>(select_query->join());
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
auto table_join = static_cast<ASTTableJoin *>(&*node->table_join);
|
||||
if (!(table_join && table_join->using_expression_list))
|
||||
return;
|
||||
|
||||
ASTs & expression_list = table_join->using_expression_list->children;
|
||||
ASTs uniq_expressions_list;
|
||||
|
||||
std::set<String> expressions_names;
|
||||
|
||||
for (const auto & expression : expression_list)
|
||||
{
|
||||
auto expression_name = expression->getAliasOrColumnName();
|
||||
if (expressions_names.find(expression_name) == expressions_names.end())
|
||||
{
|
||||
uniq_expressions_list.push_back(expression);
|
||||
expressions_names.insert(expression_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (uniq_expressions_list.size() < expression_list.size())
|
||||
expression_list = uniq_expressions_list;
|
||||
}
|
||||
|
||||
|
||||
void ExpressionAnalyzer::makeSetsForIndex()
|
||||
{
|
||||
@ -2473,6 +2520,13 @@ NamesAndTypesList ExpressionAnalyzer::AnalyzedJoin::getColumnsFromJoinedTable(co
|
||||
const auto & subquery = table_expression.subquery->children.at(0);
|
||||
nested_result_sample = InterpreterSelectWithUnionQuery::getSampleBlock(subquery, query_context);
|
||||
}
|
||||
else if (table_expression.table_function)
|
||||
{
|
||||
const auto table_function = table_expression.table_function;
|
||||
auto query_context = const_cast<Context *>(&context.getQueryContext());
|
||||
const auto & join_storage = query_context->executeTableFunction(table_function);
|
||||
nested_result_sample = join_storage->getSampleBlockNonMaterialized();
|
||||
}
|
||||
else if (table_expression.database_and_table_name)
|
||||
{
|
||||
const auto & identifier = static_cast<const ASTIdentifier &>(*table_expression.database_and_table_name);
|
||||
@ -2560,10 +2614,12 @@ bool ExpressionAnalyzer::appendJoin(ExpressionActionsChain & chain, bool only_ty
|
||||
{
|
||||
ASTPtr table;
|
||||
|
||||
if (table_to_join.database_and_table_name)
|
||||
table = table_to_join.database_and_table_name;
|
||||
else
|
||||
if (table_to_join.subquery)
|
||||
table = table_to_join.subquery;
|
||||
else if (table_to_join.table_function)
|
||||
table = table_to_join.table_function;
|
||||
else if (table_to_join.database_and_table_name)
|
||||
table = table_to_join.database_and_table_name;
|
||||
|
||||
auto interpreter = interpretSubquery(table, context, subquery_depth, analyzed_join.required_columns_from_joined_table);
|
||||
subquery_for_set.source = std::make_shared<LazyBlockInputStream>(
|
||||
@ -3178,14 +3234,9 @@ void ExpressionAnalyzer::collectJoinedColumns(NameSet & joined_columns)
|
||||
auto joined_table_name = getTableNameWithAliasFromTableExpression(table_expression, context);
|
||||
|
||||
auto add_name_to_join_keys = [](Names & join_keys, ASTs & join_asts, const String & name, const ASTPtr & ast)
|
||||
{
|
||||
if (join_keys.end() == std::find(join_keys.begin(), join_keys.end(), name))
|
||||
{
|
||||
join_keys.push_back(name);
|
||||
join_asts.push_back(ast);
|
||||
}
|
||||
else
|
||||
throw Exception("Duplicate column " + name + " in USING list", ErrorCodes::DUPLICATE_COLUMN);
|
||||
};
|
||||
|
||||
if (table_join.using_expression_list)
|
||||
|
@ -325,6 +325,9 @@ private:
|
||||
|
||||
void optimizeLimitBy();
|
||||
|
||||
/// Remove duplicated columns from USING(...).
|
||||
void optimizeUsing();
|
||||
|
||||
/// remove Function_if AST if condition is constant
|
||||
void optimizeIfWithConstantCondition();
|
||||
void optimizeIfWithConstantConditionImpl(ASTPtr & current_ast);
|
||||
|
@ -351,7 +351,10 @@ ASTs PredicateExpressionsOptimizer::evaluateAsterisk(ASTSelectQuery * select_que
|
||||
StoragePtr storage;
|
||||
|
||||
if (table_expression->table_function)
|
||||
storage = const_cast<Context &>(context).executeTableFunction(table_expression->table_function);
|
||||
{
|
||||
auto query_context = const_cast<Context *>(&context.getQueryContext());
|
||||
storage = query_context->executeTableFunction(table_expression->table_function);
|
||||
}
|
||||
else if (table_expression->database_and_table_name)
|
||||
{
|
||||
const auto database_and_table_ast = static_cast<ASTIdentifier*>(table_expression->database_and_table_name.get());
|
||||
|
@ -30,7 +30,7 @@ void dumpToArrayColumns(const Counters & counters, DB::IColumn * column_names_,
|
||||
|
||||
if (column_names)
|
||||
{
|
||||
const char * desc = ProfileEvents::getDescription(event);
|
||||
const char * desc = ProfileEvents::getName(event);
|
||||
column_names->getData().insertData(desc, strlen(desc));
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,7 @@ struct Settings
|
||||
M(SettingBool, output_format_json_escape_forward_slashes, true, "Controls escaping forward slashes for string outputs in JSON output format. This is intended for compatibility with JavaScript. Don't confuse with backslashes that are always escaped.") \
|
||||
\
|
||||
M(SettingUInt64, output_format_pretty_max_rows, 10000, "Rows limit for Pretty formats.") \
|
||||
M(SettingUInt64, output_format_pretty_max_column_pad_width, 250, "Maximum width to pad all values in a column in Pretty formats.") \
|
||||
M(SettingBool, output_format_pretty_color, true, "Use ANSI escape sequences to paint colors in Pretty formats") \
|
||||
\
|
||||
M(SettingBool, use_client_time_zone, false, "Use client timezone for interpreting DateTime string values, instead of adopting server timezone.") \
|
||||
|
@ -189,7 +189,7 @@ void NO_INLINE Aggregator::executeSpecializedCase(
|
||||
|
||||
method.onNewKey(*it, params.keys_size, keys, *aggregates_pool);
|
||||
|
||||
AggregateDataPtr place = aggregates_pool->alloc(total_size_of_aggregate_states);
|
||||
AggregateDataPtr place = aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states);
|
||||
|
||||
AggregateFunctionsList::forEach(AggregateFunctionsCreator(
|
||||
aggregate_functions, offsets_of_aggregate_states, place));
|
||||
|
@ -11,6 +11,7 @@ NamesAndTypesList StorageSystemEvents::getNamesAndTypes()
|
||||
return {
|
||||
{"event", std::make_shared<DataTypeString>()},
|
||||
{"value", std::make_shared<DataTypeUInt64>()},
|
||||
{"description", std::make_shared<DataTypeString>()},
|
||||
};
|
||||
}
|
||||
|
||||
@ -22,8 +23,9 @@ void StorageSystemEvents::fillData(MutableColumns & res_columns, const Context &
|
||||
|
||||
if (0 != value)
|
||||
{
|
||||
res_columns[0]->insert(String(ProfileEvents::getDescription(ProfileEvents::Event(i))));
|
||||
res_columns[0]->insert(String(ProfileEvents::getName(ProfileEvents::Event(i))));
|
||||
res_columns[1]->insert(value);
|
||||
res_columns[2]->insert(String(ProfileEvents::getDocumentation(ProfileEvents::Event(i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ NamesAndTypesList StorageSystemMetrics::getNamesAndTypes()
|
||||
return {
|
||||
{"metric", std::make_shared<DataTypeString>()},
|
||||
{"value", std::make_shared<DataTypeInt64>()},
|
||||
{"description", std::make_shared<DataTypeString>()},
|
||||
};
|
||||
}
|
||||
|
||||
@ -22,8 +23,9 @@ void StorageSystemMetrics::fillData(MutableColumns & res_columns, const Context
|
||||
{
|
||||
Int64 value = CurrentMetrics::values[i].load(std::memory_order_relaxed);
|
||||
|
||||
res_columns[0]->insert(String(CurrentMetrics::getDescription(CurrentMetrics::Metric(i))));
|
||||
res_columns[0]->insert(String(CurrentMetrics::getName(CurrentMetrics::Metric(i))));
|
||||
res_columns[1]->insert(value);
|
||||
res_columns[2]->insert(String(CurrentMetrics::getDocumentation(CurrentMetrics::Metric(i))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
<test>
|
||||
<name>visit_param_extract_raw</name>
|
||||
<type>once</type>
|
||||
|
||||
<stop_conditions>
|
||||
<any_of>
|
||||
<average_speed_not_changing_for_ms>10000</average_speed_not_changing_for_ms>
|
||||
<total_time_ms>1000</total_time_ms>
|
||||
</any_of>
|
||||
</stop_conditions>
|
||||
|
||||
<main_metric>
|
||||
<max_rows_per_second />
|
||||
<max_bytes_per_second />
|
||||
<avg_rows_per_second />
|
||||
<avg_bytes_per_second />
|
||||
</main_metric>
|
||||
|
||||
<substitutions>
|
||||
<substitution>
|
||||
<name>param</name>
|
||||
<values>
|
||||
<value>'{"myparam":"test_string"}'</value>
|
||||
<value>'{"myparam":{"nested_1":"test_string","nested_2":"test_2"}}'</value>
|
||||
<value>'{"myparam":{"nested_1":"test_string","nested_2":"test_2","nested_1":"test_string","nested_2":"test_2","nested_1":"test_string","nested_2":"test_2"}}'</value>
|
||||
</values>
|
||||
</substitution>
|
||||
</substitutions>
|
||||
|
||||
<query>SELECT count() FROM system.numbers WHERE NOT ignore(visitParamExtractRaw(materialize({param}), 'myparam'))</query>
|
||||
</test>
|
@ -0,0 +1,13 @@
|
||||
-1
|
||||
0
|
||||
0
|
||||
-1
|
||||
1
|
||||
test_string
|
||||
test"string
|
||||
"test_string"
|
||||
"test_string"
|
||||
"test\\"string"
|
||||
"test\\"string"
|
||||
["]", "2", "3"]
|
||||
{"nested" : [1,2,3]}
|
@ -0,0 +1,15 @@
|
||||
-- VisitParam with basic type
|
||||
SELECT visitParamExtractInt('{"myparam":-1}', 'myparam');
|
||||
SELECT visitParamExtractUInt('{"myparam":-1}', 'myparam');
|
||||
SELECT visitParamExtractFloat('{"myparam":null}', 'myparam');
|
||||
SELECT visitParamExtractFloat('{"myparam":-1}', 'myparam');
|
||||
SELECT visitParamExtractBool('{"myparam":true}', 'myparam');
|
||||
SELECT visitParamExtractString('{"myparam":"test_string"}', 'myparam');
|
||||
SELECT visitParamExtractString('{"myparam":"test\\"string"}', 'myparam');
|
||||
-- VisitParam with complex type
|
||||
SELECT visitParamExtractRaw('{"myparam":"test_string"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "test_string"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "test\\"string"}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": "test\\"string", "other":123}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": ["]", "2", "3"], "other":123}', 'myparam');
|
||||
SELECT visitParamExtractRaw('{"myparam": {"nested" : [1,2,3]}, "other":123}', 'myparam');
|
@ -1,4 +0,0 @@
|
||||
-1
|
||||
0
|
||||
0
|
||||
-1
|
@ -1,4 +0,0 @@
|
||||
select visitParamExtractInt('{"myparam":-1}', 'myparam') AS res;
|
||||
select visitParamExtractUInt('{"myparam":-1}', 'myparam') AS res;
|
||||
select visitParamExtractFloat('{"myparam":null}', 'myparam') AS res;
|
||||
select visitParamExtractFloat('{"myparam":-1}', 'myparam') AS res;
|
@ -0,0 +1,3 @@
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
@ -0,0 +1 @@
|
||||
SELECT * FROM numbers(3) AS a ANY LEFT JOIN numbers(3) AS b ON a.number = b.number
|
@ -0,0 +1,102 @@
|
||||
┌─range(number)──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ [] │
|
||||
│ [0] │
|
||||
│ [0,1] │
|
||||
│ [0,1,2] │
|
||||
│ [0,1,2,3] │
|
||||
│ [0,1,2,3,4] │
|
||||
│ [0,1,2,3,4,5] │
|
||||
│ [0,1,2,3,4,5,6] │
|
||||
│ [0,1,2,3,4,5,6,7] │
|
||||
│ [0,1,2,3,4,5,6,7,8] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97] │
|
||||
│ [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98] │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
@ -0,0 +1,2 @@
|
||||
SET output_format_pretty_max_column_pad_width = 250;
|
||||
SELECT range(number) FROM system.numbers LIMIT 100 FORMAT PrettyCompactNoEscapes;
|
@ -0,0 +1,3 @@
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
13
dbms/tests/queries/0_stateless/00702_join_with_using.sql
Normal file
13
dbms/tests/queries/0_stateless/00702_join_with_using.sql
Normal file
@ -0,0 +1,13 @@
|
||||
DROP TABLE IF EXISTS test.using1;
|
||||
DROP TABLE IF EXISTS test.using2;
|
||||
|
||||
CREATE TABLE test.using1(a UInt8, b UInt8) ENGINE=Memory;
|
||||
CREATE TABLE test.using2(a UInt8, b UInt8) ENGINE=Memory;
|
||||
|
||||
INSERT INTO test.using1 VALUES (1, 1) (2, 2) (3, 3);
|
||||
INSERT INTO test.using2 VALUES (4, 4) (2, 2) (3, 3);
|
||||
|
||||
SELECT * FROM test.using1 ALL LEFT JOIN (SELECT * FROM test.using2) USING (a, a, a, b, b, b, a, a) ORDER BY a;
|
||||
|
||||
DROP TABLE test.using1;
|
||||
DROP TABLE test.using2;
|
@ -5,6 +5,8 @@
|
||||
Почти все ограничения действуют только на SELECT-ы.
|
||||
При распределённой обработке запроса, ограничения действуют на каждом сервере по-отдельности.
|
||||
|
||||
Ограничения проверяются на каждый блок обработанных данных, а не на каждую строку. В связи с этим, ограничения могут быть превышены на размер блока.
|
||||
|
||||
Ограничения вида "максимальное количество чего-нибудь" могут принимать значение 0, которое обозначает "не ограничено".
|
||||
Для большинства ограничений также присутствует настройка вида overflow_mode - что делать, когда ограничение превышено.
|
||||
Оно может принимать одно из двух значений: `throw` или `break`; а для ограничения на агрегацию (group_by_overflow_mode) есть ещё значение `any`.
|
||||
|
@ -103,18 +103,18 @@ inline bool memequalSSE2Wide(const char * p1, const char * p2, size_t size)
|
||||
case 15: if (p1[14] != p2[14]) return false; [[fallthrough]];
|
||||
case 14: if (p1[13] != p2[13]) return false; [[fallthrough]];
|
||||
case 13: if (p1[12] != p2[12]) return false; [[fallthrough]];
|
||||
case 12: if (reinterpret_cast<const uint32_t *>(p1)[2] == reinterpret_cast<const uint32_t *>(p2)[2]) goto l8; else return false;
|
||||
case 12: if (unalignedLoad<uint32_t>(p1 + 8) == unalignedLoad<uint32_t>(p2 + 8)) goto l8; else return false;
|
||||
case 11: if (p1[10] != p2[10]) return false; [[fallthrough]];
|
||||
case 10: if (p1[9] != p2[9]) return false; [[fallthrough]];
|
||||
case 9: if (p1[8] != p2[8]) return false;
|
||||
l8: [[fallthrough]];
|
||||
case 8: return reinterpret_cast<const UInt64 *>(p1)[0] == reinterpret_cast<const UInt64 *>(p2)[0];
|
||||
case 8: return unalignedLoad<uint64_t>(p1) == unalignedLoad<uint64_t>(p2);
|
||||
case 7: if (p1[6] != p2[6]) return false; [[fallthrough]];
|
||||
case 6: if (p1[5] != p2[5]) return false; [[fallthrough]];
|
||||
case 5: if (p1[4] != p2[4]) return false; [[fallthrough]];
|
||||
case 4: return reinterpret_cast<const uint32_t *>(p1)[0] == reinterpret_cast<const uint32_t *>(p2)[0];
|
||||
case 4: return unalignedLoad<uint32_t>(p1) == unalignedLoad<uint32_t>(p2);
|
||||
case 3: if (p1[2] != p2[2]) return false; [[fallthrough]];
|
||||
case 2: return reinterpret_cast<const uint16_t *>(p1)[0] == reinterpret_cast<const uint16_t *>(p2)[0];
|
||||
case 2: return unalignedLoad<uint16_t>(p1) == unalignedLoad<uint16_t>(p2);
|
||||
case 1: if (p1[0] != p2[0]) return false; [[fallthrough]];
|
||||
case 0: break;
|
||||
}
|
||||
|
@ -34,6 +34,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
typedef __attribute__((__aligned__(1))) uint16_t uint16_unaligned_t;
|
||||
typedef __attribute__((__aligned__(1))) uint32_t uint32_unaligned_t;
|
||||
typedef __attribute__((__aligned__(1))) uint64_t uint64_unaligned_t;
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// fast copy for different sizes
|
||||
@ -103,97 +108,97 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 66:
|
||||
memcpy_sse2_64(dd - 66, ss - 66);
|
||||
case 2:
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 67:
|
||||
memcpy_sse2_64(dd - 67, ss - 67);
|
||||
case 3:
|
||||
*((uint16_t*)(dd - 3)) = *((uint16_t*)(ss - 3));
|
||||
*((uint16_unaligned_t*)(dd - 3)) = *((uint16_unaligned_t*)(ss - 3));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
case 68:
|
||||
memcpy_sse2_64(dd - 68, ss - 68);
|
||||
case 4:
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 69:
|
||||
memcpy_sse2_64(dd - 69, ss - 69);
|
||||
case 5:
|
||||
*((uint32_t*)(dd - 5)) = *((uint32_t*)(ss - 5));
|
||||
*((uint32_unaligned_t*)(dd - 5)) = *((uint32_unaligned_t*)(ss - 5));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
case 70:
|
||||
memcpy_sse2_64(dd - 70, ss - 70);
|
||||
case 6:
|
||||
*((uint32_t*)(dd - 6)) = *((uint32_t*)(ss - 6));
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint32_unaligned_t*)(dd - 6)) = *((uint32_unaligned_t*)(ss - 6));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 71:
|
||||
memcpy_sse2_64(dd - 71, ss - 71);
|
||||
case 7:
|
||||
*((uint32_t*)(dd - 7)) = *((uint32_t*)(ss - 7));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 7)) = *((uint32_unaligned_t*)(ss - 7));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 72:
|
||||
memcpy_sse2_64(dd - 72, ss - 72);
|
||||
case 8:
|
||||
*((uint64_t*)(dd - 8)) = *((uint64_t*)(ss - 8));
|
||||
*((uint64_unaligned_t*)(dd - 8)) = *((uint64_unaligned_t*)(ss - 8));
|
||||
break;
|
||||
|
||||
case 73:
|
||||
memcpy_sse2_64(dd - 73, ss - 73);
|
||||
case 9:
|
||||
*((uint64_t*)(dd - 9)) = *((uint64_t*)(ss - 9));
|
||||
*((uint64_unaligned_t*)(dd - 9)) = *((uint64_unaligned_t*)(ss - 9));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
case 74:
|
||||
memcpy_sse2_64(dd - 74, ss - 74);
|
||||
case 10:
|
||||
*((uint64_t*)(dd - 10)) = *((uint64_t*)(ss - 10));
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint64_unaligned_t*)(dd - 10)) = *((uint64_unaligned_t*)(ss - 10));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 75:
|
||||
memcpy_sse2_64(dd - 75, ss - 75);
|
||||
case 11:
|
||||
*((uint64_t*)(dd - 11)) = *((uint64_t*)(ss - 11));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint64_unaligned_t*)(dd - 11)) = *((uint64_unaligned_t*)(ss - 11));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 76:
|
||||
memcpy_sse2_64(dd - 76, ss - 76);
|
||||
case 12:
|
||||
*((uint64_t*)(dd - 12)) = *((uint64_t*)(ss - 12));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint64_unaligned_t*)(dd - 12)) = *((uint64_unaligned_t*)(ss - 12));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 77:
|
||||
memcpy_sse2_64(dd - 77, ss - 77);
|
||||
case 13:
|
||||
*((uint64_t*)(dd - 13)) = *((uint64_t*)(ss - 13));
|
||||
*((uint32_t*)(dd - 5)) = *((uint32_t*)(ss - 5));
|
||||
*((uint64_unaligned_t*)(dd - 13)) = *((uint64_unaligned_t*)(ss - 13));
|
||||
*((uint32_unaligned_t*)(dd - 5)) = *((uint32_unaligned_t*)(ss - 5));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
case 78:
|
||||
memcpy_sse2_64(dd - 78, ss - 78);
|
||||
case 14:
|
||||
*((uint64_t*)(dd - 14)) = *((uint64_t*)(ss - 14));
|
||||
*((uint64_t*)(dd - 8)) = *((uint64_t*)(ss - 8));
|
||||
*((uint64_unaligned_t*)(dd - 14)) = *((uint64_unaligned_t*)(ss - 14));
|
||||
*((uint64_unaligned_t*)(dd - 8)) = *((uint64_unaligned_t*)(ss - 8));
|
||||
break;
|
||||
|
||||
case 79:
|
||||
memcpy_sse2_64(dd - 79, ss - 79);
|
||||
case 15:
|
||||
*((uint64_t*)(dd - 15)) = *((uint64_t*)(ss - 15));
|
||||
*((uint64_t*)(dd - 8)) = *((uint64_t*)(ss - 8));
|
||||
*((uint64_unaligned_t*)(dd - 15)) = *((uint64_unaligned_t*)(ss - 15));
|
||||
*((uint64_unaligned_t*)(dd - 8)) = *((uint64_unaligned_t*)(ss - 8));
|
||||
break;
|
||||
|
||||
case 80:
|
||||
@ -213,14 +218,14 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 82, ss - 82);
|
||||
case 18:
|
||||
memcpy_sse2_16(dd - 18, ss - 18);
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 83:
|
||||
memcpy_sse2_64(dd - 83, ss - 83);
|
||||
case 19:
|
||||
memcpy_sse2_16(dd - 19, ss - 19);
|
||||
*((uint16_t*)(dd - 3)) = *((uint16_t*)(ss - 3));
|
||||
*((uint16_unaligned_t*)(dd - 3)) = *((uint16_unaligned_t*)(ss - 3));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -228,14 +233,14 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 84, ss - 84);
|
||||
case 20:
|
||||
memcpy_sse2_16(dd - 20, ss - 20);
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 85:
|
||||
memcpy_sse2_64(dd - 85, ss - 85);
|
||||
case 21:
|
||||
memcpy_sse2_16(dd - 21, ss - 21);
|
||||
*((uint32_t*)(dd - 5)) = *((uint32_t*)(ss - 5));
|
||||
*((uint32_unaligned_t*)(dd - 5)) = *((uint32_unaligned_t*)(ss - 5));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -243,16 +248,16 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 86, ss - 86);
|
||||
case 22:
|
||||
memcpy_sse2_16(dd - 22, ss - 22);
|
||||
*((uint32_t*)(dd - 6)) = *((uint32_t*)(ss - 6));
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint32_unaligned_t*)(dd - 6)) = *((uint32_unaligned_t*)(ss - 6));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 87:
|
||||
memcpy_sse2_64(dd - 87, ss - 87);
|
||||
case 23:
|
||||
memcpy_sse2_16(dd - 23, ss - 23);
|
||||
*((uint32_t*)(dd - 7)) = *((uint32_t*)(ss - 7));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 7)) = *((uint32_unaligned_t*)(ss - 7));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 88:
|
||||
@ -328,14 +333,14 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 98, ss - 98);
|
||||
case 34:
|
||||
memcpy_sse2_32(dd - 34, ss - 34);
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 99:
|
||||
memcpy_sse2_64(dd - 99, ss - 99);
|
||||
case 35:
|
||||
memcpy_sse2_32(dd - 35, ss - 35);
|
||||
*((uint16_t*)(dd - 3)) = *((uint16_t*)(ss - 3));
|
||||
*((uint16_unaligned_t*)(dd - 3)) = *((uint16_unaligned_t*)(ss - 3));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -343,14 +348,14 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 100, ss - 100);
|
||||
case 36:
|
||||
memcpy_sse2_32(dd - 36, ss - 36);
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 101:
|
||||
memcpy_sse2_64(dd - 101, ss - 101);
|
||||
case 37:
|
||||
memcpy_sse2_32(dd - 37, ss - 37);
|
||||
*((uint32_t*)(dd - 5)) = *((uint32_t*)(ss - 5));
|
||||
*((uint32_unaligned_t*)(dd - 5)) = *((uint32_unaligned_t*)(ss - 5));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -358,30 +363,30 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 102, ss - 102);
|
||||
case 38:
|
||||
memcpy_sse2_32(dd - 38, ss - 38);
|
||||
*((uint32_t*)(dd - 6)) = *((uint32_t*)(ss - 6));
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint32_unaligned_t*)(dd - 6)) = *((uint32_unaligned_t*)(ss - 6));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 103:
|
||||
memcpy_sse2_64(dd - 103, ss - 103);
|
||||
case 39:
|
||||
memcpy_sse2_32(dd - 39, ss - 39);
|
||||
*((uint32_t*)(dd - 7)) = *((uint32_t*)(ss - 7));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 7)) = *((uint32_unaligned_t*)(ss - 7));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 104:
|
||||
memcpy_sse2_64(dd - 104, ss - 104);
|
||||
case 40:
|
||||
memcpy_sse2_32(dd - 40, ss - 40);
|
||||
*((uint64_t*)(dd - 8)) = *((uint64_t*)(ss - 8));
|
||||
*((uint64_unaligned_t*)(dd - 8)) = *((uint64_unaligned_t*)(ss - 8));
|
||||
break;
|
||||
|
||||
case 105:
|
||||
memcpy_sse2_64(dd - 105, ss - 105);
|
||||
case 41:
|
||||
memcpy_sse2_32(dd - 41, ss - 41);
|
||||
*((uint64_t*)(dd - 9)) = *((uint64_t*)(ss - 9));
|
||||
*((uint64_unaligned_t*)(dd - 9)) = *((uint64_unaligned_t*)(ss - 9));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -389,32 +394,32 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 106, ss - 106);
|
||||
case 42:
|
||||
memcpy_sse2_32(dd - 42, ss - 42);
|
||||
*((uint64_t*)(dd - 10)) = *((uint64_t*)(ss - 10));
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint64_unaligned_t*)(dd - 10)) = *((uint64_unaligned_t*)(ss - 10));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 107:
|
||||
memcpy_sse2_64(dd - 107, ss - 107);
|
||||
case 43:
|
||||
memcpy_sse2_32(dd - 43, ss - 43);
|
||||
*((uint64_t*)(dd - 11)) = *((uint64_t*)(ss - 11));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint64_unaligned_t*)(dd - 11)) = *((uint64_unaligned_t*)(ss - 11));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 108:
|
||||
memcpy_sse2_64(dd - 108, ss - 108);
|
||||
case 44:
|
||||
memcpy_sse2_32(dd - 44, ss - 44);
|
||||
*((uint64_t*)(dd - 12)) = *((uint64_t*)(ss - 12));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint64_unaligned_t*)(dd - 12)) = *((uint64_unaligned_t*)(ss - 12));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 109:
|
||||
memcpy_sse2_64(dd - 109, ss - 109);
|
||||
case 45:
|
||||
memcpy_sse2_32(dd - 45, ss - 45);
|
||||
*((uint64_t*)(dd - 13)) = *((uint64_t*)(ss - 13));
|
||||
*((uint32_t*)(dd - 5)) = *((uint32_t*)(ss - 5));
|
||||
*((uint64_unaligned_t*)(dd - 13)) = *((uint64_unaligned_t*)(ss - 13));
|
||||
*((uint32_unaligned_t*)(dd - 5)) = *((uint32_unaligned_t*)(ss - 5));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -422,16 +427,16 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
memcpy_sse2_64(dd - 110, ss - 110);
|
||||
case 46:
|
||||
memcpy_sse2_32(dd - 46, ss - 46);
|
||||
*((uint64_t*)(dd - 14)) = *((uint64_t*)(ss - 14));
|
||||
*((uint64_t*)(dd - 8)) = *((uint64_t*)(ss - 8));
|
||||
*((uint64_unaligned_t*)(dd - 14)) = *((uint64_unaligned_t*)(ss - 14));
|
||||
*((uint64_unaligned_t*)(dd - 8)) = *((uint64_unaligned_t*)(ss - 8));
|
||||
break;
|
||||
|
||||
case 111:
|
||||
memcpy_sse2_64(dd - 111, ss - 111);
|
||||
case 47:
|
||||
memcpy_sse2_32(dd - 47, ss - 47);
|
||||
*((uint64_t*)(dd - 15)) = *((uint64_t*)(ss - 15));
|
||||
*((uint64_t*)(dd - 8)) = *((uint64_t*)(ss - 8));
|
||||
*((uint64_unaligned_t*)(dd - 15)) = *((uint64_unaligned_t*)(ss - 15));
|
||||
*((uint64_unaligned_t*)(dd - 8)) = *((uint64_unaligned_t*)(ss - 8));
|
||||
break;
|
||||
|
||||
case 112:
|
||||
@ -454,7 +459,7 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 50:
|
||||
memcpy_sse2_32(dd - 50, ss - 50);
|
||||
memcpy_sse2_16(dd - 18, ss - 18);
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 115:
|
||||
@ -462,7 +467,7 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 51:
|
||||
memcpy_sse2_32(dd - 51, ss - 51);
|
||||
memcpy_sse2_16(dd - 19, ss - 19);
|
||||
*((uint16_t*)(dd - 3)) = *((uint16_t*)(ss - 3));
|
||||
*((uint16_unaligned_t*)(dd - 3)) = *((uint16_unaligned_t*)(ss - 3));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -471,7 +476,7 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 52:
|
||||
memcpy_sse2_32(dd - 52, ss - 52);
|
||||
memcpy_sse2_16(dd - 20, ss - 20);
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 117:
|
||||
@ -479,7 +484,7 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 53:
|
||||
memcpy_sse2_32(dd - 53, ss - 53);
|
||||
memcpy_sse2_16(dd - 21, ss - 21);
|
||||
*((uint32_t*)(dd - 5)) = *((uint32_t*)(ss - 5));
|
||||
*((uint32_unaligned_t*)(dd - 5)) = *((uint32_unaligned_t*)(ss - 5));
|
||||
dd[-1] = ss[-1];
|
||||
break;
|
||||
|
||||
@ -488,8 +493,8 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 54:
|
||||
memcpy_sse2_32(dd - 54, ss - 54);
|
||||
memcpy_sse2_16(dd - 22, ss - 22);
|
||||
*((uint32_t*)(dd - 6)) = *((uint32_t*)(ss - 6));
|
||||
*((uint16_t*)(dd - 2)) = *((uint16_t*)(ss - 2));
|
||||
*((uint32_unaligned_t*)(dd - 6)) = *((uint32_unaligned_t*)(ss - 6));
|
||||
*((uint16_unaligned_t*)(dd - 2)) = *((uint16_unaligned_t*)(ss - 2));
|
||||
break;
|
||||
|
||||
case 119:
|
||||
@ -497,8 +502,8 @@ static INLINE void *memcpy_tiny(void *dst, const void *src, size_t size) {
|
||||
case 55:
|
||||
memcpy_sse2_32(dd - 55, ss - 55);
|
||||
memcpy_sse2_16(dd - 23, ss - 23);
|
||||
*((uint32_t*)(dd - 7)) = *((uint32_t*)(ss - 7));
|
||||
*((uint32_t*)(dd - 4)) = *((uint32_t*)(ss - 4));
|
||||
*((uint32_unaligned_t*)(dd - 7)) = *((uint32_unaligned_t*)(ss - 7));
|
||||
*((uint32_unaligned_t*)(dd - 4)) = *((uint32_unaligned_t*)(ss - 4));
|
||||
break;
|
||||
|
||||
case 120:
|
||||
|
Loading…
Reference in New Issue
Block a user