[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About network failures while uploading



On Sat, 8 Mar 2014 16:06:15 +0000
Colin Percival <cperciva@tarsnap.com> wrote:

> On 03/08/14 07:24, tarsnap wrote:
> > On Sat, 8 Mar 2014 14:41:50 +0000
> > Colin Percival <cperciva@tarsnap.com> wrote:
> >> I'd recommend using the --checkpoint-bytes option with a fairly low
> >> setting (e.g., --checkpoint-bytes 32M) so that you'll have lots of
> >> checkpoints created.  That way when an archive fails you'll still
> >> have the first section of the archive stored -- and that data can
> >> then be used for deduplication purposes when you create another
> >> archive, which will make future archives use less bandwidth and
> >> complete faster.
> > 
> > Thanks for your reply.
> > So I have to do 2 things:
> > 1) add the checkpoints option
> > 2) create another (NOT the same) archive?
> 
> You can try creating an archive with the same name as you used
> before.  If it fails, that means the previous archive got created
> successfully.
> 
> >> Of course, finding an internet connection which doesn't break for 5
> >> minutes at a time would be ideal.  (5 minutes is how long tarsnap
> >> will keep on trying to reconnect.)
> > 
> > The internet connection breaks down when the power goes out, which
> > happens quite frequently: 2 times a day for 2 hours each.
> > The laptop runs longer than 5 minutes on its own battery, which
> > means tarsnap will always 'give up'.
> > 
> > Which brings me to the following feature request: 
> > A command line option to set the
> > 'retry time' (from 5 min. to inf., and frequency--if not automatic
> > as function of 'retry time').
> 
> The attached patch adds a completely untested and undocumented
> --retry-forever option.  Let me know if it works and is useful. :-)
> 

I'm afraid something went wrong, any idea what it is?
Beow follows:
1) tarsnap version
2) CLI
3) netpacket_op.c.rej


tnx



1)
$ tarsnap --version
tarsnap 1.0.35


2)
[user@fedora-18-x64-use netpacket]$ patch netpacket_op.c <
tarsnap_retryforever.patch 
patching file netpacket_op.c
patching file netpacket_op.c
Hunk #1 FAILED at 469.
Hunk #2 FAILED at 531.
Hunk #3 FAILED at 1466.
Hunk #4 FAILED at 1495.
4 out of 4 hunks FAILED -- saving rejects to file netpacket_op.c.rej
patching file netpacket_op.c
Hunk #1 FAILED at 105.
Hunk #2 FAILED at 199.
Hunk #3 FAILED at 214.
3 out of 3 hunks FAILED -- saving rejects to file netpacket_op.c.rej
patching file netpacket_op.c
Hunk #1 FAILED at 130.
Hunk #2 FAILED at 144.
2 out of 2 hunks FAILED -- saving rejects to file netpacket_op.c.rej
patching file netpacket_op.c
Hunk #1 FAILED at 4.
1 out of 1 hunk FAILED -- saving rejects to file netpacket_op.c.rej
[user@fedora-18-x64-use netpacket]$


3)
--- bsdtar.c	2014-02-17 01:37:46.000000000 -0800
+++ bsdtar.c	2014-03-08 07:58:45.000000000 -0800
@@ -469,6 +469,9 @@
 		case OPTION_NO_QUIET:
 			optq_push(bsdtar, "no-quiet", NULL);
 			break;
+		case OPTION_NO_RETRY_FOREVER:
+			optq_push(bsdtar, "no-retry-forever", NULL);
+			break;
 		case OPTION_NO_SAME_OWNER: /* GNU tar */
 			bsdtar->extract_flags &=
~ARCHIVE_EXTRACT_OWNER; break;
@@ -531,6 +534,9 @@
 		case OPTION_RECOVER:
 			set_mode(bsdtar, opt, "--recover");
 			break;
+		case OPTION_RETRY_FOREVER:
+			optq_push(bsdtar, "retry-forever", NULL);
+			break;
 		case OPTION_SNAPTIME: /* multitar */
 			optq_push(bsdtar, "snaptime", bsdtar->optarg);
 			break;
