Skip to content

Make shutdown of ReplicatedMergeTree tables more soft - #51851

Merged
tavplubix merged 34 commits into
masterfrom
add_delay_for_replicated
Jul 26, 2023
Merged

tavplubix merged 34 commits into
masterfrom
add_delay_for_replicated

Conversation

@alesapin

@alesapin alesapin commented Jul 5, 2023

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Introduce a table setting wait_for_unique_parts_send_before_shutdown_ms which specify the amount of time replica will wait before closing interserver handler for replicated sends. Also fix inconsistency with shutdown of tables and interserver handlers: now server shutdown tables first and only after it shut down interserver handlers.

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Jul 5, 2023
@robot-clickhouse

robot-clickhouse commented Jul 5, 2023 •

Copy link
Copy Markdown
Member

This is an automated comment for commit 6bbed62 with description of existing statuses. It's updated for the latest CI running
The full report is available here
The overall status of the commit is 🟡 pending

Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR🟡 pending
Mergeable CheckChecks if all other necessary checks are successful🟢 success
Push to DockerhubThe check for building and pushing the CI related docker images to docker hub🟢 success

@alesapin
alesapin requested a review from tavplubix July 5, 2023 16:40
@tavplubix tavplubix self-assigned this Jul 5, 2023
Comment thread programs/server/Server.cpp Resolved
@alesapin

Copy link
Copy Markdown
Member Author

Possible deadlock traces: https://pastila.nl/?0006a09d/8960894b9787bcf5ffd90ee2956e4eae. At first glance it doesn't look like something related to changes, I'll try to investigate.

@alesapin alesapin left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great code, will solve all possible issues🚀

@alesapin

Copy link
Copy Markdown
Member Author

@alesapin

Copy link
Copy Markdown
Member Author

@alesapin alesapin left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is it, it's a final version

@nikitamikhaylov

Copy link
Copy Markdown
Member

I think test failures are related 😢

@alesapin

Copy link
Copy Markdown
Member Author

I'm 99% that they not. Let's look one more time and investigate this failure tomorrow.

@alesapin

Copy link
Copy Markdown
Member Author

@tavplubix

Copy link
Copy Markdown
Member

https://s3.amazonaws.com/clickhouse-test-reports/51851/753a8d0a43d94b49b3d310d2406dde247e202c58/integration_tests__tsan__[1_6].html

That was weird:

        # node 2 partitioned and don't see any data
>       assert node2.query("SELECT * FROM test_table") == "0\n"
E       AssertionError: assert '0\n33\n2\n' == '0\n'
E           0
E         + 33
E         + 2

But the nodes were partitioned at 2023-07-23 22:09:25

2023-07-23 22:09:25 [ 632 ] DEBUG : [network] 3b4f1885f5e55540f54f8351bdc194e74ff69af98d886a590c4ef08f5cde418b: ['iptables', '--wait', '-I', 'DOCKER-USER', '1', '-p', 'tcp', '-s', '172.16.6.6', '-d', '172.16.6.5', '-j', 'DROP'] (0):  (network.py:308, _exec_run)
2023-07-23 22:09:25 [ 632 ] DEBUG : http://localhost:None "POST /v1.42/containers/3b4f1885f5e55540f54f8351bdc194e74ff69af98d886a590c4ef08f5cde418b/exec HTTP/1.1" 201 74 (connectionpool.py:546, _make_request)
2023-07-23 22:09:25 [ 632 ] DEBUG : http://localhost:None "POST /v1.42/exec/9315d8917e338b44ac42ce311166520dec428715918a4562b2a5762128407de5/start HTTP/1.1" 101 0 (connectionpool.py:546, _make_request)
2023-07-23 22:09:25 [ 632 ] DEBUG : http://localhost:None "GET /v1.42/exec/9315d8917e338b44ac42ce311166520dec428715918a4562b2a5762128407de5/json HTTP/1.1" 200 460 (connectionpool.py:546, _make_request)
2023-07-23 22:09:25 [ 632 ] DEBUG : [network] 3b4f1885f5e55540f54f8351bdc194e74ff69af98d886a590c4ef08f5cde418b: ['iptables', '--wait', '-I', 'DOCKER-USER', '1', '-p', 'tcp', '-s', '172.16.6.5', '-d', '172.16.6.6', '-j', 'DROP'] (0):  (network.py:308, _exec_run)
3481:time="2023-07-23T22:09:25.259115446Z" level=debug msg="form data: {\"AttachStderr\":true,\"AttachStdin\":false,\"AttachStdout\":true,\"Cmd\":[\"iptables\",\"--wait\",\"-I\",\"DOCKER-USER\",\"1\",\"-p\",\"tcp\",\"-s\",\"172.16.6.6\",\"-d\",\"172.16.6.5\",\"-j\",\"DROP\"],\"Container\":\"3b4f1885f5e55540f54f8351bdc194e74ff69af98d886a590c4ef08f5cde418b\",\"Privileged\":true,\"Tty\":false,\"User\":\"\"}"
3520:time="2023-07-23T22:09:25.292112898Z" level=debug msg="form data: {\"AttachStderr\":true,\"AttachStdin\":false,\"AttachStdout\":true,\"Cmd\":[\"iptables\",\"--wait\",\"-I\",\"DOCKER-USER\",\"1\",\"-p\",\"tcp\",\"-s\",\"172.16.6.5\",\"-d\",\"172.16.6.6\",\"-j\",\"DROP\"],\"Container\":\"3b4f1885f5e55540f54f8351bdc194e74ff69af98d886a590c4ef08f5cde418b\",\"Privileged\":true,\"Tty\":false,\"User\":\"\"}"

