Fix progress rows and bytes read

This commit is contained in:
Alexey Korepanov 2024-07-07 21:22:02 +02:00
parent 88736a0d74
commit 2ae9490a68
2 changed files with 2 additions and 4 deletions

View File

@ -81,11 +81,11 @@ void JSONCompactWithProgressRowOutputFormat::writeExtremesElement(const char * t
void JSONCompactWithProgressRowOutputFormat::onProgress(const Progress & value) void JSONCompactWithProgressRowOutputFormat::onProgress(const Progress & value)
{ {
progress.incrementPiecewiseAtomically(value); statistics.progress.incrementPiecewiseAtomically(value);
String progress_line; String progress_line;
WriteBufferFromString buf(progress_line); WriteBufferFromString buf(progress_line);
writeCString("{\"progress\":", buf); writeCString("{\"progress\":", buf);
progress.writeJSON(buf); statistics.progress.writeJSON(buf);
writeCString("}\n", buf); writeCString("}\n", buf);
buf.finalize(); buf.finalize();
std::lock_guard lock(progress_lines_mutex); std::lock_guard lock(progress_lines_mutex);
@ -127,7 +127,6 @@ void JSONCompactWithProgressRowOutputFormat::finalizeImpl()
settings.write_statistics && exception_message.empty(), settings.write_statistics && exception_message.empty(),
*ostr); *ostr);
exception_message = "Test exception message.";
if (!exception_message.empty()) if (!exception_message.empty())
{ {
writeCString("\n", *ostr); writeCString("\n", *ostr);

View File

@ -46,7 +46,6 @@ private:
void finalizeImpl() override; void finalizeImpl() override;
Progress progress;
std::vector<String> progress_lines; std::vector<String> progress_lines;
std::mutex progress_lines_mutex; std::mutex progress_lines_mutex;
/// To not lock mutex and check progress_lines every row, /// To not lock mutex and check progress_lines every row,