@@ -2372,6 +2372,64 @@ func TestDedupRespHeap_QuorumChunkDedup(t *testing.T) {
23722372 testutil .Equals (t , false , h .Next ())
23732373 },
23742374 },
2375+ {
2376+ tname : "keep 2 identical series + a corrupted one" ,
2377+ responses : []* storepb.SeriesResponse {
2378+ {
2379+ Result : & storepb.SeriesResponse_Series {
2380+ Series : & storepb.Series {
2381+ Labels : labelpb .ZLabelsFromPromLabels (labels .FromStrings ("foo" , "bar" )),
2382+ Chunks : []storepb.AggrChunk {
2383+ {
2384+ Raw : & storepb.Chunk {
2385+ Type : storepb .Chunk_XOR ,
2386+ Data : []byte (`abcdefgh` ),
2387+ },
2388+ },
2389+ },
2390+ },
2391+ },
2392+ },
2393+ {
2394+ Result : & storepb.SeriesResponse_Series {
2395+ Series : & storepb.Series {
2396+ Labels : labelpb .ZLabelsFromPromLabels (labels .FromStrings ("foo" , "bar" )),
2397+ Chunks : []storepb.AggrChunk {
2398+ {
2399+ Raw : & storepb.Chunk {
2400+ Type : storepb .Chunk_XOR ,
2401+ Hash : xxhash .Sum64 ([]byte (`abcdefgh` )),
2402+ Data : []byte (`abcdefgh` ),
2403+ },
2404+ },
2405+ },
2406+ },
2407+ },
2408+ },
2409+ {
2410+ Result : & storepb.SeriesResponse_Series {
2411+ Series : & storepb.Series {
2412+ Labels : labelpb .ZLabelsFromPromLabels (labels .FromStrings ("foo" , "bar" )),
2413+ Chunks : []storepb.AggrChunk {
2414+ {
2415+ Raw : & storepb.Chunk {
2416+ Type : storepb .Chunk_XOR ,
2417+ Hash : xxhash .Sum64 ([]byte (`corrupted` )),
2418+ Data : []byte (`corrupted` ),
2419+ },
2420+ },
2421+ },
2422+ },
2423+ },
2424+ },
2425+ },
2426+ testFn : func (responses []* storepb.SeriesResponse , h * responseDeduplicator ) {
2427+ testutil .Equals (t , true , h .Next ())
2428+ resp := h .At ()
2429+ testutil .Equals (t , 3 , len (resp .GetSeries ().Chunks ))
2430+ testutil .Equals (t , false , h .Next ())
2431+ },
2432+ },
23752433 {
23762434 tname : "dedup 3 identical series" ,
23772435 responses : []* storepb.SeriesResponse {
0 commit comments