microsoft/FASTER · error · FasterException

Fast forwarding a commit is only allowed when no cookie…

Error message

Fast forwarding a commit is only allowed when no cookie, commit num, or callback is specified

What it means

The fast-forward commit overload of FasterLog was called while also supplying a cookie, a proposed commit number, or a callback. Fast-forwarding resets commit metadata and is only defined when no extra commit payload or hook is attached; the guard at FasterLog.cs:2707 rejects any combination.

Solutions

  1. Call the fast-forward commit with only the fastForwardAllowed flag: pass null cookie, -1 commit num, null callback.
  2. If you need a cookie or callback, do a normal (non-fast-forward) CommitAsync instead.
  3. Split the code path: use fast-forward only for recovery/replica catch-up, normal commit for appends.
  4. Audit wrapper methods that forward all optional parameters and default them to null/-1 when fast-forwarding.

Example fix

// before
await log.CommitAsync(fastForward: true, cookie: myCookie, commitNum: seq, callback: OnCommit);

// after
await log.CommitAsync(fastForward: true, cookie: null, commitNum: -1, callback: null);
Defensive patterns

Strategy: validation

Validate before calling

if (fastForward && (cookie != null || commitNum != -1 || callback != null)) throw new ArgumentException("Fast-forward commit accepts no cookie, commit num, or callback");

Try / catch

try { await log.CommitAsync(true, null, -1, null); } catch (FasterException ex) when (ex.Message.Contains("Fast forwarding a commit")) { /* fall back to normal commit */ }

Prevention

When it happens

Trigger: Calling CommitAsync(fastForwardAllowed: true, cookie: ..., callback: ...) or passing a proposedCommitNum != -1 together with fastForwardAllowed = true.

Common situations: Developers reusing one generic CommitAsync wrapper with optional parameters, so cookie/callback arguments that were null in normal commits end up non-null when the fast-forward flag is enabled during recovery or replication catch-up.

Related errors


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/7731594088b8058c. Report an issue: GitHub.

Appendix: source

Thrown at cs/src/core/FasterLog/FasterLog.cs:2707

            }

            record.Return();
            return length;
        }


        private bool CommitInternal(out long commitTail, out long actualCommitNum, bool fastForwardAllowed, byte[] cookie, long proposedCommitNum, Action callback)
        {
            if (cannedException != null)
                throw cannedException;

            commitTail = actualCommitNum = 0;

            if (readOnlyMode)
                throw new FasterException("Cannot commit in read-only mode");

            if (fastForwardAllowed && (cookie != null || proposedCommitNum != -1 || callback != null))
                throw new FasterException(
                    "Fast forwarding a commit is only allowed when no cookie, commit num, or callback is specified");

            var info = new FasterLogRecoveryInfo
            {
                FastForwardAllowed = fastForwardAllowed,
                Cookie = cookie,
                Callback = callback,
            };
            info.SnapshotIterators(PersistedIterators);
            var commitRequired = ShouldCommmitMetadata(ref info) || (commitCoveredAddress < TailAddress);
            // Only apply commit policy if not a strong commit
            if (fastForwardAllowed && !commitPolicy.AdmitCommit(TailAddress, commitRequired))
                return false;

            // This critical section serializes commit record creation / commit content generation and ensures that the
            // long address are sorted in outstandingCommitRecords. Ok because we do not expect heavy contention on the
            // commit code path
            lock (ongoingCommitRequests)

View on GitHub (pinned to 321d872eab)