**Use case**
Some program left garbage in terminal.

**Describe the solution you'd like**
Subset of what `reset` command does.
query_to_send = serializeAST(*parsed_query);
        }
        int retries_left = 10;
        for (;;)
        
            assert(retries_left > 0);
            try
            
                n->sendQuery(
                    n_parameters.timeouts,
                    query_to_send,
                    context.getCurrentQueryId(),
                    query_processing_stage,
                    &context.getSettingsRef(),
                    &context.getClientInfo(),
                    true);
                sendExternalTables();
                receiveResult();
                break;
            }
            catch (const Exception & e)
            
                /// Retry when the server said "Client should retry" and no rows
                /// has been received yet.
                i
                    && e.code() == ErrorCodes::DEADLOCK_AVOIDED
                    && --retries_left)
                
                    std::cerr << "Got a transient error from the server, will"
                        << " retry (" << retries_left << " retries left)";