@@ -1466,6 +1472,11 @@
 			goto optset;
 
 		bsdtar->option_quiet_set = 1;
+	} else if (strcmp(conf_opt, "no-retry-forever") == 0) {
+		if (bsdtar->option_retry_forever_set)
+			goto optset;
+
+		bsdtar->option_retry_forever_set = 1;
 	} else if (strcmp(conf_opt, "no-snaptime") == 0) {
 		if (bsdtar->option_snaptime_set)
 			goto optset;
@@ -1495,6 +1506,12 @@
 
 		bsdtar->option_quiet = 1;
 		bsdtar->option_quiet_set = 1;
+	} else if (strcmp(conf_opt, "retry-forever") == 0) {
+		if (bsdtar->option_retry_forever_set)
+			goto optset;
+
+		tarsnap_opt_retry_forever = 1;
+		bsdtar->option_retry_forever_set = 1;
 	} else if (strcmp(conf_opt, "snaptime") == 0) {
 		if (bsdtar->mode != 'c')
 			goto badmode;
--- bsdtar.h	2014-02-17 01:37:46.000000000 -0800
+++ bsdtar.h	2014-03-08 07:54:57.000000000 -0800
@@ -105,6 +105,7 @@
 	int		  option_no_config_include_set;
 	int		  option_quiet;
 	int		  option_quiet_set;
+	int		  option_retry_forever_set;
 	int		  option_insane_filesystems;
 	int		  option_insane_filesystems_set;
 	const char	**configfiles;		/*
--configfile */ @@ -199,6 +200,7 @@
 	OPTION_NO_NODUMP,
 	OPTION_NO_PRINT_STATS,
 	OPTION_NO_QUIET,
+	OPTION_NO_RETRY_FOREVER,
 	OPTION_NO_SAME_OWNER,
 	OPTION_NO_SAME_PERMISSIONS,
 	OPTION_NO_SNAPTIME,
@@ -214,6 +216,7 @@
 	OPTION_RECOVER,
 	OPTION_RECOVER_DELETE,	/* Operation mode, not a real
option */ OPTION_RECOVER_WRITE,	/* Operation mode, not a real
option */
+	OPTION_RETRY_FOREVER,
 	OPTION_QUIET,
 	OPTION_SNAPTIME,
 	OPTION_STORE_ATIME,
--- cmdline.c	2014-02-17 01:37:46.000000000 -0800
+++ cmdline.c	2014-03-08 07:51:48.000000000 -0800
@@ -130,6 +130,7 @@
 	{ "no-print-stats",	  0, OPTION_NO_PRINT_STATS },
 	{ "no-quiet",		  0, OPTION_NO_QUIET },
 	{ "no-recursion",         0, 'n' },
+	{ "no-retry-forever",	  0, OPTION_NO_RETRY_FOREVER },
 	{ "no-same-owner",	  0, OPTION_NO_SAME_OWNER },
 	{ "no-same-permissions",  0, OPTION_NO_SAME_PERMISSIONS },
 	{ "no-snaptime",	  0, OPTION_NO_SNAPTIME },
@@ -144,6 +145,7 @@
 	{ "quiet",		  0, OPTION_QUIET },
 	{ "read-full-blocks",	  0, 'B' },
 	{ "recover",		  0, OPTION_RECOVER },
+	{ "retry-forever",	  0, OPTION_RETRY_FOREVER },
 	{ "same-owner",	          0, OPTION_SAME_OWNER },
 	{ "same-permissions",     0, 'p' },
 	{ "snaptime",		  1, OPTION_SNAPTIME },
--- tarsnap_opt.h	2014-02-17 01:37:46.000000000 -0800
+++ tarsnap_opt.h	2014-03-08 07:48:30.000000000 -0800
@@ -4,6 +4,9 @@
 /* Use multiple TCP connections when writing an archive. */
 extern int tarsnap_opt_aggressive_networking;
 
+/* Keep trying forever if connection lost. */
+extern int tarsnap_opt_retry_forever;
+
 /* Print statistics using "human-readable" SI prefixes. */
 extern int tarsnap_opt_humanize_numbers;