Skip to content

Commit 8f0e528

Browse files
committed
Adding progress bar
1 parent 067731a commit 8f0e528

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

cloud/filestore/apps/client/lib/diagnose_filesystem.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ class TDiagnoseFilesystemCommand final: public TFileStoreCommand
170170
TVector<TNodeRow>& accessRows,
171171
TVector<NAggregation::TRow<TLatency>>& latencyRows)
172172
{
173+
if (BatchSize == 0) {
174+
STORAGE_THROW_SERVICE_ERROR(
175+
MakeError(E_ARGUMENT, "batch-size must be greater than zero"));
176+
}
177+
size_t completed = 0;
173178
for (int batchStart = 0; batchStart < shardStats.size();
174179
batchStart += BatchSize)
175180
{
@@ -214,7 +219,8 @@ class TDiagnoseFilesystemCommand final: public TFileStoreCommand
214219
<< result.GetOutput())));
215220
continue;
216221
}
217-
222+
++completed;
223+
PrintProgress(completed, shardStats.size());
218224
ProcessAccessStats(response.GetNodeStats(), accessRows);
219225
ProcessLatencyStats(response.GetLatencyStats(), latencyRows);
220226
}
@@ -238,6 +244,25 @@ class TDiagnoseFilesystemCommand final: public TFileStoreCommand
238244
std::move(request));
239245
}
240246

247+
void PrintProgress(size_t completed, size_t total)
248+
{
249+
if (JsonOutput) {
250+
return;
251+
}
252+
253+
size_t width = 40;
254+
size_t filled = total ? completed * width / total : width;
255+
256+
Cout << '\r' << "Collecting access and latency stats ["
257+
<< TString(filled, '#') << TString(width - filled, '_') << "] "
258+
<< completed << '/' << total
259+
<< Flush;
260+
261+
if (completed == total) {
262+
Cout << Endl;
263+
}
264+
}
265+
241266
void ProcessAccessStats(
242267
const google::protobuf::RepeatedPtrField<
243268
NCloud::NFileStore::NProtoPrivate::TNodeStats>& accessStats,

cloud/filestore/libs/storage/core/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ using TAliases = NProto::TStorageConfig::TFilestoreAliases;
326326
xxx(BlockChecksumsInProfileLogEnabled, bool, false )\
327327
\
328328
xxx(MinShardCount, ui32, 0 )\
329-
xxx(MaxShardCount, ui32, 254 )\
329+
xxx(MaxShardCount, ui32, 1000 )\
330330
\
331331
xxx(ReadBlobDisabled, bool, false )\
332332
xxx(WriteBlobDisabled, bool, false )\

0 commit comments

Comments
 (0)