diff --git a/.azure/pipelines/azure-pipelines-compliance.yml b/.azure/pipelines/azure-pipelines-compliance.yml index 59d5732e9d..ef0f8eb21f 100644 --- a/.azure/pipelines/azure-pipelines-compliance.yml +++ b/.azure/pipelines/azure-pipelines-compliance.yml @@ -17,14 +17,6 @@ jobs: clean: False submodules: recursive persistCredentials: True - - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 6.0.x' - inputs: - version: 6.0.x - - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 7.0.x' - inputs: - version: 7.0.x - task: UseDotNet@2 displayName: 'Use .NET Core sdk 8.0.x' inputs: diff --git a/.azure/pipelines/azure-pipelines-external-release.yml b/.azure/pipelines/azure-pipelines-external-release.yml index e48274ba5d..a954ce3f30 100644 --- a/.azure/pipelines/azure-pipelines-external-release.yml +++ b/.azure/pipelines/azure-pipelines-external-release.yml @@ -27,14 +27,6 @@ jobs: clean: False submodules: recursive persistCredentials: True - - task: UseDotNet@2 - displayName: Use .NET Core sdk 6.0.x - inputs: - version: 6.0.x - - task: UseDotNet@2 - displayName: Use .NET Core sdk 7.0.x - inputs: - version: 7.0.x - task: UseDotNet@2 displayName: Use .NET Core sdk 8.0.x inputs: diff --git a/.azure/pipelines/azure-pipelines-internal-release.yml b/.azure/pipelines/azure-pipelines-internal-release.yml index 7f048df1b3..61cbd273f9 100644 --- a/.azure/pipelines/azure-pipelines-internal-release.yml +++ b/.azure/pipelines/azure-pipelines-internal-release.yml @@ -21,14 +21,6 @@ jobs: clean: False submodules: recursive persistCredentials: True - - task: UseDotNet@2 - displayName: Use .NET Core sdk 6.0.x - inputs: - version: 6.0.x - - task: UseDotNet@2 - displayName: Use .NET Core sdk 7.0.x - inputs: - version: 7.0.x - task: UseDotNet@2 displayName: Use .NET Core sdk 8.0.x inputs: diff --git a/.azure/pipelines/azure-pipelines-performance.yml b/.azure/pipelines/azure-pipelines-performance.yml index 96636ac82b..6806f286e0 100644 --- a/.azure/pipelines/azure-pipelines-performance.yml +++ b/.azure/pipelines/azure-pipelines-performance.yml @@ -28,18 +28,6 @@ jobs: timeoutInMinutes: 75 steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: @@ -199,16 +187,6 @@ jobs: submodules: recursive persistCredentials: True - - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 6.0.x' - inputs: - version: 6.0.x - - - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 7.0.x' - inputs: - version: 7.0.x - - task: UseDotNet@2 displayName: 'Use .NET Core sdk 8.0.x' inputs: diff --git a/.azure/pipelines/azure-pipelines-tsavorite-codecoverage.yml b/.azure/pipelines/azure-pipelines-tsavorite-codecoverage.yml index 6d39a5ae8a..1a1e68ea4c 100644 --- a/.azure/pipelines/azure-pipelines-tsavorite-codecoverage.yml +++ b/.azure/pipelines/azure-pipelines-tsavorite-codecoverage.yml @@ -17,18 +17,6 @@ jobs: timeoutInMinutes: 125 steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: @@ -120,18 +108,6 @@ jobs: timeoutInMinutes: 125 steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: diff --git a/.azure/pipelines/azure-pipelines-tsavorite.yml b/.azure/pipelines/azure-pipelines-tsavorite.yml index 1b1d692ee8..2a238fd6bb 100644 --- a/.azure/pipelines/azure-pipelines-tsavorite.yml +++ b/.azure/pipelines/azure-pipelines-tsavorite.yml @@ -25,18 +25,6 @@ jobs: buildConfiguration: 'Release' steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: @@ -132,18 +120,6 @@ jobs: buildConfiguration: 'Release' steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: diff --git a/.azure/pipelines/azure-pipelines.yml b/.azure/pipelines/azure-pipelines.yml index a2038db35f..9e0b27ee9c 100644 --- a/.azure/pipelines/azure-pipelines.yml +++ b/.azure/pipelines/azure-pipelines.yml @@ -25,18 +25,6 @@ jobs: buildConfiguration: 'Release' steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: @@ -125,18 +113,6 @@ jobs: buildConfiguration: 'Release' steps: - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.0.x' - - - task: UseDotNet@2 - displayName: Use .NET 7.0 - inputs: - packageType: 'sdk' - version: '7.0.x' - - task: UseDotNet@2 displayName: Use .NET 8.0 inputs: diff --git a/Directory.Build.props b/Directory.Build.props index 5d3cc76425..2589702be8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 diff --git a/Garnet.nuspec b/Garnet.nuspec index 9dab79ae10..f685eee975 100644 --- a/Garnet.nuspec +++ b/Garnet.nuspec @@ -31,30 +31,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/benchmark/BDN.benchmark/Program.cs b/benchmark/BDN.benchmark/Program.cs index 992c1138df..06f1b46bde 100644 --- a/benchmark/BDN.benchmark/Program.cs +++ b/benchmark/BDN.benchmark/Program.cs @@ -18,7 +18,6 @@ public class BaseConfig : ManualConfig { - public Job Net6BaseJob { get; } public Job Net8BaseJob { get; } public BaseConfig() @@ -29,12 +28,10 @@ public BaseConfig() var baseJob = Job.Default.WithGcServer(true); - Net6BaseJob = baseJob.WithRuntime(CoreRuntime.Core60); Net8BaseJob = baseJob.WithRuntime(CoreRuntime.Core80) .WithEnvironmentVariables(new EnvironmentVariable("DOTNET_TieredPGO", "0")); AddJob( - Net6BaseJob.WithId(".NET 6"), Net8BaseJob.WithId(".NET 8") ); } diff --git a/benchmark/Resp.benchmark/Program.cs b/benchmark/Resp.benchmark/Program.cs index 241366b6f1..1ac276cbe7 100644 --- a/benchmark/Resp.benchmark/Program.cs +++ b/benchmark/Resp.benchmark/Program.cs @@ -27,8 +27,6 @@ namespace Resp.benchmark /// "--op GEOADDREM --dbsize 2048 -b 256 -t 1,2" /// - // Disabling for keeping compatibility with net6.0 and net7.0 -#pragma warning disable IDE0028 class Program { public static IConnectionMultiplexer redis; diff --git a/libs/cluster/Session/RespClusterSlotManagementCommands.cs b/libs/cluster/Session/RespClusterSlotManagementCommands.cs index 44fbed5ea7..e7849db463 100644 --- a/libs/cluster/Session/RespClusterSlotManagementCommands.cs +++ b/libs/cluster/Session/RespClusterSlotManagementCommands.cs @@ -35,7 +35,7 @@ private bool NetworkClusterAddSlots(int count, out bool invalidParameters) readHead = (int)(ptr - recvBufferPtr); // The slot parsing may give errorMessage even if the methods TryParseSlots true. - if (slotsParsed && errorMessage != default) + if (slotsParsed && !errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); @@ -81,7 +81,7 @@ private bool NetworkClusterAddSlotsRange(int count, out bool invalidParameters) readHead = (int)(ptr - recvBufferPtr); //The slot parsing may give errorMessage even if the TryParseSlots returns true. - if (slotsParsed && errorMessage != default) + if (slotsParsed && !errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); @@ -210,7 +210,7 @@ private bool NetworkClusterDelSlots(int count, out bool invalidParameters) readHead = (int)(ptr - recvBufferPtr); //The slot parsing may give errorMessage even if the TryParseSlots returns true. - if (slotsParsed && errorMessage != default) + if (slotsParsed && !errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); @@ -256,7 +256,7 @@ private bool NetworkClusterDelSlotsRange(int count, out bool invalidParameters) readHead = (int)(ptr - recvBufferPtr); //The slot parsing may give errorMessage even if the TryParseSlots returns true. - if (slotsParsed && errorMessage != default) + if (slotsParsed && !errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); @@ -335,7 +335,7 @@ private bool NetworkClusterDelKeysInSlotRange(int count, out bool invalidParamet readHead = (int)(ptr - recvBufferPtr); //The slot parsing may give errorMessage even if the TryParseSlots returns true. - if (slotsParsed && errorMessage != default) + if (slotsParsed && !errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); @@ -560,7 +560,7 @@ private bool NetworkClusterSetSlotsRange(int count, out bool invalidParameters) // Try to parse slot ranges. The parsing may give errorMessage even if the TryParseSlots returns true. var slotsParsed = TryParseSlots(_count, ref ptr, out var slots, out var errorMessage, range: true); - if (slotsParsed && errorMessage != default) + if (slotsParsed && !errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); diff --git a/libs/common/AsciiUtils.cs b/libs/common/AsciiUtils.cs index 78972a9175..e9b20b20c9 100644 --- a/libs/common/AsciiUtils.cs +++ b/libs/common/AsciiUtils.cs @@ -48,13 +48,7 @@ public static byte ToUpper(byte c) /// public static void ToUpperInPlace(Span command) { -#if NET8_0_OR_GREATER Ascii.ToUpperInPlace(command, out _); -#else - foreach (ref var c in command) - if (c > 96 && c < 123) - c -= 32; -#endif } /// diff --git a/libs/common/HashSlotUtils.cs b/libs/common/HashSlotUtils.cs index d96c54b0a0..99cf67aa26 100644 --- a/libs/common/HashSlotUtils.cs +++ b/libs/common/HashSlotUtils.cs @@ -14,11 +14,7 @@ public static unsafe class HashSlotUtils /// This table is based on the CRC-16-CCITT polynomial (0x1021) /// #pragma warning disable IDE0300 // Simplify collection initialization. Ignored to avoid dotnet-format bug, see https://github.com/dotnet/sdk/issues/39898 -#if NET7_0_OR_GREATER private static ReadOnlySpan Crc16Table => new ushort[256] -#else - private static readonly ushort[] Crc16Table = new ushort[256] -#endif { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, @@ -65,11 +61,7 @@ internal static unsafe ushort Hash(byte* data, int len) { ushort result = 0; -#if NET7_0_OR_GREATER ref var crc16Base = ref MemoryMarshal.GetReference(Crc16Table); -#else - ref var crc16Base = ref MemoryMarshal.GetArrayDataReference(Crc16Table); -#endif var end = data + len; while (data < end) { diff --git a/libs/server/Objects/SortedSet/SortedSetObjectImpl.cs b/libs/server/Objects/SortedSet/SortedSetObjectImpl.cs index 1bc81080af..12781f57b4 100644 --- a/libs/server/Objects/SortedSet/SortedSetObjectImpl.cs +++ b/libs/server/Objects/SortedSet/SortedSetObjectImpl.cs @@ -900,7 +900,7 @@ private void GetRank(ref ObjectInput input, ref SpanByteAndMemory output, bool a if (inRange < 0 || (inRange == 0 && minValueExclusive)) continue; - var outRange = maxValueChars == default ? -1 : new ReadOnlySpan(item.Item2).SequenceCompareTo(maxValueChars); + var outRange = maxValueChars.IsEmpty ? -1 : new ReadOnlySpan(item.Item2).SequenceCompareTo(maxValueChars); if (outRange > 0 || (outRange == 0 && maxValueExclusive)) break; diff --git a/libs/server/Objects/SortedSetGeo/GeoHash.cs b/libs/server/Objects/SortedSetGeo/GeoHash.cs index 3206fbb334..2cdedb5c96 100644 --- a/libs/server/Objects/SortedSetGeo/GeoHash.cs +++ b/libs/server/Objects/SortedSetGeo/GeoHash.cs @@ -4,9 +4,7 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -#if NET8_0_OR_GREATER using System.Runtime.Intrinsics.X86; -#endif using Garnet.common; @@ -167,7 +165,6 @@ static ulong Spread(uint x) return y; } -#if NET8_0_OR_GREATER // One may ask: Why is this also guarded behind AVX512F in addition to BMI2? // The answer is that on AMD platforms before Zen 3, the PDEP (and PEXT) are implemented in microcode // and work bit-by-bit basis. It has been measured[^1] that for every bit set in the mask operand, @@ -182,7 +179,7 @@ static ulong Spread(uint x) return Bmi2.X64.ParallelBitDeposit(x, 0x5555555555555555) | Bmi2.X64.ParallelBitDeposit(y, 0xAAAAAAAAAAAAAAAA); } -#endif + return Spread(x) | (Spread(y) << 1); } @@ -207,7 +204,6 @@ static uint Squash(ulong x) return (uint)y; } -#if NET8_0_OR_GREATER // See the rationale for the AVX512F guard in the MortonEncode method if (Bmi2.X64.IsSupported && Avx512F.IsSupported) { @@ -215,7 +211,7 @@ static uint Squash(ulong x) X: (uint)Bmi2.X64.ParallelBitExtract(x, 0x5555555555555555), Y: (uint)Bmi2.X64.ParallelBitExtract(x, 0xAAAAAAAAAAAAAAAA)); } -#endif + return (Squash(x), Squash(x >> 1)); } diff --git a/libs/server/Resp/AdminCommands.cs b/libs/server/Resp/AdminCommands.cs index c8649c8223..66516e49dc 100644 --- a/libs/server/Resp/AdminCommands.cs +++ b/libs/server/Resp/AdminCommands.cs @@ -456,7 +456,7 @@ private bool NetworkRegisterCs(int count, CustomCommandManager customCommandMana } // If no error is found, continue to try register custom commands in the server - if (errorMsg == null && + if (errorMsg.IsEmpty && TryRegisterCustomCommands(binaryPaths, cmdInfoPath, classNameToRegisterArgs, customCommandManager, out errorMsg)) { while (!RespWriteUtils.WriteDirect(CmdStrings.RESP_OK, ref dcurr, dend)) @@ -500,7 +500,7 @@ private bool NetworkModuleLoad(CustomCommandManager customCommandManager) } } - if (errorMsg != default) + if (!errorMsg.IsEmpty) { while (!RespWriteUtils.WriteError(errorMsg, ref dcurr, dend)) SendAndReset(); diff --git a/libs/server/Resp/ArrayCommands.cs b/libs/server/Resp/ArrayCommands.cs index b549168d68..b042eb9173 100644 --- a/libs/server/Resp/ArrayCommands.cs +++ b/libs/server/Resp/ArrayCommands.cs @@ -405,7 +405,7 @@ private bool NetworkSCAN(int count, ref TGarnetApi storageApi) } storageApi.DbScan(patternArgSlice, allKeys, cursorFromInput, out var cursor, out var keys, - typeParameterValue != default ? long.MaxValue : countValue, typeParameterValue); + !typeParameterValue.IsEmpty ? long.MaxValue : countValue, typeParameterValue); // Prepare values for output if (keys.Count == 0) diff --git a/libs/server/Resp/BasicCommands.cs b/libs/server/Resp/BasicCommands.cs index 9d90133644..3495e1a37c 100644 --- a/libs/server/Resp/BasicCommands.cs +++ b/libs/server/Resp/BasicCommands.cs @@ -549,7 +549,7 @@ private bool NetworkSETEXNX(int count, ref TGarnetApi storageApi) optUpperCased = false; } - if (errorMessage != default) + if (!errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); @@ -1385,7 +1385,7 @@ void ProcessHelloCommand(byte? respProtocolVersion, ReadOnlySpan username, this.respProtocolVersion = respProtocolVersion.Value; } - if (username != default) + if (!username.IsEmpty) { if (!this.AuthenticateUser(username, password)) { diff --git a/libs/server/Resp/Objects/ListCommands.cs b/libs/server/Resp/Objects/ListCommands.cs index 0c091b1057..ecfc9f8fdf 100644 --- a/libs/server/Resp/Objects/ListCommands.cs +++ b/libs/server/Resp/Objects/ListCommands.cs @@ -666,7 +666,7 @@ private bool ListIndex(int count, ref TGarnetApi storageApi) break; } - if (error != default) + if (!error.IsEmpty) { while (!RespWriteUtils.WriteDirect(error, ref dcurr, dend)) SendAndReset(); diff --git a/libs/server/Resp/Objects/SortedSetCommands.cs b/libs/server/Resp/Objects/SortedSetCommands.cs index b24af121d4..26e25eb2b2 100644 --- a/libs/server/Resp/Objects/SortedSetCommands.cs +++ b/libs/server/Resp/Objects/SortedSetCommands.cs @@ -690,7 +690,7 @@ private unsafe bool SortedSetIncrement(int count, ref TGarnetApi sto break; } - if (errorMessage != default) + if (!errorMessage.IsEmpty) { while (!RespWriteUtils.WriteError(errorMessage, ref dcurr, dend)) SendAndReset(); diff --git a/libs/server/Storage/Session/Common/ArrayKeyIterationFunctions.cs b/libs/server/Storage/Session/Common/ArrayKeyIterationFunctions.cs index 41b767255c..aaa5091e3d 100644 --- a/libs/server/Storage/Session/Common/ArrayKeyIterationFunctions.cs +++ b/libs/server/Storage/Session/Common/ArrayKeyIterationFunctions.cs @@ -50,7 +50,7 @@ internal unsafe bool DbScan(ArgSlice patternB, bool allKeys, long cursor, out lo keys = Keys; Type matchType = null; - if (typeObject != default) + if (!typeObject.IsEmpty) { if (typeObject.SequenceEqual(CmdStrings.ZSET) || typeObject.SequenceEqual(CmdStrings.zset)) { @@ -88,7 +88,7 @@ internal unsafe bool DbScan(ArgSlice patternB, bool allKeys, long cursor, out lo // Cursor is zero or not an object store address // Scan main store only for string or default key type - if ((cursor & IsObjectStoreCursor) == 0 && (typeObject == default || typeObject.SequenceEqual(CmdStrings.STRING) || typeObject.SequenceEqual(CmdStrings.stringt))) + if ((cursor & IsObjectStoreCursor) == 0 && (typeObject.IsEmpty || typeObject.SequenceEqual(CmdStrings.STRING) || typeObject.SequenceEqual(CmdStrings.stringt))) { basicContext.Session.ScanCursor(ref storeCursor, count, mainStoreDbScanFuncs, validateCursor: cursor != 0 && cursor != lastScanCursor); remainingCount -= Keys.Count; @@ -96,7 +96,7 @@ internal unsafe bool DbScan(ArgSlice patternB, bool allKeys, long cursor, out lo // Scan object store with the type parameter // Check the cursor value corresponds to the object store - if (!objectStoreBasicContext.IsNull && remainingCount > 0 && (typeObject == default || (!typeObject.SequenceEqual(CmdStrings.STRING) && !typeObject.SequenceEqual(CmdStrings.stringt)))) + if (!objectStoreBasicContext.IsNull && remainingCount > 0 && (typeObject.IsEmpty || (!typeObject.SequenceEqual(CmdStrings.STRING) && !typeObject.SequenceEqual(CmdStrings.stringt)))) { var validateCursor = storeCursor != 0 && storeCursor != lastScanCursor; storeCursor &= ~IsObjectStoreCursor; diff --git a/libs/server/Storage/Session/ObjectStore/SortedSetOps.cs b/libs/server/Storage/Session/ObjectStore/SortedSetOps.cs index 878afcc0ce..310d9aec56 100644 --- a/libs/server/Storage/Session/ObjectStore/SortedSetOps.cs +++ b/libs/server/Storage/Session/ObjectStore/SortedSetOps.cs @@ -532,7 +532,7 @@ public unsafe GarnetStatus SortedSetRange(ArgSlice key, ArgSlice inputLength += tmp.Length; // Operation order - if (operation != default) + if (!operation.IsEmpty) { fixed (byte* ptrOp = operation) {