Skip to content

Commit

Permalink
Remove unused function and clean up unlockIdx, per #406 (#416)
Browse files Browse the repository at this point in the history
Co-authored-by: Badrish Chandramouli <[email protected]>
  • Loading branch information
TedHartMS and badrishc authored May 23, 2024
1 parent 94df278 commit 7880abe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
14 changes: 0 additions & 14 deletions libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
Expand Down Expand Up @@ -739,19 +738,6 @@ public void ResetModified(ref Key key)

#region Pending Operations

/// <summary>
/// Get list of pending requests (for current session)
/// </summary>
/// <returns></returns>
public IEnumerable<long> GetPendingRequests()
{
foreach (var kvp in ctx.prevCtx?.ioPendingRequests)
yield return kvp.Value.serialNum;

foreach (var kvp in ctx.ioPendingRequests)
yield return kvp.Value.serialNum;
}

/// <inheritdoc/>
public bool CompletePending(bool wait = false, bool spinWaitForCommit = false)
=> CompletePending(false, wait, spinWaitForCommit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ internal static bool DoInternalTryLock<TsavoriteSession, TLockableKey>(Tsavorite
continue; // Success; continue to the next key.
}

// Cancellation or lock failure before we've completed all keys; we may or may not have locked the current key. Unlock anything we've locked.
var unlockIdx = keyIdx - (status == OperationStatus.SUCCESS ? 0 : 1);
DoInternalUnlock(clientSession, keys, start, unlockIdx);
// Cancellation or lock failure before we've completed all keys; we have not locked the current key. Unlock anything we've locked.
DoInternalUnlock(clientSession, keys, start, keyIdx - 1);

// Lock failure is the only place we check the timeout. If we've exceeded that, or if we've had a cancellation, return false.
if (cancellationToken.IsCancellationRequested || DateTime.UtcNow.Ticks - startTime.Ticks > timeout.Ticks)
Expand Down

0 comments on commit 7880abe

Please sign in to comment.