| 134 | |
| 135 | |
| 136 | void RemoteInserter::onFinish() |
| 137 | { |
| 138 | /// Empty block means end of data. |
| 139 | connection.sendData(Block(), /* name */"", /* scalar */false); |
| 140 | |
| 141 | /// Wait for EndOfStream or Exception packet, skip Log packets. |
| 142 | while (true) |
| 143 | { |
| 144 | Packet packet = connection.receivePacket(); |
| 145 | |
| 146 | if (Protocol::Server::EndOfStream == packet.type) |
| 147 | break; |
| 148 | |
| 149 | if (Protocol::Server::Exception == packet.type) |
| 150 | packet.exception->rethrow(); |
| 151 | else if (Protocol::Server::Log == packet.type || |
| 152 | Protocol::Server::Progress == packet.type || |
| 153 | Protocol::Server::ProfileEvents == packet.type || |
| 154 | Protocol::Server::TimezoneUpdate == packet.type) |
| 155 | { |
| 156 | // Do nothing |
| 157 | } |
| 158 | else |
| 159 | throw NetException( |
| 160 | ErrorCodes::UNEXPECTED_PACKET_FROM_SERVER, |
| 161 | "Unexpected packet from server (expected EndOfStream or Exception, got {})", |
| 162 | Protocol::Server::toString(packet.type)); |
| 163 | } |
| 164 | |
| 165 | finished = true; |
| 166 | } |
| 167 | |
| 168 | RemoteInserter::~RemoteInserter() |
| 169 | { |
nothing calls this directly
no test coverage detected