Clickhouse: Default timezone regression

Created on 11 Mar 2019  Β·  8Comments  Β·  Source: ClickHouse/ClickHouse

After I upgraded to last master today (from an old version from sept 2018) I see at least on OSX that even if in config.xml I have <timezone>UTC</timezone> the server is using the system timezone which is Europe/Bucharest.

This can be tested as well using SELECT timezone()

Anything changed config wise in the last time ?

Silviu

bug comp-darwin comp-datetime

Most helpful comment

Thank you @proller
Any chance for a hotfix release?

All 8 comments

I found the problem:

When setting the value from config we have:

/// This must be done before any usage of DateLUT. In particular, before any logging.
    if (config().has("timezone"))
    {
        if (0 != setenv("TZ", config().getString("timezone").data(), 1))
            throw Poco::Exception("Cannot setenv TZ variable");

        tzset();
    }

As comment says this should execute before any DateLUT is created. But adding a fprintf in this place and in DateLut config indicates that DateLut is created first and then this code is executed.

Didn't found yet where is created. I'll dig more.

Seems the above condition get broken on the ParquetBlockInputStream.cpp line 262 where creating this global variable

const std::unordered_map<arrow::Type::type, std::shared_ptr<IDataType>> arrow_type_to_internal_type = {
    ...
    {arrow::Type::DATE64, std::make_shared<DataTypeDateTime>()},
    {arrow::Type::TIMESTAMP, std::make_shared<DataTypeDateTime>()},
    //{arrow::Type::TIME32, std::make_shared<DataTypeDateTime>()},
   ...
};

Makes DateLUT to be initialized before the above statement is executed.

We ran into the same issue which broke nearly everything for use because it all depends on the timezone. It would be great if this could be resolved and rolled out very soon.

Building with -DENABLE_PARQUET=0 can be used as workaround

Thank you @proller
Any chance for a hotfix release?

Latest release still has the issue.

$ clickhouse-client 
ClickHouse client version 19.4.2.7.
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 19.4.2 revision 54416.

xxx :) SELECT timezone()

SELECT timezone()

β”Œβ”€timezone()────────┐
β”‚ Europe/Berlin     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

As a temporary fix you can set a specific timezone in the environment. Add the following lines with systemctl edit clickhouse-server.service and restart the server:

[Service]
Environment=TZ=UTC

Have this problem too on 19.4.3 revision 54416

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atk91 picture atk91  Β·  3Comments

innerr picture innerr  Β·  3Comments

hatarist picture hatarist  Β·  3Comments

bseng picture bseng  Β·  3Comments

jimmykuo picture jimmykuo  Β·  3Comments