Merge branch 'master' into master

This commit is contained in:
Han Fei 2022-11-25 09:22:17 +01:00 committed by GitHub
commit d07defacfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

@ -123,13 +123,16 @@ void ProgressIndication::writeFinalProgress()
if (progress.read_rows < 1000) if (progress.read_rows < 1000)
return; return;
std::cout << "Processed " << formatReadableQuantity(progress.read_rows) << " rows, " UInt64 processed_rows = progress.read_rows + progress.written_rows;
<< formatReadableSizeWithDecimalSuffix(progress.read_bytes); UInt64 processed_bytes = progress.read_bytes + progress.written_bytes;
std::cout << "Processed " << formatReadableQuantity(processed_rows) << " rows, "
<< formatReadableSizeWithDecimalSuffix(processed_bytes);
UInt64 elapsed_ns = getElapsedNanoseconds(); UInt64 elapsed_ns = getElapsedNanoseconds();
if (elapsed_ns) if (elapsed_ns)
std::cout << " (" << formatReadableQuantity(progress.read_rows * 1000000000.0 / elapsed_ns) << " rows/s., " std::cout << " (" << formatReadableQuantity(processed_rows * 1000000000.0 / elapsed_ns) << " rows/s., "
<< formatReadableSizeWithDecimalSuffix(progress.read_bytes * 1000000000.0 / elapsed_ns) << "/s.)"; << formatReadableSizeWithDecimalSuffix(processed_bytes * 1000000000.0 / elapsed_ns) << "/s.)";
else else
std::cout << ". "; std::cout << ". ";
} }
@ -164,16 +167,18 @@ void ProgressIndication::writeProgress(WriteBufferFromFileDescriptor & message)
size_t prefix_size = message.count(); size_t prefix_size = message.count();
UInt64 processed_rows = progress.read_rows + progress.written_rows;
UInt64 processed_bytes = progress.read_bytes + progress.written_bytes;
message << indicator << " Progress: "; message << indicator << " Progress: ";
message message
<< formatReadableQuantity(progress.read_rows) << " rows, " << formatReadableQuantity(processed_rows) << " rows, "
<< formatReadableSizeWithDecimalSuffix(progress.read_bytes); << formatReadableSizeWithDecimalSuffix(processed_bytes);
UInt64 elapsed_ns = getElapsedNanoseconds(); UInt64 elapsed_ns = getElapsedNanoseconds();
if (elapsed_ns) if (elapsed_ns)
message << " (" message << " ("
<< formatReadableQuantity(progress.read_rows * 1000000000.0 / elapsed_ns) << " rows/s., " << formatReadableQuantity(processed_rows * 1000000000.0 / elapsed_ns) << " rows/s., "
<< formatReadableSizeWithDecimalSuffix(progress.read_bytes * 1000000000.0 / elapsed_ns) << "/s.) "; << formatReadableSizeWithDecimalSuffix(processed_bytes * 1000000000.0 / elapsed_ns) << "/s.) ";
else else
message << ". "; message << ". ";

View File

@ -7645,7 +7645,15 @@ void StorageReplicatedMergeTree::createTableSharedID() const
return; return;
} }
auto zookeeper = getZooKeeper(); /// We may call getTableSharedID when table is shut down. If exception happen, restarting thread will be already turned
/// off and nobody will reconnect our zookeeper connection. In this case we use zookeeper connection from
/// context.
ZooKeeperPtr zookeeper;
if (shutdown_called.load())
zookeeper = getZooKeeperIfTableShutDown();
else
zookeeper = getZooKeeper();
String zookeeper_table_id_path = fs::path(zookeeper_path) / "table_shared_id"; String zookeeper_table_id_path = fs::path(zookeeper_path) / "table_shared_id";
String id; String id;
if (!zookeeper->tryGet(zookeeper_table_id_path, id)) if (!zookeeper->tryGet(zookeeper_table_id_path, id))