But node2 managed to download 2 parts somehow:

417:2023.07.23 22:09:26.036910 [ 226 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): Fetching part all_10_10_0 from default:/test/table/replicas/r0
418:2023.07.23 22:09:26.037244 [ 226 ] {} <Trace> ReadWriteBufferFromHTTP: Sending request to http://node1:9009/?endpoint=DataPartsExchange%3A%2Ftest%2Ftable%2Freplicas%2Fr0&part=all_10_10_0&client_protocol_version=8&compress=false
424:2023.07.23 22:09:26.039181 [ 226 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784) (Fetcher): Downloading part all_10_10_0 onto disk default.
425:2023.07.23 22:09:26.040999 [ 226 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784) (Fetcher): Download of part all_10_10_0 onto disk default finished.
426:2023.07.23 22:09:26.041183 [ 226 ] {} <Trace> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): Renaming temporary part tmp-fetch_all_10_10_0 to all_10_10_0 with tid (1, 1, 00000000-0000-0000-0000-000000000000).
427:2023.07.23 22:09:26.041278 [ 226 ] {} <Test> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): preparePartForCommit: inserting all_10_10_0 (state PreActive) into data_parts_indexes
428:2023.07.23 22:09:26.041302 [ 226 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): Committing part all_10_10_0 to zookeeper
429:2023.07.23 22:09:26.044409 [ 226 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): Part all_10_10_0 committed to zookeeper
430:2023.07.23 22:09:26.044537 [ 226 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): Fetched part all_10_10_0 from default:/test/table/replicas/r0

The iptables rules actually took effect later:

2023.07.23 22:09:26.127135 [ 208 ] {} <Debug> default.test_table (2afb5b3d-cdb6-4559-b672-b77186177784): Fetching part all_14_49_1 from default:/test/table/replicas/r0
2023.07.23 22:09:26.127538 [ 208 ] {} <Trace> ReadWriteBufferFromHTTP: Sending request to http://node1:9009/?endpoint=DataPartsExchange%3A%2Ftest%2Ftable%2Freplicas%2Fr0&part=all_14_49_1&client_protocol_version=8&compress=false
2023.07.23 22:09:26.623215 [ 223 ] {} <Trace> HTTPSessionAdapter: Failed to create connection with 172.16.6.6:9009, Will try another resolved address. Poco::Exception. Code: 1000, e.code() = 0, Timeout: connect timed out: 172.16.6.6:9009 (version 23.7.1.1)
2023.07.23 22:09:26.679753 [ 225 ] {} <Trace> HTTPSessionAdapter: Failed to create connection with 172.16.6.6:9009, Will try another resolved address. Poco::Exception. Code: 1000, e.code() = 0, Timeout: connect timed out: 172.16.6.6:9009 (version 23.7.1.1)

@tavplubix

Copy link
Copy Markdown
Member

Stateless tests flaky check (asan) - Test runs too long - okay
Upgrade check (tsan) - https://pastila.nl/?024c2ef6/2eb275edb9d8569304819d60c94d2397, will fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created-cloud deprecated label, NOOP pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants