Skip to content

Commit 985c129

Browse files
vazoisCopilot
andcommitted
Fix INFO all/default/everything returning empty response (#1645)
* Fix INFO all/default/everything returning empty response Implement support for INFO all, default, and everything options: - all: returns all DefaultInfo sections excluding module-generated ones - default: returns the default set of sections (same as no-arg INFO) - everything: returns all DefaultInfo sections including modules Added pre-declared HashSet collections (AllInfoSet, EverythingInfoSet) in GarnetInfoMetrics.cs derived from DefaultInfo to support these options. Updated InfoCommand.cs to use UnionWith with the new HashSets instead of silently skipping the ALL keyword. Added tests for all three options, verifying correct section inclusion/exclusion. Fixes #1643 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * make everything option use DefaultInfo * Add null/empty guard in GetSectionHeaders test helper Adds explicit asserts before splitting INFO output so test failures surface a clear message instead of a NullReferenceException. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * wip; restructuring cluster tests to reduce CI duration * separate dispose from close and configure socket to allow rapid connect * ensure socket is disposed succesfully * fix failing test * update global.json --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 24c1194 commit 985c129

File tree

11 files changed

+116
-22
lines changed

11 files changed

+116
-22
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "10.0.103",
3+
"version": "10.0.201",
44
"rollForward": "latestMajor",
55
"allowPrerelease": false
66
}

libs/server/Lua/LuaTimeoutManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ internal Registration RegisterForTimeout(SessionScriptCache cache)
263263
goto tryAgain;
264264
}
265265

266-
// Other threads might update registrations, so check that before returning
266+
// Other threads might update registrations, so check that before returning
267267
checkUnmodified:
268268
if ((updatedRegistrations = Interlocked.CompareExchange(ref registrations, curRegistrations, curRegistrations)) != curRegistrations)
269269
{

libs/server/Metrics/Info/GarnetInfoMetrics.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ class GarnetInfoMetrics
2323
_ => true
2424
})];
2525

26+
/// <summary>
27+
/// All info sections excluding module-generated ones.
28+
/// </summary>
29+
public static readonly HashSet<InfoMetricsType> AllInfoSet = [.. DefaultInfo.Where(e => e != InfoMetricsType.MODULES)];
30+
2631
MetricsItem[] serverInfo = null;
2732
MetricsItem[] memoryInfo = null;
2833
MetricsItem[] clusterInfo = null;

libs/server/Metrics/Info/InfoCommand.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,20 @@ private bool NetworkINFO()
2828
reset = true;
2929
else if (sbSection.EqualsUpperCaseSpanIgnoringCase("HELP"u8))
3030
help = true;
31-
else if (!sbSection.EqualsUpperCaseSpanIgnoringCase("ALL"u8))
31+
else if (sbSection.EqualsUpperCaseSpanIgnoringCase("ALL"u8))
32+
sections.UnionWith(GarnetInfoMetrics.AllInfoSet);
33+
else if (sbSection.EqualsUpperCaseSpanIgnoringCase("DEFAULT"u8))
34+
sections.UnionWith(GarnetInfoMetrics.DefaultInfo);
35+
else if (sbSection.EqualsUpperCaseSpanIgnoringCase("EVERYTHING"u8))
36+
sections.UnionWith(GarnetInfoMetrics.DefaultInfo);
37+
else if (parseState.TryGetInfoMetricsType(i, out var sectionType))
3238
{
33-
if (parseState.TryGetInfoMetricsType(i, out var sectionType))
34-
{
35-
sections.Add(sectionType);
36-
}
37-
else
38-
{
39-
invalid = true;
40-
invalidSection = parseState.GetString(i);
41-
}
39+
sections.Add(sectionType);
40+
}
41+
else
42+
{
43+
invalid = true;
44+
invalidSection = parseState.GetString(i);
4245
}
4346
}
4447
}

