text stringlengths 19 585k | label stringclasses 2
values | category stringclasses 2
values | language stringclasses 14
values | repo stringclasses 932
values | sha stringlengths 40 40 |
|---|---|---|---|---|---|
@@ -0,0 +1,419 @@
+#include <Common/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/Exception.h>
+#include <Common/FailPoint.h>
+#include <Co... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,108 @@
+#include <Common/OOMCanaryExitCodes.h>
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h> | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,133 @@
+import time
+from dataclasses import dataclass
+
+import pytest
+
+from helpers.cluster import ClickHouseCluster
+
+
+@dataclass(frozen=True)
+class CanaryProcess:
+ pid: int
+ start: str
+
+cluster = ClickHouseCluster(__file__)
+
+# Canary enabled
+node_enabled = cluster.add_instance(
+ "en... | bad | review | python | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/tests/integration/test_oom_canary/test.py b/tests/integration/test_oom_canary/test.py
new file mode 100644
index 000000000000..149f61b5f84d
--- /dev/null
+++ b/tests/integration/test_oom_canary/test.py
@@ -0,0 +1,156 @@
+import threading
+import time
+import uuid
+from dataclasses import dataclass
+
+impor... | good | review_fixed | python | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,120 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,120 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,112 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <csignal>
+#i... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,112 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <csignal>
+#i... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,112 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <csignal>
+#i... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,112 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <csignal>
+#i... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -3252,6 +3296,8 @@ try
else
global_context->cancelAllBackupsAndRestores();
+ stop_oom_canary(); | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp
index 8343f9411dbc..c56d0593780f 100644
--- a/programs/server/Server.cpp
+++ b/programs/server/Server.cpp
@@ -31,6 +31,7 @@
#include <Common/CurrentMemoryTracker.h>
#include <Common/MemoryTracker.h>
#include <Common/MemoryWorker.h>
+#include <Commo... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -111,6 +111,8 @@ add_headers_and_sources(clickhouse_common_io IO/AzureBlobStorage)
add_headers_and_sources(clickhouse_common_io Disks/DiskObjectStorage/ObjectStorages/AzureBlobStorage)
list (REMOVE_ITEM clickhouse_common_io_sources Common/malloc.cpp Common/AllocationInterceptors.cpp)
list (REMOVE_ITEM clickhouse_... | bad | review | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 | |
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ab469adee233..7e7318e148d3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -153,6 +153,7 @@ add_headers_and_sources(dbms Storages/ObjectStorage/DataLakes/Iceberg)
add_headers_and_sources(dbms Storages/ObjectStorage/DataLakes/DeltaLake)
add_headers... | good | review_fixed | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 | |
@@ -1495,6 +1495,38 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(Int32, oom_score, getDefaultOomScore(), R"(On Linux systems this can control the behavior of OOM killer.)", 0) \
+ DECLARE(Bool, allow_experimental_oom_canary, false, R"( | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp
index ee0a3d9a0d13..a818c288cec6 100644
--- a/src/Core/ServerSettings.cpp
+++ b/src/Core/ServerSettings.cpp
@@ -1505,6 +1505,45 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(I... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,395 @@
+#include <Common/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
+#include ... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -177,6 +177,7 @@ static struct InitFiu
REGULAR(check_database_datalake_negative) \
REGULAR(restart_replica_fail_after_detach) \
REGULAR(database_replicated_force_metadata_digest_check) \
+ REGULAR(oom_canary_force_oom_evidence) \ | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/FailPoint.cpp b/src/Common/FailPoint.cpp
index e5ff1302db09..d89c04afd094 100644
--- a/src/Common/FailPoint.cpp
+++ b/src/Common/FailPoint.cpp
@@ -179,6 +179,7 @@ static struct InitFiu
REGULAR(check_database_datalake_negative) \
REGULAR(restart_replica_fail_after_detach) \
REGULAR... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,112 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <csignal>
+#i... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -1495,6 +1495,33 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(Int32, oom_score, getDefaultOomScore(), R"(On Linux systems this can control the behavior of OOM killer.)", 0) \
+ DECLARE(Bool, oom_canary_enable, false, R"(
+ Experimental.... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp
index ee0a3d9a0d13..a818c288cec6 100644
--- a/src/Core/ServerSettings.cpp
+++ b/src/Core/ServerSettings.cpp
@@ -1505,6 +1505,45 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(I... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -1505,6 +1505,33 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(Int32, oom_score, getDefaultOomScore(), R"(On Linux systems this can control the behavior of OOM killer.)", 0) \
+ DECLARE(Bool, oom_canary_enable, false, R"(
+ Experimental.... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp
index ee0a3d9a0d13..a818c288cec6 100644
--- a/src/Core/ServerSettings.cpp
+++ b/src/Core/ServerSettings.cpp
@@ -1505,6 +1505,45 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(I... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,398 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,395 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,127 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <IO/ReadHelpers.h>
+#include <IO/WriteBufferFromFile.h>
+#include <IO/WriteHelpers.h>
+
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <fmt/format.h... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/programs/oom-canary/OomCanary.cpp b/programs/oom-canary/OomCanary.cpp
new file mode 100644
index 000000000000..343410e486d6
--- /dev/null
+++ b/programs/oom-canary/OomCanary.cpp
@@ -0,0 +1,144 @@
+#include <Common/OOMCanaryExitCodes.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Exception.h>
+#include <IO... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -1505,6 +1505,33 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(Int32, oom_score, getDefaultOomScore(), R"(On Linux systems this can control the behavior of OOM killer.)", 0) \
+ DECLARE(Bool, oom_canary_enable, false, R"(
+ Experimental.... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp
index ee0a3d9a0d13..a818c288cec6 100644
--- a/src/Core/ServerSettings.cpp
+++ b/src/Core/ServerSettings.cpp
@@ -1505,6 +1505,45 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(I... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -1505,6 +1505,33 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(Int32, oom_score, getDefaultOomScore(), R"(On Linux systems this can control the behavior of OOM killer.)", 0) \
+ DECLARE(Bool, oom_canary_enable, false, R"(
+ Experimental.... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp
index ee0a3d9a0d13..a818c288cec6 100644
--- a/src/Core/ServerSettings.cpp
+++ b/src/Core/ServerSettings.cpp
@@ -1505,6 +1505,45 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(I... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -1505,6 +1505,33 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(Int32, oom_score, getDefaultOomScore(), R"(On Linux systems this can control the behavior of OOM killer.)", 0) \
+ DECLARE(Bool, oom_canary_enable, false, R"(
+ Experimental.... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp
index ee0a3d9a0d13..a818c288cec6 100644
--- a/src/Core/ServerSettings.cpp
+++ b/src/Core/ServerSettings.cpp
@@ -1505,6 +1505,45 @@ The policy on how to perform a scheduling of CPU slots specified by `concurrent_
```
)", 0) \
DECLARE(I... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,421 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,421 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,430 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,431 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -0,0 +1,471 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Common/OOMCanaryExitCodes.h>
+#include <Common/logger_useful.h>
+#include <Common/waitForPid.h>
+#include <Common/CurrentThread.h>
+#include <Common/ThreadStatus.h>
+#include <Common/Exception.h>
... | bad | review | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
diff --git a/src/Common/OOMCanary/OOMCanary.cpp b/src/Common/OOMCanary/OOMCanary.cpp
new file mode 100644
index 000000000000..69f795a2ba0e
--- /dev/null
+++ b/src/Common/OOMCanary/OOMCanary.cpp
@@ -0,0 +1,476 @@
+#include <Common/OOMCanary/OOMCanary.h>
+
+#if defined(OS_LINUX)
+
+#include <Common/Epoll.h>
+#include <Co... | good | review_fixed | cpp | ClickHouse/ClickHouse | f6a6dce6c24bdd0f8a3630844943a0a43218c964 |
@@ -15,6 +15,11 @@ Contains the list of database engines supported by the server.
<!--AUTOGENERATED_START-->
- `name` ([String](/sql-reference/data-types/string)) — The name of database engine.
+- `description` ([String](/sql-reference/data-types/string)) — A high-level description of what the database engine does. | bad | review | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 | |
diff --git a/docs/en/operations/system-tables/database_engines.md b/docs/en/operations/system-tables/database_engines.md
index 5f81c82f64c7..7ad26216b5ae 100644
--- a/docs/en/operations/system-tables/database_engines.md
+++ b/docs/en/operations/system-tables/database_engines.md
@@ -15,20 +15,25 @@ Contains the list of ... | good | review_fixed | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 | |
@@ -666,7 +666,159 @@ void registerDatabaseMySQL(DatabaseFactory & factory)
.supports_settings = true,
.is_external = true,
.source_access_type = AccessTypeObjects::Source::MYSQL,
- });
+ }, Documentation{
+ .description = R"DOCS_MD(
+import CloudNotSupportedBadge from '@theme/ba... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/MySQL/DatabaseMySQL.cpp b/src/Databases/MySQL/DatabaseMySQL.cpp
index 0c798900f1b6..a9494fa2abd3 100644
--- a/src/Databases/MySQL/DatabaseMySQL.cpp
+++ b/src/Databases/MySQL/DatabaseMySQL.cpp
@@ -667,7 +667,176 @@ void registerDatabaseMySQL(DatabaseFactory & factory)
.supports_settin... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -268,6 +268,9 @@ void registerDatabaseFilesystem(DatabaseFactory & factory)
.supports_arguments = true,
.is_external = true,
.source_access_type = AccessTypeObjects::Source::FILE,
- });
+ }, Documentation{
+ .description = "A read-only database that exposes files in a director... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/DatabaseFilesystem.cpp b/src/Databases/DatabaseFilesystem.cpp
index f85f41e81d93..0f6173cb8615 100644
--- a/src/Databases/DatabaseFilesystem.cpp
+++ b/src/Databases/DatabaseFilesystem.cpp
@@ -268,6 +268,9 @@ void registerDatabaseFilesystem(DatabaseFactory & factory)
.supports_argumen... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -15,12 +15,17 @@ Contains the list of database engines supported by the server.
<!--AUTOGENERATED_START-->
- `name` ([String](/sql-reference/data-types/string)) — The name of database engine.
+- `description` ([String](/sql-reference/data-types/string)) — A high-level description of what the database engine does... | bad | review | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 | |
diff --git a/docs/en/operations/system-tables/database_engines.md b/docs/en/operations/system-tables/database_engines.md
index 5f81c82f64c7..7ad26216b5ae 100644
--- a/docs/en/operations/system-tables/database_engines.md
+++ b/docs/en/operations/system-tables/database_engines.md
@@ -15,20 +15,25 @@ Contains the list of ... | good | review_fixed | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 | |
@@ -482,7 +482,111 @@ void registerDatabaseBackup(DatabaseFactory & factory)
return std::make_shared<DatabaseBackup>(args.database_name, args.metadata_path, config, args.context);
};
- factory.registerDatabase("Backup", create_fn, {.supports_arguments = true, .is_external = true});
+ factory.regis... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/DatabaseBackup.cpp b/src/Databases/DatabaseBackup.cpp
index 74b63d8150db..a60fb82f166a 100644
--- a/src/Databases/DatabaseBackup.cpp
+++ b/src/Databases/DatabaseBackup.cpp
@@ -482,7 +482,106 @@ void registerDatabaseBackup(DatabaseFactory & factory)
return std::make_shared<DatabaseBac... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -482,7 +482,111 @@ void registerDatabaseBackup(DatabaseFactory & factory)
return std::make_shared<DatabaseBackup>(args.database_name, args.metadata_path, config, args.context);
};
- factory.registerDatabase("Backup", create_fn, {.supports_arguments = true, .is_external = true});
+ factory.regis... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/DatabaseBackup.cpp b/src/Databases/DatabaseBackup.cpp
index 74b63d8150db..a60fb82f166a 100644
--- a/src/Databases/DatabaseBackup.cpp
+++ b/src/Databases/DatabaseBackup.cpp
@@ -482,7 +482,106 @@ void registerDatabaseBackup(DatabaseFactory & factory)
return std::make_shared<DatabaseBac... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -667,7 +667,159 @@ void registerDatabaseMySQL(DatabaseFactory & factory)
.supports_settings = true,
.is_external = true,
.source_access_type = AccessTypeObjects::Source::MYSQL,
- });
+ }, Documentation{
+ .description = R"DOCS_MD(
+import CloudNotSupportedBadge from '@theme/ba... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/MySQL/DatabaseMySQL.cpp b/src/Databases/MySQL/DatabaseMySQL.cpp
index 0c798900f1b6..a9494fa2abd3 100644
--- a/src/Databases/MySQL/DatabaseMySQL.cpp
+++ b/src/Databases/MySQL/DatabaseMySQL.cpp
@@ -667,7 +667,176 @@ void registerDatabaseMySQL(DatabaseFactory & factory)
.supports_settin... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -568,7 +568,299 @@ void registerDatabaseMaterializedPostgreSQL(DatabaseFactory & factory)
.supports_table_overrides = true,
.is_external = true,
.source_access_type = AccessTypeObjects::Source::POSTGRES,
- });
+ }, Documentation{
+ .description = R"DOCS_MD(
+import Experimenta... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp
index 4031b373efb3..b17234d69570 100644
--- a/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp
+++ b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp
@@ -568,7 +56... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -482,7 +482,104 @@ void registerDatabaseBackup(DatabaseFactory & factory)
return std::make_shared<DatabaseBackup>(args.database_name, args.metadata_path, config, args.context);
};
- factory.registerDatabase("Backup", create_fn, {.supports_arguments = true, .is_external = true});
+ factory.regis... | bad | review | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
diff --git a/src/Databases/DatabaseBackup.cpp b/src/Databases/DatabaseBackup.cpp
index 74b63d8150db..a60fb82f166a 100644
--- a/src/Databases/DatabaseBackup.cpp
+++ b/src/Databases/DatabaseBackup.cpp
@@ -482,7 +482,106 @@ void registerDatabaseBackup(DatabaseFactory & factory)
return std::make_shared<DatabaseBac... | good | review_fixed | cpp | ClickHouse/ClickHouse | 64398d8d8d683085114dd085d2c89e005c18fea6 |
@@ -87,6 +87,22 @@ size_t tryExecuteFunctionsAfterSorting(QueryPlan::Node * parent_node, QueryPlan:
if (unneeded_for_sorting.trivial())
return 0;
+ /// `arrayJoin` can change the number of rows produced by an expression.
+ /// Lifting it above the `SortingStep` is unsound when the sort has a
+ ... | bad | review | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
diff --git a/src/Processors/QueryPlan/Optimizations/liftUpFunctions.cpp b/src/Processors/QueryPlan/Optimizations/liftUpFunctions.cpp
index 68caafdb1b16..c43296be1aff 100644
--- a/src/Processors/QueryPlan/Optimizations/liftUpFunctions.cpp
+++ b/src/Processors/QueryPlan/Optimizations/liftUpFunctions.cpp
@@ -87,6 +87,22 @... | good | review_fixed | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
@@ -0,0 +1,33 @@
+-- Regression test for https://github.com/ClickHouse/ClickHouse/issues/82279
+-- (LIMIT BY variant uncovered by the original PR #104558).
+--
+-- `pushLimitByIntoSort` would attach a per-stream `LimitByTransform` to a
+-- `SortingStep` that has `arrayJoin` lifted above it. The per-stream hint
+-- trun... | bad | review | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 | |
diff --git a/tests/queries/0_stateless/04318_arrayjoin_after_sort_with_limit_by.sql b/tests/queries/0_stateless/04318_arrayjoin_after_sort_with_limit_by.sql
new file mode 100644
index 000000000000..607f77415449
--- /dev/null
+++ b/tests/queries/0_stateless/04318_arrayjoin_after_sort_with_limit_by.sql
@@ -0,0 +1,42 @@
+... | good | review_fixed | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 | |
@@ -0,0 +1,63 @@
+-- Regression test for https://github.com/ClickHouse/ClickHouse/issues/82279
+-- The `tryExecuteFunctionsAfterSorting` optimization in
+-- `liftUpFunctions.cpp` used to lift expressions above the `SortingStep`
+-- even when those expressions contained `arrayJoin`. With a `LIMIT`
+-- pushed down into t... | bad | review | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 | |
diff --git a/tests/queries/0_stateless/04220_arrayjoin_after_sort_with_limit.sql b/tests/queries/0_stateless/04220_arrayjoin_after_sort_with_limit.sql
new file mode 100644
index 000000000000..3e1e2f1a870d
--- /dev/null
+++ b/tests/queries/0_stateless/04220_arrayjoin_after_sort_with_limit.sql
@@ -0,0 +1,63 @@
+-- Regres... | good | review_fixed | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 | |
@@ -74,6 +88,15 @@ bool shouldPushdownLimit(const SelectQueryInfo & query_info, const InterpreterSe
const auto & query = query_info.query->as<ASTSelectQuery &>();
+ /// `arrayJoin` in the SELECT clause changes row cardinality after the source has run.
+ /// Pushing the outer `LIMIT` into the source would... | bad | review | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
diff --git a/src/Processors/QueryPlan/numbersLikeUtils.cpp b/src/Processors/QueryPlan/numbersLikeUtils.cpp
index 8536d181b9d7..55e6221a3bd3 100644
--- a/src/Processors/QueryPlan/numbersLikeUtils.cpp
+++ b/src/Processors/QueryPlan/numbersLikeUtils.cpp
@@ -4,6 +4,7 @@
#include <Core/Settings.h>
#include <Interpreters... | good | review_fixed | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
@@ -74,6 +88,23 @@ bool shouldPushdownLimit(const SelectQueryInfo & query_info, const InterpreterSe
const auto & query = query_info.query->as<ASTSelectQuery &>();
+ /// `arrayJoin` (function or `ARRAY JOIN` clause) changes row cardinality after the
+ /// source has run. Pushing the outer `LIMIT` into the... | bad | review | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
diff --git a/src/Processors/QueryPlan/numbersLikeUtils.cpp b/src/Processors/QueryPlan/numbersLikeUtils.cpp
index 8536d181b9d7..55e6221a3bd3 100644
--- a/src/Processors/QueryPlan/numbersLikeUtils.cpp
+++ b/src/Processors/QueryPlan/numbersLikeUtils.cpp
@@ -4,6 +4,7 @@
#include <Core/Settings.h>
#include <Interpreters... | good | review_fixed | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
@@ -74,6 +88,23 @@ bool shouldPushdownLimit(const SelectQueryInfo & query_info, const InterpreterSe
const auto & query = query_info.query->as<ASTSelectQuery &>();
+ /// `arrayJoin` (function or `ARRAY JOIN` clause) changes row cardinality after the
+ /// source has run. Pushing the outer `LIMIT` into the... | bad | review | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
diff --git a/src/Processors/QueryPlan/numbersLikeUtils.cpp b/src/Processors/QueryPlan/numbersLikeUtils.cpp
index 8536d181b9d7..55e6221a3bd3 100644
--- a/src/Processors/QueryPlan/numbersLikeUtils.cpp
+++ b/src/Processors/QueryPlan/numbersLikeUtils.cpp
@@ -4,6 +4,7 @@
#include <Core/Settings.h>
#include <Interpreters... | good | review_fixed | cpp | ClickHouse/ClickHouse | fab23475deb70684d0dbccc0d18a7e25678d8983 |
@@ -247,6 +248,46 @@ void StorageMemory::checkMutationIsPossible(const MutationCommands & /*commands*
void StorageMemory::mutate(const MutationCommands & commands, ContextPtr context)
{
std::lock_guard lock(mutex);
+
+ /// `Memory` tables hold raw column blocks in RAM and have no on-storage analog of
+ ///... | bad | review | cpp | ClickHouse/ClickHouse | a2562ae47772b1636ed6b807d67418b4153ea9a0 |
diff --git a/src/Storages/StorageMemory.cpp b/src/Storages/StorageMemory.cpp
index f0fc30d478b6..065a3f4fa691 100644
--- a/src/Storages/StorageMemory.cpp
+++ b/src/Storages/StorageMemory.cpp
@@ -249,24 +249,38 @@ void StorageMemory::mutate(const MutationCommands & commands, ContextPtr context
{
std::lock_guard lo... | good | review_fixed | cpp | ClickHouse/ClickHouse | a2562ae47772b1636ed6b807d67418b4153ea9a0 |
@@ -247,6 +248,46 @@ void StorageMemory::checkMutationIsPossible(const MutationCommands & /*commands*
void StorageMemory::mutate(const MutationCommands & commands, ContextPtr context)
{
std::lock_guard lock(mutex);
+
+ /// `Memory` tables hold raw column blocks in RAM and have no on-storage analog of
+ ///... | bad | review | cpp | ClickHouse/ClickHouse | a2562ae47772b1636ed6b807d67418b4153ea9a0 |
diff --git a/src/Storages/StorageMemory.cpp b/src/Storages/StorageMemory.cpp
index f0fc30d478b6..065a3f4fa691 100644
--- a/src/Storages/StorageMemory.cpp
+++ b/src/Storages/StorageMemory.cpp
@@ -249,24 +249,38 @@ void StorageMemory::mutate(const MutationCommands & commands, ContextPtr context
{
std::lock_guard lo... | good | review_fixed | cpp | ClickHouse/ClickHouse | a2562ae47772b1636ed6b807d67418b4153ea9a0 |
@@ -91,38 +91,61 @@ def get_changed_files(cls, strict=False) -> List[str]:
# HEAD, same as deleted files, which were always included.
jq_both_sides = ".filename, (.previous_filename // empty)"
- for attempt in range(3):
- # store changed files
- if info.pr_number > 0:
- ... | bad | review | python | ClickHouse/ClickHouse | 653085058b9b2b5f932c03146f3ed39565d3225f |
diff --git a/ci/praktika/gh.py b/ci/praktika/gh.py
index 90b67d88ced4..6646239ebccc 100644
--- a/ci/praktika/gh.py
+++ b/ci/praktika/gh.py
@@ -91,18 +91,30 @@ def get_changed_files(cls, strict=False) -> List[str]:
# HEAD, same as deleted files, which were always included.
jq_both_sides = ".filename, (... | good | review_fixed | python | ClickHouse/ClickHouse | 653085058b9b2b5f932c03146f3ed39565d3225f |
@@ -70,7 +70,21 @@ class FunctionGetServerSetting final : public IFunction
std::string_view setting_name{column->getDataAt(0)};
- return Context::getGlobalContextInstance()->getServerSettings().get(setting_name);
+ auto global_context = Context::getGlobalContextInstance();
+ const auto... | bad | review | cpp | ClickHouse/ClickHouse | 02ce0c53642fe63bae3648444a0ee19fea98fffb |
diff --git a/src/Functions/getServerSetting.cpp b/src/Functions/getServerSetting.cpp
index 8cdf1110564a..290f54c76d6e 100644
--- a/src/Functions/getServerSetting.cpp
+++ b/src/Functions/getServerSetting.cpp
@@ -70,7 +70,21 @@ class FunctionGetServerSetting final : public IFunction
std::string_view setting_na... | good | review_fixed | cpp | ClickHouse/ClickHouse | 02ce0c53642fe63bae3648444a0ee19fea98fffb |
@@ -164,3 +164,26 @@ Enum values are also convertible to numeric types using the `toT` function, wher
The Enum type can be changed without cost using ALTER, if only the set of values is changed. It is possible to both add and remove members of the Enum using ALTER (removing is safe only if the removed value has never ... | bad | review | ClickHouse/ClickHouse | 07520f54fbc7a36adc637c461574cfc15b3a8c8e | |
diff --git a/docs/en/sql-reference/data-types/enum.md b/docs/en/sql-reference/data-types/enum.md
index 5f330bcd8766..ecbc90e8bc42 100644
--- a/docs/en/sql-reference/data-types/enum.md
+++ b/docs/en/sql-reference/data-types/enum.md
@@ -162,3 +162,26 @@ Enum values are also convertible to numeric types using the `toT` fu... | good | review_fixed | ClickHouse/ClickHouse | 07520f54fbc7a36adc637c461574cfc15b3a8c8e | |
@@ -1363,6 +1373,76 @@ void AlterCommands::prepare(const StorageInMemoryMetadata & metadata)
command.default_expression = column_from_table.default_desc.expression;
}
+ struct EnumTypeInfo
+ {
+ const IDataTypeEnum * enum_type = nu... | bad | review | cpp | ClickHouse/ClickHouse | 07520f54fbc7a36adc637c461574cfc15b3a8c8e |
diff --git a/src/Storages/AlterCommands.cpp b/src/Storages/AlterCommands.cpp
index 3863adc67515..387e0f5e55c2 100644
--- a/src/Storages/AlterCommands.cpp
+++ b/src/Storages/AlterCommands.cpp
@@ -81,6 +81,7 @@ namespace ErrorCodes
extern const int NOT_IMPLEMENTED;
extern const int ALTER_OF_COLUMN_IS_FORBIDDEN;... | good | review_fixed | cpp | ClickHouse/ClickHouse | 07520f54fbc7a36adc637c461574cfc15b3a8c8e |
@@ -0,0 +1,45 @@
+{% for NULLABLE_START, NULLABLE_END in {'' : '', 'Nullable(' : ')'}.items() -%}
+SELECT '======= NULLABLE {{ NULLABLE_START }} {{ NULLABLE_END }} ===============';
+{% for ENUM_TYPE in ['Enum', 'Enum8', 'Enum16'] -%}
+
+SELECT '======= {{ ENUM_TYPE }} ===============';
+DROP TABLE IF EXISTS enum;
+CRE... | bad | review | ClickHouse/ClickHouse | 07520f54fbc7a36adc637c461574cfc15b3a8c8e | |
diff --git a/tests/queries/0_stateless/04307_add_to_enum.sql.j2 b/tests/queries/0_stateless/04307_add_to_enum.sql.j2
new file mode 100644
index 000000000000..250dd7fdf109
--- /dev/null
+++ b/tests/queries/0_stateless/04307_add_to_enum.sql.j2
@@ -0,0 +1,129 @@
+{% for NULLABLE_START, NULLABLE_END in {'' : '', 'Nullable(... | good | review_fixed | ClickHouse/ClickHouse | 07520f54fbc7a36adc637c461574cfc15b3a8c8e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.