Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7e9ca7

Browse files
committed
Truncate filenames in the leadning end in pg_basebackup verbose output
When truncating at the end, like before, the output would often end upjust showing the path instead of the filename.Also increase the length of the filename by 5, which still keeps us atless than 80 characters in most outputs.
1 parentf3af534 commitd7e9ca7

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ progress_report(int tablespacenum, const char *filename)
422422
totaldone /1024);
423423
snprintf(totalsize_str,sizeof(totalsize_str),INT64_FORMAT,totalsize);
424424

425+
#defineVERBOSE_FILENAME_LENGTH 35
425426
if (verbose)
426427
{
427428
if (!filename)
@@ -431,18 +432,29 @@ progress_report(int tablespacenum, const char *filename)
431432
* call)
432433
*/
433434
fprintf(stderr,
434-
ngettext("%s/%s kB (100%%), %d/%d tablespace %35s",
435-
"%s/%s kB (100%%), %d/%d tablespaces %35s",
435+
ngettext("%s/%s kB (100%%), %d/%d tablespace %*s",
436+
"%s/%s kB (100%%), %d/%d tablespaces %*s",
436437
tablespacecount),
437438
totaldone_str,totalsize_str,
438-
tablespacenum,tablespacecount,"");
439+
tablespacenum,tablespacecount,
440+
VERBOSE_FILENAME_LENGTH+5,"");
439441
else
442+
{
443+
booltruncate= (strlen(filename)>VERBOSE_FILENAME_LENGTH);
444+
440445
fprintf(stderr,
441-
ngettext("%s/%s kB (%d%%), %d/%d tablespace (%-30.30s)",
442-
"%s/%s kB (%d%%), %d/%d tablespaces (%-30.30s)",
446+
ngettext("%s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)",
447+
"%s/%s kB (%d%%), %d/%d tablespaces (%s%-*.*s)",
443448
tablespacecount),
444449
totaldone_str,totalsize_str,percent,
445-
tablespacenum,tablespacecount,filename);
450+
tablespacenum,tablespacecount,
451+
/* Prefix with "..." if we do leading truncation */
452+
truncate ?"..." :"",
453+
truncate ?VERBOSE_FILENAME_LENGTH-3 :VERBOSE_FILENAME_LENGTH,
454+
truncate ?VERBOSE_FILENAME_LENGTH-3 :VERBOSE_FILENAME_LENGTH,
455+
/* Truncate filename at beginning if it's too long */
456+
truncate ?filename+strlen(filename)-VERBOSE_FILENAME_LENGTH+3 :filename);
457+
}
446458
}
447459
else
448460
fprintf(stderr,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp