Giter VIP home page Giter VIP logo

Comments (3)

janvrany avatar janvrany commented on August 27, 2024

I was expecting to see something like this in zrep_refresh

From 0a41c5bb50b7082de005a4c672eb48ea28365eb3 Mon Sep 17 00:00:00 2001
From: Jan Vrany <jan@...>
Date: Tue, 20 Sep 2022 13:00:58 +0100
Subject: [PATCH] Fix resuming `zrep refresh`

In order to support resume of interrupted send, `zfs recv` must always
be called with `-s` option. This commit does so for `zrep refresh`.
---
 zrep      | 6 ++++--
 zrep_sync | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/zrep b/zrep
index 2861c02..e5e64ae 100755
--- a/zrep
+++ b/zrep
@@ -2084,6 +2084,7 @@ zrep_sync(){
 zrep_refresh(){
 	typeset srcfs destfs desthost newsnap newseq master
 	typeset force
+	typeset recv_s
 
 	if [[ "$ZREP_FORCE" == "-f" ]] ; then
 		force=-F
@@ -2134,16 +2135,17 @@ zrep_refresh(){
 
 	_debugprint refresh step 2: Pulling $newsnap
 	if [[ "$ZREP_RESUME" != "" ]] ; then
+		recv_s="-s"
 		token=`$ZFSGETVAL receive_resume_token $destfs`
 		if [[ "$token" == "-" ]] ; then token="" ; fi
 	fi
 
 	if [[ "$BBCP" != "" ]] ; then
 		$BBCP -N io "$srchost:$ZREP_PATH _refreshpull $newsnap $token" \
-		  "zfs recv $force $destfs"
+		  "zfs recv $recv_s $force $destfs"
 	else
 		zrep_ssh $srchost "$ZREP_PATH ${ZREP_R} _refreshpull $newsnap $token ${Z_F_OUT}" |
-		  eval ${Z_F_IN} zfs recv $force $destfs
+		  eval ${Z_F_IN} zfs recv $recv_s $force $destfs
 	fi
 	if [[ $? -ne 0 ]] ; then
 		zrep_errquit Unforseen error pulling snapshot $newsnap from $srchost
diff --git a/zrep_sync b/zrep_sync
index a43f8f3..0dc4f75 100644
--- a/zrep_sync
+++ b/zrep_sync
@@ -562,6 +562,7 @@ zrep_sync(){
 zrep_refresh(){
 	typeset srcfs destfs desthost newsnap newseq master
 	typeset force
+	typeset recv_s
 
 	if [[ "$ZREP_FORCE" == "-f" ]] ; then
 		force=-F
@@ -612,16 +613,17 @@ zrep_refresh(){
 
 	_debugprint refresh step 2: Pulling $newsnap
 	if [[ "$ZREP_RESUME" != "" ]] ; then
+		recv_s="-s"
 		token=`$ZFSGETVAL receive_resume_token $destfs`
 		if [[ "$token" == "-" ]] ; then token="" ; fi
 	fi
 
 	if [[ "$BBCP" != "" ]] ; then
 		$BBCP -N io "$srchost:$ZREP_PATH _refreshpull $newsnap $token" \
-		  "zfs recv $force $destfs"
+		  "zfs recv $recv_s $force $destfs"
 	else
 		zrep_ssh $srchost "$ZREP_PATH ${ZREP_R} _refreshpull $newsnap $token ${Z_F_OUT}" |
-		  eval ${Z_F_IN} zfs recv $force $destfs
+		  eval ${Z_F_IN} zfs recv $recv_s $force $destfs
 	fi
 	if [[ $? -ne 0 ]] ; then
 		zrep_errquit Unforseen error pulling snapshot $newsnap from $srchost
-- 
2.35.1

from zrep.

ppbrown avatar ppbrown commented on August 27, 2024

from zrep.

janvrany avatar janvrany commented on August 27, 2024

Right, but zfs recv is called without -s regardless of recursive sync or not - at least this is my understanding of the code. ZFS manpage (at least on OpenZFS, do not have Solaris at hand) says:

-s If the receive is interrupted, save the partially received state, rather than delet-
   ing it.  Interruption may be due to...

so it seems to me that -s has to be passed down to zfs recv in order to make resume to work (whether we're resuming or not). And I do not see that in the code - obviously, I may well overlooked it.

from zrep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.