From 8c27e57edfe2171fa57fcb2a5ce4bdbcce36e99c Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Mon, 30 Mar 2020 11:36:20 +0200 Subject: [PATCH] endpoint: environment variable for disabling cleanup of stale step holds on HintMostRecentCommonAncestor --- endpoint/endpoint.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go index 218403f..14de061 100644 --- a/endpoint/endpoint.go +++ b/endpoint/endpoint.go @@ -149,13 +149,19 @@ func (p *Sender) HintMostRecentCommonAncestor(ctx context.Context, r *pdu.HintMo } // cleanup previous steps - if err := ReleaseStepCummulativeInclusive(ctx, fs, mostRecentVersion, p.jobId); err != nil { - return nil, errors.Wrap(err, "cannot cleanup prior invocation's step holds and bookmarks") + if !hintMostRecentCommonAncestorDoNotCleanupStepHolds { + if err := ReleaseStepCummulativeInclusive(ctx, fs, mostRecentVersion, p.jobId); err != nil { + return nil, errors.Wrap(err, "cannot cleanup prior invocation's step holds and bookmarks") + } + } else { + log.Info("skipping cleanup of prior invocations' step holds due to environment variable setting") } return &pdu.HintMostRecentCommonAncestorRes{}, nil } +var hintMostRecentCommonAncestorDoNotCleanupStepHolds = envconst.Bool("ZREPL_ENDPOINT_HINT_MOST_RECENT_DO_NOT_CLEANUP_STEPH_HOLDS", false) + var maxConcurrentZFSSendSemaphore = semaphore.New(envconst.Int64("ZREPL_ENDPOINT_MAX_CONCURRENT_SEND", 10)) func uncheckedSendArgsFromPDU(fsv *pdu.FilesystemVersion) *zfs.ZFSSendArgVersion {