libs/server/Metrics/Info/InfoHelp.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class InfoHelp
1010
{
1111
internal const string HELP = "HELP";
1212
internal const string ALL = "ALL";
13+
internal const string DEFAULT = "DEFAULT";
14+
internal const string EVERYTHING = "EVERYTHING";
1315
internal const string RESET = "RESET";
1416

1517
public static List<string> GetInfoTypeHelpMessage()
@@ -30,7 +32,9 @@ public static List<string> GetInfoTypeHelpMessage()
3032
$"{nameof(InfoMetricsType.KEYSPACE)}: Database related statistics.",
3133
$"{nameof(InfoMetricsType.MODULES)}: Information related to loaded modules.",
3234
$"{nameof(InfoMetricsType.HLOGSCAN)}: Distribution of records in main store's hybrid log in-memory portion.",
33-
$"{nameof(ALL)}: Return all informational sections.",
35+
$"{nameof(ALL)}: Return all informational sections (excluding module generated ones).",
36+
$"{nameof(DEFAULT)}: Return the default set of informational sections.",
37+
$"{nameof(EVERYTHING)}: Return all informational sections including module generated ones.",
3438
$"{nameof(HELP)}: Print this help message.",
3539
$"{nameof(RESET)}: Reset stats.",
3640
"\r\n",

libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorScan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private protected bool ScanLookup<TInput, TOutput, TScanFunctions, TScanIterator
268268
if (numPending > 0)
269269
_ = bContext.CompletePending(wait: true);
270270

271-
IterationComplete:
271+
IterationComplete:
272272
if (resetCursor)
273273
cursor = 0;
274274
scanFunctions.OnStop(false, scanCursorState.acceptedCount);

libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/ContinuePending.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ internal OperationStatus ContinuePendingRMW<TInput, TOutput, TContext, TSessionF
246246
EphemeralXUnlock<TInput, TOutput, TContext, TSessionFunctionsWrapper>(sessionFunctions, ref stackCtx);
247247
}
248248

249-
// Must do this *after* Unlocking.
249+
// Must do this *after* Unlocking.
250250
CheckRetry:
251251
if (!HandleImmediateRetryStatus(status, sessionFunctions, ref pendingContext))
252252
return status;

playground/Bitmap/BitOp.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private static void __bitop_simdX128_and(byte* dstBitmap, long dstLen, byte* src
360360
#endregion
361361

362362
#region fillDstTail
363-
fillTail:
363+
fillTail:
364364
if (dstLen > srcLen)
365365
{
366366
batchSize = 8 * 4;
@@ -530,7 +530,7 @@ private static void __bitop_simdX128_and_long(byte* dstBitmap, long dstLen, byte
530530
#endregion
531531

532532
#region fillDstTail
533-
fillTail:
533+
fillTail:
534534
if (dstLen > srcLen)
535535
{
536536
batchSize = 8 * 4;
@@ -729,7 +729,7 @@ private static void __bitop_simdX256_and(byte* dstBitmap, long dstLen, byte* src
729729
#endregion
730730

731731
#region fillDstTail
732-
fillTail:
732+
fillTail:
733733
if (dstLen > srcLen)
734734
{
735735
batchSize = 8 * 4;
@@ -828,7 +828,7 @@ private static void __bitop_multikey_scalar_and(byte* dstPtr, int dstLen, byte**
828828
*(long*)dstCurr = d00;
829829
dstCurr += batchSize;
830830
}
831-
#endregion
831+
#endregion
832832

833833
fillTail:
834834
#region scalar_1x1
@@ -1046,7 +1046,7 @@ private static void __bitop_multikey_simdX128_and(byte* dstPtr, int dstLen, byte
10461046
*(long*)dstCurr = d00;
10471047
dstCurr += batchSize;
10481048
}
1049-
#endregion
1049+
#endregion
10501050

10511051
fillTail:
10521052
#region scalar_1x1
@@ -1266,7 +1266,7 @@ private static void __bitop_multikey_simdX256_and(byte* dstPtr, int dstLen, byte
12661266
*(long*)dstCurr = d00;
12671267
dstCurr += batchSize;
12681268
}
1269-
#endregion
1269+
#endregion
12701270

12711271
fillTail:
12721272
#region scalar_1x1

test/Garnet.test.cluster/ClusterNegativeTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ public void ClusterReplicaAttachIntenseWrite(CancellationToken cancellationToken
312312
context.clusterTestUtils.SetConfigEpoch(primaryIndex, primaryIndex + 1, logger: context.logger);
313313
context.clusterTestUtils.SetConfigEpoch(replicaIndex, replicaIndex + 1, logger: context.logger);
314314
context.clusterTestUtils.Meet(primaryIndex, replicaIndex, logger: context.logger);
315+
context.clusterTestUtils.WaitUntilNodeIsKnown(primaryIndex, replicaIndex, logger: context.logger);
316+
context.clusterTestUtils.WaitUntilNodeIsKnown(replicaIndex, primaryIndex, logger: context.logger);
315317

316318
var keyLength = 32;
317319
var kvpairCount = 32;

test/Garnet.test.cluster/ClusterTestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void TearDown()
139139
waiter?.Dispose();
140140
clusterTestUtils?.Dispose();
141141

142-
var timeoutSeconds = 30;
142+
var timeoutSeconds = 60;
143143
string failureReason = null;
144144

145145
// Phase 1: Dispose cluster nodes (may timeout if handlers are stuck)

0 commit comments

Comments
 (0)