mdbx-tools: добавление опции -f в утилиту mdbx_copy.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-07-10 23:37:08 +03:00
parent 4bb69a1c8f
commit 53c14bc92c
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,8 @@ mdbx_copy \- MDBX environment copy tool
[\c
.BR \-c ]
[\c
.BR \-f ]
[\c
.BR \-d ]
[\c
.BR \-p ]
@ -49,6 +51,9 @@ or unused pages will be omitted from the copy. This option will
slow down the backup process as it is more CPU-intensive.
Currently it fails if the environment has suffered a page leak.
.TP
.BR \-f
Silently overwrite the target file, if it exists, instead of reaching an error.
.TP
.BR \-d
Alters geometry to enforce the copy to be a dynamic size DB,
which could be growth and shrink by reasonable steps on the fly.

View File

@ -42,6 +42,7 @@ static void usage(const char *prog) {
" -V\t\tprint version and exit\n"
" -q\t\tbe quiet\n"
" -c\t\tenable compactification (skip unused pages)\n"
" -f\t\tforce copying even the target file exists\n"
" -d\t\tenforce copy to be a dynamic size DB\n"
" -p\t\tusing transaction parking/ousting during copying MVCC-snapshot\n"
" \t\tto avoid stopping recycling and overflowing the DB\n"
@ -87,6 +88,8 @@ int main(int argc, char *argv[]) {
cpflags |= MDBX_CP_FORCE_DYNAMIC_SIZE;
else if (argv[1][1] == 'p' && argv[1][2] == '\0')
cpflags |= MDBX_CP_THROTTLE_MVCC;
else if (argv[1][1] == 'f' && argv[1][2] == '\0')
cpflags |= MDBX_CP_OVERWRITE;
else if (argv[1][1] == 'q' && argv[1][2] == '\0')
quiet = true;
else if (argv[1][1] == 'u' && argv[1][2] == '\0')