version:  22.11.1.1


clickhouse-copier copy all partitions successfully, but the status information storage in the keeper is incorrect
``` shell
get /***/test25/status
{"database_a10_test_c":{"all_partitions_count":5760,"processed_partitions_count":5757}}
```
```sql
SELECT countDistinct(partition)
FROM system.parts_all
WHERE (database = 'database_a10') AND (table = 'test_c')

Query id: e62a3da6-5d78-4977-8c22-d78756a4bf10

┌─uniqExact(partition)─┐
│                 5760 │
└──────────────────────┘
```
`system.parts_all` is a distributed table build for `system.parts`
The program is running normally and the copy task is successful, but the status is not correct.


clickhouse-copier got exception when set `attach_is_done`
```shell
2022.11.18 01:03:53.459107 [ 108618 ] {} <Error> zkutil::EphemeralNodeHolder::~EphemeralNodeHolder(): Cannot remove /***/test13/tables/lf6ckcnts05.database_a10.test_migration_local_a10_0/20111127/attach_active: Code: 999. Coordination::Exception: Session expired, path: Session expired. (KEEPER_EXCEPTION), Stack trace (when copying this message, always include the lines below):

0. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/exception:134: Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) @ 0x188abaf3 in /usr/bin/clickhouse_2022_11_17_1
1. ./cmake-build-relwithdebinfo/./src/Common/Exception.cpp:69: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, bool) @ 0x106aa4ba in /usr/bin/clickhouse_2022_11_17_1
2. ./cmake-build-relwithdebinfo/./src/Common/ZooKeeper/IKeeper.cpp:26: Coordination::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, Coordination::Error, int) @ 0x16826116 in /usr/bin/clickhouse_2022_11_17_1
3. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/string:1499: Coordination::Exception::Exception(Coordination::Error, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0x16826777 in /usr/bin/clickhouse_2022_11_17_1
4. ./cmake-build-relwithdebinfo/./src/Common/ZooKeeper/ZooKeeperImpl.cpp:0: Coordination::ZooKeeper::pushRequest(Coordination::ZooKeeper::RequestInfo&&) @ 0x1686abb6 in /usr/bin/clickhouse_2022_11_17_1
5. ./cmake-build-relwithdebinfo/./src/Common/ZooKeeper/ZooKeeperImpl.cpp:1172: Coordination::ZooKeeper::remove(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, std::__1::function<void (Coordination::RemoveResponse const&)>) @ 0x1686b7ce in /usr/bin/clickhouse_2022_11_17_1
6. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/__functional/function.h:818: zkutil::ZooKeeper::asyncTryRemoveNoThrow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) @ 0x1682cc0c in /usr/bin/clickhouse_2022_11_17_1
7. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/__chrono/duration.h:258: zkutil::ZooKeeper::removeImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) @ 0x1682c8a5 in /usr/bin/clickhouse_2022_11_17_1
8. ./cmake-build-relwithdebinfo/./src/Common/ZooKeeper/ZooKeeper.cpp:366: zkutil::ZooKeeper::tryRemove(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) @ 0x1682cded in /usr/bin/clickhouse_2022_11_17_1
9. ./cmake-build-relwithdebinfo/./src/Common/CurrentMetrics.h:80: zkutil::EphemeralNodeHolder::~EphemeralNodeHolder() @ 0x107f211f in /usr/bin/clickhouse_2022_11_17_1
10. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/__memory/shared_ptr.h:216: std::__1::shared_ptr<zkutil::EphemeralNodeHolder>::~shared_ptr[abi:v15003]() @ 0x107f0127 in /usr/bin/clickhouse_2022_11_17_1
11. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/string:1499: DB::ClusterCopier::tryMoveAllPiecesToDestinationTable(DB::TaskTable const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0x107d84d8 in /usr/bin/clickhouse_2022_11_17_1
12. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopier.cpp:1089: DB::ClusterCopier::tryProcessTable(DB::ConnectionTimeouts const&, DB::TaskTable&) @ 0x107ce9c3 in /usr/bin/clickhouse_2022_11_17_1
13. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopier.cpp:319: DB::ClusterCopier::process(DB::ConnectionTimeouts const&) @ 0x107cc548 in /usr/bin/clickhouse_2022_11_17_1
14. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/__memory/shared_ptr.h:815: DB::ClusterCopierApp::mainImpl() @ 0x107c2834 in /usr/bin/clickhouse_2022_11_17_1
15. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopierApp.cpp:0: DB::ClusterCopierApp::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) @ 0x107c2ffd in /usr/bin/clickhouse_2022_11_17_1
16. ./cmake-build-relwithdebinfo/./contrib/poco/Util/src/Application.cpp:0: Poco::Util::Application::run() @ 0x187aa326 in /usr/bin/clickhouse_2022_11_17_1
17. ./cmake-build-relwithdebinfo/./contrib/poco/Util/src/ServerApplication.cpp:612: Poco::Util::ServerApplication::run(int, char**) @ 0x187be2d2 in /usr/bin/clickhouse_2022_11_17_1
18. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopierApp.cpp:0: mainEntryClickHouseClusterCopier(int, char**) @ 0x107c3191 in /usr/bin/clickhouse_2022_11_17_1
19. ./cmake-build-relwithdebinfo/./programs/main.cpp:0: main @ 0xb7f2271 in /usr/bin/clickhouse_2022_11_17_1
20. __libc_start_main @ 0x21b15 in /usr/lib64/libc-2.17.so
21. _start @ 0xb7f172e in /usr/bin/clickhouse_2022_11_17_1
 (version 22.11.1.1)
2022.11.18 01:03:53.459240 [ 108618 ] {} <Error> Application: Some error occurred while moving pieces to destination table for partition 20111127: Code: 999. Coordination::Exception: Operation timeout, path: /***/test13/tables/lf6ckcnts05.database_a10.test_migration_local_a10_0/20111127/attach_is_done. (KEEPER_EXCEPTION), Stack trace (when copying this message, always include the lines below):

0. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/exception:134: Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int) @ 0x188abaf3 in /usr/bin/clickhouse_2022_11_17_1
1. ./cmake-build-relwithdebinfo/./src/Common/Exception.cpp:69: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, bool) @ 0x106aa4ba in /usr/bin/clickhouse_2022_11_17_1
2. ./cmake-build-relwithdebinfo/./src/Common/ZooKeeper/IKeeper.cpp:26: Coordination::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, Coordination::Error, int) @ 0x16826116 in /usr/bin/clickhouse_2022_11_17_1
3. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/string:1499: Coordination::Exception::Exception(Coordination::Error, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0x16826777 in /usr/bin/clickhouse_2022_11_17_1
4. ./cmake-build-relwithdebinfo/./src/Common/ZooKeeper/ZooKeeper.cpp:0: zkutil::ZooKeeper::set(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int, Coordination::Stat*) @ 0x1682e7fc in /usr/bin/clickhouse_2022_11_17_1
5. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/string:1499: DB::ClusterCopier::tryMoveAllPiecesToDestinationTable(DB::TaskTable const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) @ 0x107d5fd2 in /usr/bin/clickhouse_2022_11_17_1
6. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopier.cpp:1089: DB::ClusterCopier::tryProcessTable(DB::ConnectionTimeouts const&, DB::TaskTable&) @ 0x107ce9c3 in /usr/bin/clickhouse_2022_11_17_1
7. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopier.cpp:319: DB::ClusterCopier::process(DB::ConnectionTimeouts const&) @ 0x107cc548 in /usr/bin/clickhouse_2022_11_17_1
8. ./cmake-build-relwithdebinfo/./contrib/libcxx/include/__memory/shared_ptr.h:815: DB::ClusterCopierApp::mainImpl() @ 0x107c2834 in /usr/bin/clickhouse_2022_11_17_1
9. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopierApp.cpp:0: DB::ClusterCopierApp::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) @ 0x107c2ffd in /usr/bin/clickhouse_2022_11_17_1
10. ./cmake-build-relwithdebinfo/./contrib/poco/Util/src/Application.cpp:0: Poco::Util::Application::run() @ 0x187aa326 in /usr/bin/clickhouse_2022_11_17_1
11. ./cmake-build-relwithdebinfo/./contrib/poco/Util/src/ServerApplication.cpp:612: Poco::Util::ServerApplication::run(int, char**) @ 0x187be2d2 in /usr/bin/clickhouse_2022_11_17_1
12. ./cmake-build-relwithdebinfo/./programs/copier/ClusterCopierApp.cpp:0: mainEntryClickHouseClusterCopier(int, char**) @ 0x107c3191 in /usr/bin/clickhouse_2022_11_17_1
13. ./cmake-build-relwithdebinfo/./programs/main.cpp:0: main @ 0xb7f2271 in /usr/bin/clickhouse_2022_11_17_1
14. __libc_start_main @ 0x21b15 in /usr/lib64/libc-2.17.so
15. _start @ 0xb7f172e in /usr/bin/clickhouse_2022_11_17_1
 (version 22.11.1.1)
```
The attach_is_done was successfully set to 1 (TaskState::Finished), so the status will never be updated
```shell
 get /***/test25/tables/lf6ckcnts05.database_a10.test_c/20111127/attach_is_done
1
A01%2DR26%2DI136%2D197%2D3D0GDB2%2EJD%2ELOCAL#20221119052320_92967
```
The code 
```c++
    /// Create node to signal that we finished moving
    {
        String state_finished = TaskStateWithOwner::getData(TaskState::Finished, host_id);
        zookeeper->set(current_partition_attach_is_done, state_finished, 0);
        /// Also increment a counter of processed partitions
        while (true)
        {
            Coordination::Stat stat;
            auto status_json = zookeeper->get(task_zookeeper_path + "/status", &stat);
            auto statuses = StatusAccumulator::fromJSON(status_json);

            /// Increment status for table.
            auto status_for_table = (*statuses)[task_table.name_in_config];
            status_for_table.processed_partitions_count += 1;
            (*statuses)[task_table.name_in_config] = status_for_table;

            auto statuses_to_commit = StatusAccumulator::serializeToJSON(statuses);
            auto error = zookeeper->trySet(task_zookeeper_path + "/status", statuses_to_commit, stat.version, &stat);
            if (error == Coordination::Error::ZOK)
                break;
        }
    }
```
we should ensure consistency when copier update `status` and `attach_is_done`

TaskShard & task_shard, const String & partition_quoted_name)
{
    createShardInternalTables(timeouts, task_shard, false);
    TaskTable & task_table = task_shard.task_table;
    WriteBufferFromOwnString ss;
    ss << "WITH " + partition_quoted_name + " AS partition_key ";
    ss << "SELECT 1 FROM " << getQuotedTable(task_shard.table_read_shard);
    ss << " WHERE (" << queryToString(task_table.engine_push_partition_key_ast) << " = partition_key)";
    if (!task_table.where_condition_str.empty())
        ss << " AND (" << task_table.where_condition_str << ")";
    ss << " LIMIT 1";
    auto query = ss.str();
    ParserQuery parser_query(query.data() + query.size());
    const auto & settings = getContext()->getSettingsRef();
    ASTPtr query_ast = parseQuery(parser_query, query, settings.max_query_size, settings.max_parser_depth);
    LOG_INFO(log, "Checking shard {} for partition {} existence, executing query: {}",
        task_shard.getDescription(), partition_quoted_name, query_ast->formatForErrorMessage());
    auto local_context = Context::createCopy(context);
    local_context->setSettings(task_cluster->settings_pull);
    auto pipeline = InterpreterFactory::get(query_ast, local_context)->execute().pipeline;
    PullingPipelineExecutor executor(pipeline);
    Block block;
    executor.pull(block);
    return block.rows() != 0;
}
bool ClusterCopier::checkPresentPartitionPiecesOnCurrentShard(const ConnectionTimeouts & timeouts,