Skip to content

Commit

Permalink
Merging from work branch
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Sep 5, 2019
2 parents 7e80b07 + 6cab32a commit 990d789
Show file tree
Hide file tree
Showing 61 changed files with 2,569 additions and 749 deletions.
11 changes: 7 additions & 4 deletions cs/benchmark/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Runtime.CompilerServices;
using System.Diagnostics;
using FASTER.core;
using System.Collections.Generic;

namespace FASTER.benchmark
{
Expand All @@ -28,9 +29,9 @@ public void DeleteCompletionCallback(ref Key key, Empty ctx)
{
}

public void CheckpointCompletionCallback(Guid sessionId, long serialNum)
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint)
{
Debug.WriteLine("Session {0} reports persistence until {1}", sessionId, serialNum);
Debug.WriteLine("Session {0} reports persistence until {1}", sessionId, commitPoint.UntilSerialNo);
}

// Read functions
Expand All @@ -54,9 +55,10 @@ public void SingleWriter(ref Key key, ref Value src, ref Value dst)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ConcurrentWriter(ref Key key, ref Value src, ref Value dst)
public bool ConcurrentWriter(ref Key key, ref Value src, ref Value dst)
{
dst = src;
return true;
}

// RMW functions
Expand All @@ -67,9 +69,10 @@ public void InitialUpdater(ref Key key, ref Input input, ref Value value)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InPlaceUpdater(ref Key key, ref Input input, ref Value value)
public bool InPlaceUpdater(ref Key key, ref Input input, ref Value value)
{
value.value += input.value;
return true;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
7 changes: 4 additions & 3 deletions cs/playground/ClassCache/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void ConcurrentReader(ref CacheKey key, ref CacheInput input, ref CacheVa
dst.value = value;
}

public void ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
public bool ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
{
dst = src;
return true;
}

public void CopyUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue oldValue, ref CacheValue newValue)
Expand All @@ -107,12 +108,12 @@ public void InitialUpdater(ref CacheKey key, ref CacheInput input, ref CacheValu
throw new NotImplementedException();
}

public void InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
public bool InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
{
throw new NotImplementedException();
}

public void CheckpointCompletionCallback(Guid sessionId, long serialNum)
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint)
{
throw new NotImplementedException();
}
Expand Down
7 changes: 4 additions & 3 deletions cs/playground/ClassCacheMT/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void ConcurrentReader(ref CacheKey key, ref CacheInput input, ref CacheVa
dst.value = value;
}

public void ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
public bool ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
{
dst = src;
return true;
}

public void CopyUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue oldValue, ref CacheValue newValue)
Expand All @@ -107,12 +108,12 @@ public void InitialUpdater(ref CacheKey key, ref CacheInput input, ref CacheValu
throw new NotImplementedException();
}

public void InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
public bool InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
{
throw new NotImplementedException();
}

public void CheckpointCompletionCallback(Guid sessionId, long serialNum)
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint)
{
throw new NotImplementedException();
}
Expand Down
6 changes: 3 additions & 3 deletions cs/playground/ClassSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ public class MyFunctions : IFunctions<MyKey, MyValue, MyInput, MyOutput, MyConte
{
public void InitialUpdater(ref MyKey key, ref MyInput input, ref MyValue value) => value.value = input.value;
public void CopyUpdater(ref MyKey key, ref MyInput input, ref MyValue oldValue, ref MyValue newValue) => newValue = oldValue;
public void InPlaceUpdater(ref MyKey key, ref MyInput input, ref MyValue value) => value.value += input.value;
public bool InPlaceUpdater(ref MyKey key, ref MyInput input, ref MyValue value) { value.value += input.value; return true; }


public void SingleReader(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst) => dst.value = value;
public void SingleWriter(ref MyKey key, ref MyValue src, ref MyValue dst) => dst = src;
public void ConcurrentReader(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst) => dst.value = value;
public void ConcurrentWriter(ref MyKey key, ref MyValue src, ref MyValue dst) => dst = src;
public bool ConcurrentWriter(ref MyKey key, ref MyValue src, ref MyValue dst) { dst = src; return true; }

public void ReadCompletionCallback(ref MyKey key, ref MyInput input, ref MyOutput output, MyContext ctx, Status status) { }
public void UpsertCompletionCallback(ref MyKey key, ref MyValue value, MyContext ctx) { }
public void RMWCompletionCallback(ref MyKey key, ref MyInput input, MyContext ctx, Status status) { }
public void DeleteCompletionCallback(ref MyKey key, MyContext ctx) { }
public void CheckpointCompletionCallback(Guid sessionId, long serialNum) { }
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint) { }
}

class Program
Expand Down
9 changes: 6 additions & 3 deletions cs/playground/FixedLenStructSample/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using FASTER.core;
using System;
using System.Collections.Generic;

namespace FixedLenStructSample
{
Expand All @@ -11,7 +12,7 @@ namespace FixedLenStructSample
/// </summary>
public class FixedLenFunctions : IFunctions<FixedLenKey, FixedLenValue, string, string, Empty>
{
public void CheckpointCompletionCallback(Guid sessionId, long serialNum)
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint)
{
}

Expand All @@ -20,9 +21,10 @@ public void ConcurrentReader(ref FixedLenKey key, ref string input, ref FixedLen
dst = value.ToString();
}

public void ConcurrentWriter(ref FixedLenKey key, ref FixedLenValue src, ref FixedLenValue dst)
public bool ConcurrentWriter(ref FixedLenKey key, ref FixedLenValue src, ref FixedLenValue dst)
{
src.CopyTo(ref dst);
return true;
}

public void CopyUpdater(ref FixedLenKey key, ref string input, ref FixedLenValue oldValue, ref FixedLenValue newValue)
Expand All @@ -37,8 +39,9 @@ public void InitialUpdater(ref FixedLenKey key, ref string input, ref FixedLenVa
{
}

public void InPlaceUpdater(ref FixedLenKey key, ref string input, ref FixedLenValue value)
public bool InPlaceUpdater(ref FixedLenKey key, ref string input, ref FixedLenValue value)
{
return true;
}

public void ReadCompletionCallback(ref FixedLenKey key, ref string input, ref string output, Empty ctx, Status status)
Expand Down
7 changes: 4 additions & 3 deletions cs/playground/PeriodicCompaction/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void ConcurrentReader(ref CacheKey key, ref CacheInput input, ref CacheVa
dst.value = value;
}

public void ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
public bool ConcurrentWriter(ref CacheKey key, ref CacheValue src, ref CacheValue dst)
{
dst = src;
return true;
}

public void CopyUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue oldValue, ref CacheValue newValue)
Expand All @@ -107,12 +108,12 @@ public void InitialUpdater(ref CacheKey key, ref CacheInput input, ref CacheValu
throw new NotImplementedException();
}

public void InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
public bool InPlaceUpdater(ref CacheKey key, ref CacheInput input, ref CacheValue value)
{
throw new NotImplementedException();
}

public void CheckpointCompletionCallback(Guid sessionId, long serialNum)
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint)
{
throw new NotImplementedException();
}
Expand Down
14 changes: 8 additions & 6 deletions cs/playground/StructSample/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using FASTER.core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;

Expand All @@ -19,19 +20,19 @@ public class Sample1Funcs : IFunctions<long, long, long, long, Empty>

// Write functions
public void SingleWriter(ref long key, ref long src, ref long dst) => dst = src;
public void ConcurrentWriter(ref long key, ref long src, ref long dst) => dst = src;
public bool ConcurrentWriter(ref long key, ref long src, ref long dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref long key, ref long input, ref long value) => value = input;
public void CopyUpdater(ref long key, ref long input, ref long oldv, ref long newv) => newv = oldv + input;
public void InPlaceUpdater(ref long key, ref long input, ref long value) => value += input;
public bool InPlaceUpdater(ref long key, ref long input, ref long value) { value += input; return true; }

// Completion callbacks
public void ReadCompletionCallback(ref long key, ref long input, ref long output, Empty ctx, Status s) { }
public void UpsertCompletionCallback(ref long key, ref long value, Empty ctx) { }
public void DeleteCompletionCallback(ref long key, Empty ctx) { }
public void RMWCompletionCallback(ref long key, ref long input, Empty ctx, Status s) { }
public void CheckpointCompletionCallback(Guid sessionId, long serialNum) { }
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint) { }
}


Expand All @@ -46,7 +47,7 @@ public class Sample2Funcs : IFunctions<Key, Value, Input, Output, Empty>

// Write functions
public void SingleWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public void ConcurrentWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public bool ConcurrentWriter(ref Key key, ref Value src, ref Value dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref Key key, ref Input input, ref Value value)
Expand All @@ -59,17 +60,18 @@ public void CopyUpdater(ref Key key, ref Input input, ref Value oldValue, ref Va
newValue.vfield1 = oldValue.vfield1 + input.ifield1;
newValue.vfield2 = oldValue.vfield2 + input.ifield2;
}
public void InPlaceUpdater(ref Key key, ref Input input, ref Value value)
public bool InPlaceUpdater(ref Key key, ref Input input, ref Value value)
{
value.vfield1 += input.ifield1;
value.vfield2 += input.ifield2;
return true;
}

// Completion callbacks
public void ReadCompletionCallback(ref Key key, ref Input input, ref Output output, Empty ctx, Status status) { }
public void UpsertCompletionCallback(ref Key key, ref Value output, Empty ctx) { }
public void DeleteCompletionCallback(ref Key key, Empty ctx) { }
public void RMWCompletionCallback(ref Key key, ref Input output, Empty ctx, Status status) { }
public void CheckpointCompletionCallback(Guid sessionId, long serialNum) { }
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint) { }
}
}
14 changes: 8 additions & 6 deletions cs/playground/StructSampleCore/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using FASTER.core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;

Expand All @@ -19,19 +20,19 @@ public class Sample1Funcs : IFunctions<long, long, long, long, Empty>

// Write functions
public void SingleWriter(ref long key, ref long src, ref long dst) => dst = src;
public void ConcurrentWriter(ref long key, ref long src, ref long dst) => dst = src;
public bool ConcurrentWriter(ref long key, ref long src, ref long dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref long key, ref long input, ref long value) => value = input;
public void CopyUpdater(ref long key, ref long input, ref long oldv, ref long newv) => newv = oldv + input;
public void InPlaceUpdater(ref long key, ref long input, ref long value) => value += input;
public bool InPlaceUpdater(ref long key, ref long input, ref long value) { value += input; return true; }

// Completion callbacks
public void ReadCompletionCallback(ref long key, ref long input, ref long output, Empty ctx, Status s) { }
public void UpsertCompletionCallback(ref long key, ref long value, Empty ctx) { }
public void DeleteCompletionCallback(ref long key, Empty ctx) { }
public void RMWCompletionCallback(ref long key, ref long input, Empty ctx, Status s) { }
public void CheckpointCompletionCallback(Guid sessionId, long serialNum) { }
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint) { }
}


Expand All @@ -46,7 +47,7 @@ public class Sample2Funcs : IFunctions<Key, Value, Input, Output, Empty>

// Write functions
public void SingleWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public void ConcurrentWriter(ref Key key, ref Value src, ref Value dst) => dst = src;
public bool ConcurrentWriter(ref Key key, ref Value src, ref Value dst) { dst = src; return true; }

// RMW functions
public void InitialUpdater(ref Key key, ref Input input, ref Value value)
Expand All @@ -59,17 +60,18 @@ public void CopyUpdater(ref Key key, ref Input input, ref Value oldValue, ref Va
newValue.vfield1 = oldValue.vfield1 + input.ifield1;
newValue.vfield2 = oldValue.vfield2 + input.ifield2;
}
public void InPlaceUpdater(ref Key key, ref Input input, ref Value value)
public bool InPlaceUpdater(ref Key key, ref Input input, ref Value value)
{
value.vfield1 += input.ifield1;
value.vfield2 += input.ifield2;
return true;
}

// Completion callbacks
public void ReadCompletionCallback(ref Key key, ref Input input, ref Output output, Empty ctx, Status status) { }
public void UpsertCompletionCallback(ref Key key, ref Value output, Empty ctx) { }
public void DeleteCompletionCallback(ref Key key, Empty ctx) { }
public void RMWCompletionCallback(ref Key key, ref Input output, Empty ctx, Status status) { }
public void CheckpointCompletionCallback(Guid sessionId, long serialNum) { }
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint) { }
}
}
4 changes: 2 additions & 2 deletions cs/playground/SumStore/RecoveryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void RunThread(int threadId, bool continueSession)
// Register with thread
do
{
sno = fht.ContinueSession(sessionGuid);
sno = fht.ContinueSession(sessionGuid).UntilSerialNo;
} while (sno == -1);
Console.WriteLine("Session {0} recovered until {1}", sessionGuid, sno);
sno++;
Expand Down Expand Up @@ -195,7 +195,7 @@ private void Test()
// Register with thread
long _sno = -1;
do {
_sno = fht.ContinueSession(sessionGuid);
_sno = fht.ContinueSession(sessionGuid).UntilSerialNo;
} while (_sno == -1);
sno.Add(_sno);

Expand Down
10 changes: 6 additions & 4 deletions cs/playground/SumStore/SumStoreTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public void DeleteCompletionCallback(ref AdId key, Empty ctx)
{
}

public void CheckpointCompletionCallback(Guid sessionId, long serialNum)
public void CheckpointCompletionCallback(Guid sessionId, CommitPoint commitPoint)
{
Console.WriteLine("Session {0} reports persistence until {1}", sessionId, serialNum);
Console.WriteLine("Session {0} reports persistence until {1}", sessionId, commitPoint.UntilSerialNo);
}

// Read functions
Expand All @@ -84,9 +84,10 @@ public void SingleWriter(ref AdId key, ref NumClicks src, ref NumClicks dst)
dst = src;
}

public void ConcurrentWriter(ref AdId key, ref NumClicks src, ref NumClicks dst)
public bool ConcurrentWriter(ref AdId key, ref NumClicks src, ref NumClicks dst)
{
dst = src;
return true;
}

// RMW functions
Expand All @@ -95,9 +96,10 @@ public void InitialUpdater(ref AdId key, ref Input input, ref NumClicks value)
value = input.numClicks;
}

public void InPlaceUpdater(ref AdId key, ref Input input, ref NumClicks value)
public bool InPlaceUpdater(ref AdId key, ref Input input, ref NumClicks value)
{
Interlocked.Add(ref value.numClicks, input.numClicks.numClicks);
return true;
}

public void CopyUpdater(ref AdId key, ref Input input, ref NumClicks oldValue, ref NumClicks newValue)
Expand Down
Loading

0 comments on commit 990d789

Please sign in to comment.