diff --git a/src/man1/mdbx_copy.1 b/src/man1/mdbx_copy.1 index d6edac58..dbdd5ab1 100644 --- a/src/man1/mdbx_copy.1 +++ b/src/man1/mdbx_copy.1 @@ -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. diff --git a/src/tools/copy.c b/src/tools/copy.c index 2a55339b..1014be0b 100644 --- a/src/tools/copy.c +++ b/src/tools/copy.c @@ -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')