Skip to content

Fix bad cast in ParserCreateQuery#29790

Merged
tavplubix merged 2 commits intomasterfrom
fix-bad-cast-in-parser-create
Oct 8, 2021
Merged

Fix bad cast in ParserCreateQuery#29790
tavplubix merged 2 commits intomasterfrom
fix-bad-cast-in-parser-create

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov commented Oct 5, 2021

Changelog category (leave one):

  • Bug Fix (user-visible misbehaviour in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix bad cast in ATTACH TABLE ... FROM 'path' query when non-string literal is used instead of path. It may lead to reading of uninitialized memory.

  • check other places;
  • add a test.

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Oct 5, 2021
@alexey-milovidov alexey-milovidov marked this pull request as draft October 5, 2021 23:38
@tavplubix tavplubix self-assigned this Oct 6, 2021
@tavplubix tavplubix marked this pull request as ready for review October 7, 2021 13:45
@tavplubix
Copy link
Copy Markdown
Member

Functional stateless tests (release, DatabaseReplicated) - session expired, 3 retries do not help. Seems like test 01154_move_partition_long produces too many log messages after enabling test log level in #28559. Probably Poco::Logger become a bottleneck that freezes server causing session expiration.

Test (with 3 retries) was running since 2021-10-07 18:38:57 until 2021-10-07 18:55:24:

2021-10-07 18:38:57 01155_rename_move_materialized_view:                                    [ OK ] 6.32 sec.
2021-10-07 18:55:24 01154_move_partition_long:                                              [ FAIL ] 296.13 sec. - having stderror: 
2021-10-07 18:55:24 [6ec8b8d22522] 2021.10.07 18:53:01.342470 [ 12350 ] {7fc7272e-33b7-4df4-a6ab-32103aa2e90f} <Error> executeQuery: Code: 236. DB::Exception: Shutdown is called for table. (ABORTED) (version 21.11.1.8337) (from [::1]:48604) (comment: '/usr/share/clickhouse-test/queries/0_stateless/01154_move_partition_long.sh') (in query: SYSTEM SYNC REPLICA dst_11), Stack trace (when copying this message, always include the lines below):
:) create table table (dt DateTime) engine=MergeTree order by dt
$ zgrep -Fai "2021.10.07 " clickhouse-server.log.gz | grep -Pao "[0-9\.]+ [0-9:]+" | sed "s/\./-/g" | clickhouse client --input_format_allow_errors_num=100000 --input_format_allow_errors_ratio=0.1 -q "insert into table table format TSV"
:) alter table table add column expired UInt8
$ zgrep -Fai "session expired" clickhouse-server.log.gz | grep -Po "[0-9\.]+ [0-9:]+" | sed "s/\./-/g" | sed "s/$/\t1/g" | ../bin/clickhouse_21.9.2 client --input_format_allow_errors_num=100000 --input_format_allow_errors_ratio=0.1 -q "insert into table table format TSV"

:) select toStartOfFiveMinute(dt) as d, sum(expired=0) as logged_rows, sum(expired=1) as is_session_expired from table group by d order by d

SELECT
    toStartOfFiveMinute(dt) AS d,
    sum(expired = 0) AS logged_rows,
    sum(expired = 1) AS is_session_expired
FROM table
GROUP BY d
ORDER BY d ASC

Query id: 0fba9d10-ea7e-41dd-9bd3-f11f2e52a113

┌───────────────────d─┬─logged_rows─┬─is_session_expired─┐
│ 1970-01-01 03:00:00 │          49 │                  0 │
│ 2020-11-12 19:00:00 │           2 │                  0 │
│ 2021-10-07 17:30:00 │      235942 │                  0 │
│ 2021-10-07 17:35:00 │      200256 │                  0 │
│ 2021-10-07 17:40:00 │      333751 │                  0 │
│ 2021-10-07 17:45:00 │      286712 │                  0 │
│ 2021-10-07 17:50:00 │      155845 │                  0 │
│ 2021-10-07 17:55:00 │      410318 │                  0 │
│ 2021-10-07 18:00:00 │      283288 │                  0 │
│ 2021-10-07 18:05:00 │      268223 │                  0 │
│ 2021-10-07 18:10:00 │      255985 │                  0 │
│ 2021-10-07 18:15:00 │      266121 │                  0 │
│ 2021-10-07 18:20:00 │      594004 │                  3 │
│ 2021-10-07 18:25:00 │      287645 │                  0 │
│ 2021-10-07 18:30:00 │      113306 │                  0 │
│ 2021-10-07 18:35:00 │      907335 │                201 │
│ 2021-10-07 18:40:00 │     1839014 │               1751 │
│ 2021-10-07 18:45:00 │     2341829 │                903 │
│ 2021-10-07 18:50:00 │     1426583 │                363 │
│ 2021-10-07 18:55:00 │      257104 │                  0 │
│ 2021-10-07 19:00:00 │      789810 │                  0 │
│ 2021-10-07 19:05:00 │      148554 │                  0 │
│ 2021-10-07 19:10:00 │        7788 │                  0 │
└─────────────────────┴─────────────┴────────────────────┘

@tavplubix
Copy link
Copy Markdown
Member

@tavplubix
Copy link
Copy Markdown
Member

ZooKeeper client closes socket, but it's not clear why: https://gist.github.com/tavplubix/0ab5790b686a8bc7dbf6c33a8b13d5e3
Let's try to add more logs... #29901

@tavplubix tavplubix merged commit fa1396a into master Oct 8, 2021
@tavplubix tavplubix deleted the fix-bad-cast-in-parser-create branch October 8, 2021 20:53
tavplubix added a commit that referenced this pull request Oct 11, 2021
Backport #29790 to 21.9: Fix bad cast in ParserCreateQuery
tavplubix added a commit that referenced this pull request Oct 11, 2021
Backport #29790 to 21.10: Fix bad cast in ParserCreateQuery
tavplubix added a commit that referenced this pull request Oct 11, 2021
Backport #29790 to 21.8: Fix bad cast in ParserCreateQuery
tavplubix added a commit that referenced this pull request Oct 11, 2021
Backport #29790 to 21.7: Fix bad cast in ParserCreateQuery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants