From 03af7ca907f33895f221ec9e036e55335d8012d6 Mon Sep 17 00:00:00 2001 From: Badrish Chandramouli Date: Sun, 10 Oct 2021 10:03:34 -0700 Subject: [PATCH] minor adds --- cs/src/core/Allocator/GenericAllocator.cs | 10 ++++++++-- cs/src/core/ClientSession/ClientSession.cs | 4 +--- cs/src/core/Index/FASTER/FASTERImpl.cs | 2 +- cs/src/core/VarLen/SpanByteAndMemory.cs | 9 +++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/cs/src/core/Allocator/GenericAllocator.cs b/cs/src/core/Allocator/GenericAllocator.cs index c00d2811d..9bb584d7a 100644 --- a/cs/src/core/Allocator/GenericAllocator.cs +++ b/cs/src/core/Allocator/GenericAllocator.cs @@ -54,13 +54,19 @@ public GenericAllocator(LogSettings settings, SerializerSettings ser if ((!keyBlittable) && (settings.LogDevice as NullDevice == null) && ((SerializerSettings == null) || (SerializerSettings.keySerializer == null))) { - Debug.WriteLine("Key is not blittable, but no serializer specified via SerializerSettings. Using (slow) DataContractSerializer as default."); +#if DEBUG + if (typeof(Key) != typeof(byte[]) && typeof(Key) != typeof(string)) + Debug.WriteLine("Key is not blittable, but no serializer specified via SerializerSettings. Using (slow) DataContractSerializer as default."); +#endif SerializerSettings.keySerializer = ObjectSerializer.Get(); } if ((!valueBlittable) && (settings.LogDevice as NullDevice == null) && ((SerializerSettings == null) || (SerializerSettings.valueSerializer == null))) { - Debug.WriteLine("Value is not blittable, but no serializer specified via SerializerSettings. Using (slow) DataContractSerializer as default."); +#if DEBUG + if (typeof(Value) != typeof(byte[]) && typeof(Value) != typeof(string)) + Debug.WriteLine("Value is not blittable, but no serializer specified via SerializerSettings. Using (slow) DataContractSerializer as default."); +#endif SerializerSettings.valueSerializer = ObjectSerializer.Get(); } diff --git a/cs/src/core/ClientSession/ClientSession.cs b/cs/src/core/ClientSession/ClientSession.cs index 38e1bdcad..4babb91db 100644 --- a/cs/src/core/ClientSession/ClientSession.cs +++ b/cs/src/core/ClientSession/ClientSession.cs @@ -1144,9 +1144,7 @@ public void DeleteCompletionCallback(ref Key key, Context ctx) => _clientSession.functions.DeleteCompletionCallback(ref key, ctx); public int GetInitialLength(ref Input input) - { - return _clientSession.variableLengthStruct.GetInitialLength(ref input); - } + => _clientSession.variableLengthStruct.GetInitialLength(ref input); public int GetLength(ref Value t, ref Input input) => _clientSession.variableLengthStruct.GetLength(ref t, ref input); diff --git a/cs/src/core/Index/FASTER/FASTERImpl.cs b/cs/src/core/Index/FASTER/FASTERImpl.cs index c78091f49..6a762bc03 100644 --- a/cs/src/core/Index/FASTER/FASTERImpl.cs +++ b/cs/src/core/Index/FASTER/FASTERImpl.cs @@ -1575,7 +1575,7 @@ ref hlog.GetValue(newPhysicalAddress), } else { - // CAS failed. Fall through to call InternalRMW again to restart the sequence and return that status. + // CAS failed. Retry in loop. hlog.GetInfo(newPhysicalAddress).Invalid = true; } #endregion diff --git a/cs/src/core/VarLen/SpanByteAndMemory.cs b/cs/src/core/VarLen/SpanByteAndMemory.cs index 1afb6de8b..3b20c66ca 100644 --- a/cs/src/core/VarLen/SpanByteAndMemory.cs +++ b/cs/src/core/VarLen/SpanByteAndMemory.cs @@ -33,6 +33,15 @@ public SpanByteAndMemory(SpanByte spanByte) Memory = default; } + /// + /// Constructor using SpanByte at given (fixed) pointer, of given length + /// + public SpanByteAndMemory(void* pointer, int length) + { + SpanByte = new SpanByte(length, (IntPtr)pointer); + Memory = default; + } + /// /// Get length ///