Skip to content

Commit

Permalink
RavenDB-22835 : fix failing legacy-counters tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aviv committed Nov 26, 2024
1 parent 51c2bb3 commit 4ec3b83
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Raven.Server/Documents/Handlers/CountersHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
Expand Down Expand Up @@ -425,8 +426,11 @@ private void UpdateDocumentsMetadata(DocumentsOperationContext context)

private static void CheckForDataCorruption(DocumentsOperationContext context, CounterGroupDetail counterGroup, Document doc)
{
counterGroup.Values.TryGet(Values, out BlittableJsonReaderObject counterValues);
counterGroup.Values.TryGet(CounterNames, out BlittableJsonReaderObject counterNames);
if (counterGroup.Values.TryGet(Values, out BlittableJsonReaderObject counterValues) == false)
throw new InvalidDataException($"Counter-group of document '{counterGroup.DocumentId}' is missing '{Values}' property");

if (counterGroup.Values.TryGet(CounterNames, out BlittableJsonReaderObject counterNames) == false)
return; // legacy counters

if (counterValues.Count == counterNames.Count &&
counterValues.GetSortedPropertyNames().SequenceEqual(counterNames.GetSortedPropertyNames()))
Expand Down

0 comments on commit 4ec3b83

Please sign in to comment.