Skip to content

Commit 12ed3ab

Browse files
committed
Rollback gzip compression, only keep the setting
Rename `Compress` setting to `Compression`
1 parent 57feeff commit 12ed3ab

File tree

13 files changed

+13
-55
lines changed

13 files changed

+13
-55
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The list of DSN parameters recognized by the driver is as follows:
111111
| `DriverLogFile` | `\temp\clickhouse-odbc-driver.log` on Windows, `/tmp/clickhouse-odbc-driver.log` otherwise | Path to the extended driver log file (used when `DriverLog` is `on`) |
112112
| `AutoSessionId` | `off` | Auto generate session_id required to use some features of CH (e.g. TEMPORARY TABLE) |
113113
| `ClientName` | empty | Sets additional information about the calling application. This string will be used as a prefix for the User-Agent header. |
114-
| `Compress` | `off` | Pass enable_http_compression=1 parameter to server |
114+
| `Compression` | `off` | Enables compression for data sent from ClickHouse to the driver |
115115

116116

117117
### URL query string

driver/config/config.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ key_value_map_t readDSNInfo(const std::string & dsn_utf8) {
254254
INI_DRIVERLOGFILE,
255255
INI_AUTO_SESSION_ID,
256256
INI_CLIENT_NAME,
257-
INI_COMPRESS,
258-
INI_USE_COMPRESSION
257+
INI_COMPRESSION
259258
}
260259
) {
261260
if (

driver/config/ini_defines.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
#define INI_DRIVERLOGFILE "DriverLogFile"
3434
#define INI_AUTO_SESSION_ID "AutoSessionId"
3535
#define INI_CLIENT_NAME "ClientName"
36-
#define INI_COMPRESS "Compress"
37-
#define INI_USE_COMPRESSION "UseCompression"
36+
#define INI_COMPRESSION "Compression"
3837

3938
#if defined(UNICODE)
4039
# define INI_DSN_DEFAULT DSN_DEFAULT_UNICODE
@@ -56,8 +55,7 @@
5655
#define INI_STRINGMAXLENGTH_DEFAULT "1048575"
5756
#define INI_AUTO_SESSION_ID_DEFAULT "off"
5857
#define INI_CLIENT_NAME_DEFAULT ""
59-
#define INI_COMPRESS_DEFAULT "0"
60-
#define INI_USE_COMPRESSION_DEFAULT "0"
58+
#define INI_COMPRESSION_DEFAULT "0"
6159

6260
#ifdef NDEBUG
6361
# define INI_DRIVERLOG_DEFAULT "off"

driver/connection.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ Poco::URI Connection::getUri() const {
105105
else if (Poco::UTF8::icompare(parameter.first, "session_id") == 0 && !parameter.second.empty()) {
106106
session_id_set = true;
107107
}
108+
else if (Poco::UTF8::icompare(parameter.first, "enable_http_compression") == 0 && !parameter.second.empty()) {
109+
enable_http_compression_set = true;
110+
}
108111
}
109112

110113
if (!default_format_set)
@@ -119,6 +122,7 @@ Poco::URI Connection::getUri() const {
119122
uri.addQueryParameter("session_id", session_id);
120123
}
121124

125+
// Add http compression parameter, but only if the parameter is not already defined in the URI
122126
if (enable_http_compression && !enable_http_compression_set) {
123127
uri.addQueryParameter("enable_http_compression", enable_http_compression ? "1" : "0");
124128
}
@@ -414,7 +418,7 @@ void Connection::setConfiguration(const key_value_map_t & cs_fields, const key_v
414418
client_name = value;
415419
}
416420
}
417-
else if (Poco::UTF8::icompare(key, INI_COMPRESS) == 0 || Poco::UTF8::icompare(key, INI_USE_COMPRESSION) == 0) {
421+
else if (Poco::UTF8::icompare(key, INI_COMPRESSION) == 0) {
418422
recognized_key = true;
419423
unsigned int typed_value = 0;
420424
valid_value =
@@ -445,8 +449,6 @@ void Connection::setConfiguration(const key_value_map_t & cs_fields, const key_v
445449
const auto & recognized_key = std::get<0>(res);
446450
const auto & valid_value = std::get<1>(res);
447451

448-
// LOG("DSN: known attribute '" << key << "', valid value, '" << valid_value << "'");
449-
450452
if (recognized_key) {
451453
if (!valid_value)
452454
throw std::runtime_error("DSN: bad value '" + value + "' for attribute '" + key + "'");

driver/format/ODBCDriver2.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,6 @@ ODBCDriver2ResultReader::ODBCDriver2ResultReader(
263263
result_set = std::make_unique<ODBCDriver2ResultSet>(timezone, stream, releaseMutator());
264264
}
265265

266-
ODBCDriver2ResultReader::ODBCDriver2ResultReader(const std::string & timezone_, std::istream & raw_stream, std::unique_ptr<ResultMutator> && mutator, std::unique_ptr<std::istream> && inflating_input_stream)
267-
: ResultReader(timezone_, raw_stream, std::move(mutator), std::move(inflating_input_stream))
268-
{
269-
if (stream.eof())
270-
return;
271-
272-
result_set = std::make_unique<ODBCDriver2ResultSet>(timezone, stream, releaseMutator());
273-
}
274-
275266
bool ODBCDriver2ResultReader::advanceToNextResultSet() {
276267
// ODBCDriver2 format doesn't support multiple result sets in the response,
277268
// so only a basic cleanup is done here.

driver/format/ODBCDriver2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include "driver/platform/platform.h"
34
#include "driver/result_set.h"
45

56
#include <Poco/Net/HTTPClientSession.h>

driver/format/RowBinaryWithNamesAndTypes.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,16 +319,6 @@ RowBinaryWithNamesAndTypesResultReader::RowBinaryWithNamesAndTypesResultReader(
319319
result_set = std::make_unique<RowBinaryWithNamesAndTypesResultSet>(timezone, stream, releaseMutator());
320320
}
321321

322-
RowBinaryWithNamesAndTypesResultReader::RowBinaryWithNamesAndTypesResultReader(const std::string & timezone_, std::istream & raw_stream, std::unique_ptr<ResultMutator> && mutator, std::unique_ptr<std::istream> && inflating_input_stream)
323-
: ResultReader(timezone_, raw_stream, std::move(mutator), std::move(inflating_input_stream))
324-
{
325-
if (stream.eof())
326-
return;
327-
328-
result_set = std::make_unique<RowBinaryWithNamesAndTypesResultSet>(timezone, stream, releaseMutator());
329-
330-
}
331-
332322
bool RowBinaryWithNamesAndTypesResultReader::advanceToNextResultSet() {
333323
// RowBinaryWithNamesAndTypes format doesn't support multiple result sets in the response,
334324
// so only a basic cleanup is done here.

driver/result_set.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "driver/result_set.h"
2-
#include "driver/driver.h"
32
#include "driver/format/ODBCDriver2.h"
43
#include "driver/format/RowBinaryWithNamesAndTypes.h"
54

@@ -314,13 +313,6 @@ ResultReader::ResultReader(
314313
{
315314
}
316315

317-
ResultReader::ResultReader(const std::string & timezone_, std::istream & raw_stream, std::unique_ptr<ResultMutator> && mutator, std::unique_ptr<std::istream> && inflating_input_stream_)
318-
: timezone(timezone_)
319-
, stream(raw_stream, std::move(inflating_input_stream_))
320-
, result_mutator(std::move(mutator))
321-
{
322-
}
323-
324316
bool ResultReader::hasResultSet() const {
325317
return static_cast<bool>(result_set);
326318
}

driver/result_set.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ std::unique_ptr<ResultReader> make_result_reader(
169169
);
170170

171171
template <typename ConversionContext>
172-
SQLRETURN Field::extract(BindingInfo & binding_info, ConversionContext && context) const
173-
{
172+
SQLRETURN Field::extract(BindingInfo & binding_info, ConversionContext && context) const {
174173
return std::visit([&binding_info, &context] (auto & value) {
175174
if constexpr (std::is_same_v<DataSourceType<DataSourceTypeId::Nothing>, std::decay_t<decltype(value)>>) {
176175
return fillOutputNULL(binding_info.value, binding_info.value_max_size, binding_info.indicator);

driver/statement.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ void Statement::requestNextPackOfResultSets(std::unique_ptr<ResultMutator> && mu
134134
request.setHost(uri.getHost());
135135
request.setURI(uri.getPathEtc());
136136
request.set("User-Agent", connection.buildUserAgentString());
137-
request.set("Accept-Encoding", "gzip, deflate");
138137

139138
LOG(request.getMethod() << " " << request.getHost() << request.getURI() << " body=" << prepared_query
140139
<< " UA=" << request.get("User-Agent"));

0 commit comments

Comments
 (0)