From 53c14bc92cf4a06363bbd5233db90a915bd635dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Thu, 10 Jul 2025 23:37:08 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-tools:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=BF=D1=86=D0=B8=D0=B8?= =?UTF-8?q?=20`-f`=20=D0=B2=20=D1=83=D1=82=D0=B8=D0=BB=D0=B8=D1=82=D1=83?= =?UTF-8?q?=20`mdbx=5Fcopy`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/man1/mdbx_copy.1 | 5 +++++ src/tools/copy.c | 3 +++ 2 files changed, 8 insertions(+) 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')