Skip to content

Flaky test: test_drop_replica/test.py::test_drop_replica #93064

Closed

Description

@kssenii

Important: This issue was automatically generated and is used by CI for matching failures. DO NOT modify the body content. DO NOT remove labels.

Test name: test_drop_replica/test.py::test_drop_replica
Failure reason: Database test1 cannot be detached, because some tables are still in use
CI report: Integration tests (arm_binary, distributed plan, 4/4)

CIDB statistics: cidb

Test output:

File: test_drop_replica/test.py:161 - in test_drop_replica
    node_1_1.query("DETACH DATABASE test{}".format(i))
File: helpers/cluster.py:4454 - in query
    return self.client.query(
File: helpers/client.py:40 - in wrap
    return func(self, *args, **kwargs)
File: helpers/client.py:80 - in query
    ).get_answer()
File: helpers/client.py:269 - in get_answer
    raise QueryRuntimeException(
E   helpers.client.QueryRuntimeException: Client failed! Return code: 219, stderr: Received exception from server (version 26.1.1):
E   Code: 219. DB::Exception: Received from 172.16.4.6:9000. DB::Exception: Database test1 cannot be detached, because some tables are still in use. Retry later.. Stack trace:
E   
E   0. ./ci/tmp/build/./base/poco/Foundation/src/Exception.cpp:28: Poco::Exception::Exception(String const&, int) @ 0x000000001e67ed38
E   1. ./ci/tmp/build/./src/Common/Exception.cpp:136: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000010e68b0c
E   2. DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000ab674d8
E   3. DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000ab66f8c
E   4. DB::Exception::Exception<String>(int, FormatStringHelperImpl<std::type_identity<String>::type>, String&&) @ 0x000000000ab66bd8
E   5. ./ci/tmp/build/./src/Databases/DatabaseAtomic.cpp:504: DB::DatabaseAtomic::assertCanBeDetached(bool) @ 0x0000000015aff918
E   6. ./ci/tmp/build/./src/Interpreters/InterpreterDropQuery.cpp:624: DB::InterpreterDropQuery::executeToDatabaseImpl(DB::ASTDropQuery const&, std::shared_ptr<DB::IDatabase>&, std::vector<StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>, std::allocator<StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>>>&) @ 0x0000000016832f88
E   7. ./ci/tmp/build/./src/Interpreters/InterpreterDropQuery.cpp:368: DB::InterpreterDropQuery::executeToDatabase(DB::ASTDropQuery const&) @ 0x000000001682f664
E   8. ./ci/tmp/build/./src/Interpreters/InterpreterDropQuery.cpp:77: DB::InterpreterDropQuery::execute() @ 0x000000001682e64c
E   9. ./ci/tmp/build/./src/Interpreters/executeQuery.cpp:1748: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, std::unique_ptr<DB::ReadBuffer, std::default_delete<DB::ReadBuffer>>&, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>, std::function<void ()>, DB::QueryResultDetails&) @ 0x0000000016ba5908
E   10. ./ci/tmp/build/./src/Interpreters/executeQuery.cpp:1972: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x0000000016ba1b80
E   11. ./ci/tmp/build/./src/Server/TCPHandler.cpp:774: DB::TCPHandler::runImpl() @ 0x0000000019a2c560
E   12. ./ci/tmp/build/./src/Server/TCPHandler.cpp:2862: DB::TCPHandler::run() @ 0x0000000019a46244
E   13. ./ci/tmp/build/./base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x000000001e74d9d8
E   14. ./ci/tmp/build/./base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x000000001e74e098
E   15. ./ci/tmp/build/./base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000001e6e0a98
E   16. ./base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001e6de034
E   17. ? @ 0x0000000000080398
E   18. ? @ 0x00000000000e9e9c
E   . (DATABASE_NOT_EMPTY)
E   (query: DETACH DATABASE test1)

Activity

  1. added
    testing
    flaky test
    on Dec 25, 2025
  2. alexey-milovidov commented on Feb 28, 2026

    @alexey-milovidov
    Member

    Not relevant.

  3. added
    comp-database-engines
    on Sep 18, 2026
  4. clickhouse-gh commented on Sep 18, 2026

    @clickhouse-gh
    Contributor

    🎉 Crash classifier: comp-database-engines (secondary comp-testing, confidence medium).

    Flaky test_drop_replica: DETACH DATABASE fails with DATABASE_NOT_EMPTY ("some tables are still in use")

    Type: handled error (not a crash)

    The integration test test_drop_replica/test.py::test_drop_replica intermittently fails because a DETACH DATABASE test1 SYNC returns error Code 219 (DATABASE_NOT_EMPTY) raised in DatabaseAtomic::assertCanBeDetached: "Database test1 cannot be detached, because some tables are still in use. Retry later." This is a handled query-level error (DATABASE_NOT_EMPTY), not a process crash. The alert is classified as a crash but the trace is an ordinary exception path (Poco::Exception -> DB::Exception thrown from assertCanBeDetached).

  5. groeneai commented on Sep 18, 2026

    @groeneai
    Collaborator

    @PedroTadim That 219 is already fixed on master, but not on the branch that run came from.

    I fixed it in #114628 (merged 2026-08-13), which added SYNC to the DETACH DATABASE calls in this test. The run you linked is backport/26.7/120356 (base 26.7), and tests/integration/test_drop_replica/test.py there still has the pre-fix lines:

    ref the two DETACH DATABASE lines in test_drop_replica
    master (L158, L160) DETACH DATABASE test SYNC, DETACH DATABASE test{} SYNC
    26.7 (L158, L160) DETACH DATABASE test, DETACH DATABASE test{}
    26.3 (L159, L161) DETACH DATABASE test, DETACH DATABASE test{}

    SYNC is the in-tree remedy for this exact error: InterpreterDropQuery::executeToDatabaseImpl only waits via database->waitDetachedTableNotInUse(...) when query.sync is set (its own comment there reads Avoid "some tables are still in use" when sync mode is enabled), and DatabaseAtomic::assertCanBeDetached(true) throws 219 while detached_tables is still non-empty.

    CIDB rows carrying cannot be detached, because some tables are still in use for test_drop_replica:

    • 2026-06-14 to 2026-08-13, before the merge: 7, all on the master line (5 PR runs, 2 scheduled master runs).
    • since the merge, 36 days: 1, the 26.7 run you linked. 0 on master.

    So there is nothing left for me to change on master, and I will not hand-author a backport. Could you put v26.7-must-backport and v26.3-must-backport on #114628? Both branches still carry the pre-fix lines, which is why this keeps surfacing in BackportPR runs.

    For completeness: test_drop_replica did fail once on the master line since the merge (2026-09-16), but at test.py:108 with Code: 32, ATTEMPT_TO_READ_AFTER_EOF ... while receiving packet from 172.16.2.9:9000, and only on one refactor branch (remove-old-analyzer). That is a server going away mid-query, not this failure recurring, so I am not folding it into this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-database-enginesflaky testtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions