Skip to content

Commit 0b7eb54

Browse files
authored
disable 'snapshot' mode for create query (#369)
1 parent 8230ad1 commit 0b7eb54

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/Interpreters/executeQuery.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
488488
begin = recovered_query.data();
489489
end = recovered_query.data() + recovered_query.size();
490490
}
491+
492+
/// In snapshot mode, all stream query (except create query) will be executed in 'table' mode
493+
if (settings.query_mode.value == "snapshot")
494+
context->setSetting("query_mode", ast->as<ASTCreateQuery>() ? Field{"stream"} : Field{"table"});
491495
/// proton: ends
492496

493497
if (auto txn = context->getCurrentTransaction())

src/Server/HTTPHandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,9 @@ bool DynamicQueryHandler::customizeQueryParam(ContextMutablePtr context, const s
990990
std::string DynamicQueryHandler::getQuery(HTTPServerRequest & request, HTMLForm & params, ContextMutablePtr context)
991991
{
992992
/// proton: starts
993-
/// set query_mode to 'table' if snapshot_mode is on
993+
/// set query_mode to 'snapshot' if snapshot_mode is on
994994
if (snapshot_mode)
995-
context->setSetting("query_mode", Field("table"));
995+
context->setSetting("query_mode", Field("snapshot"));
996996
/// proton: ends
997997

998998
if (likely(!startsWith(request.getContentType(), "multipart/form-data")))

src/Server/TCPHandler.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,11 +1390,9 @@ void TCPHandler::receiveQuery()
13901390
}
13911391
query_context->applySettingsChanges(settings_changes);
13921392

1393-
/// If TCP server runs in snapshot mode, all stream query will be executed in 'hist' mode mode
1393+
/// set query_mode to 'snapshot' if snapshot_mode is on
13941394
if (snapshot_mode)
1395-
{
1396-
query_context->setSetting("query_mode", Field{"table"});
1397-
}
1395+
query_context->setSetting("query_mode", Field{"snapshot"});
13981396

13991397
/// Use the received query id, or generate a random default. It is convenient
14001398
/// to also generate the default OpenTelemetry trace id at the same time, and

0 commit comments

Comments
 (0)