@ -38,17 +38,22 @@ func Test_batchIterSafeStart(t *testing.T) {
} ,
} ,
}
periodConfig := config . PeriodConfig {
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
}
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( t , err )
chks := [ ] * LazyChunk {
newLazyChunk ( stream ) ,
newLazyChunk ( chunkfmt , headfmt , stream ) ,
}
s := config . SchemaConfig {
Configs : [ ] config . PeriodConfig {
{
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
} ,
periodConfig ,
} ,
}
@ -65,17 +70,44 @@ func Test_batchIterSafeStart(t *testing.T) {
}
func Test_newLogBatchChunkIterator ( t * testing . T ) {
tests := map [ string ] struct {
periodConfigs := [ ] config . PeriodConfig {
{
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
} ,
{
From : config . DayTime { Time : 0 } ,
Schema : "v12" ,
RowShards : 16 ,
} ,
{
From : config . DayTime { Time : 0 } ,
Schema : "v13" ,
RowShards : 16 ,
} ,
}
type testCase struct {
chunks [ ] * LazyChunk
expected [ ] logproto . Stream
matchers string
start , end time . Time
direction logproto . Direction
batchSize int
} {
}
var tests map [ string ] testCase
for _ , periodConfig := range periodConfigs {
periodConfig := periodConfig
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( t , err )
tests = map [ string ] testCase {
"forward with overlap" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -88,7 +120,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -101,7 +133,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -114,7 +146,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -127,7 +159,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -140,7 +172,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -184,7 +216,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"forward all overlap and all chunks have a from time less than query from time" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -197,7 +229,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -214,7 +246,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -231,7 +263,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -248,7 +280,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -265,7 +297,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -313,7 +345,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"forward with overlapping non-continuous entries" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -330,7 +362,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -343,7 +375,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -356,7 +388,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -396,7 +428,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"backward with overlap" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -409,7 +441,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -422,7 +454,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -435,7 +467,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -448,7 +480,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -461,7 +493,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -505,7 +537,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"backward all overlap and all chunks have a through time greater than query through time" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -522,7 +554,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -539,7 +571,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -556,7 +588,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -573,7 +605,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -590,7 +622,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -634,7 +666,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"backward with overlapping non-continuous entries" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -647,7 +679,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -660,7 +692,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -673,7 +705,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -733,7 +765,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"forward without overlap" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -746,7 +778,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -755,7 +787,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -791,7 +823,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
"backward without overlap" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -804,7 +836,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -813,7 +845,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -857,7 +889,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
// the default due to nextChunks with the same start timestamp.
"forward identicals" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -866,7 +898,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -875,7 +907,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -888,7 +920,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -897,7 +929,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -906,7 +938,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -915,7 +947,7 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -951,16 +983,22 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
} ,
}
s := config . SchemaConfig {
Configs : [ ] config . PeriodConfig {
}
schemaConfigs := [ ] config . SchemaConfig {
{
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
Configs : [ ] config . PeriodConfig { periodConfigs [ 0 ] } ,
} ,
{
Configs : [ ] config . PeriodConfig { periodConfigs [ 1 ] } ,
} ,
{
Configs : [ ] config . PeriodConfig { periodConfigs [ 2 ] } ,
} ,
}
for _ , schemaConfig := range schemaConfigs {
s := schemaConfig
for name , tt := range tests {
tt := tt
t . Run ( name , func ( t * testing . T ) {
@ -975,9 +1013,19 @@ func Test_newLogBatchChunkIterator(t *testing.T) {
assertStream ( t , tt . expected , streams . Streams )
} )
}
}
}
func Test_newSampleBatchChunkIterator ( t * testing . T ) {
periodConfig := config . PeriodConfig {
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
}
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( t , err )
tests := map [ string ] struct {
chunks [ ] * LazyChunk
expected [ ] logproto . Series
@ -987,7 +1035,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} {
"forward with overlap" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1000,7 +1048,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1013,7 +1061,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1026,7 +1074,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1039,7 +1087,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1052,7 +1100,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1099,7 +1147,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
"forward with overlapping non-continuous entries" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1116,7 +1164,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1129,7 +1177,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1142,7 +1190,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1184,7 +1232,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
"forward last chunk boundaries equal to end" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1197,7 +1245,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1210,7 +1258,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1247,7 +1295,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
"forward last chunk boundaries equal to end and start" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1260,7 +1308,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1297,7 +1345,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
"forward without overlap" : {
[ ] * LazyChunk {
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1310,7 +1358,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1319,7 +1367,7 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
} ,
} ,
} ) ,
newLazyChunk ( logproto . Stream {
newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1387,8 +1435,17 @@ func Test_newSampleBatchChunkIterator(t *testing.T) {
}
func TestPartitionOverlappingchunks ( t * testing . T ) {
periodConfig := config . PeriodConfig {
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
}
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( t , err )
var (
oneThroughFour = newLazyChunk ( logproto . Stream {
oneThroughFour = newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1401,7 +1458,7 @@ func TestPartitionOverlappingchunks(t *testing.T) {
} ,
} ,
} )
two = newLazyChunk ( logproto . Stream {
two = newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1410,7 +1467,7 @@ func TestPartitionOverlappingchunks(t *testing.T) {
} ,
} ,
} )
three = newLazyChunk ( logproto . Stream {
three = newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1468,8 +1525,18 @@ func TestPartitionOverlappingchunks(t *testing.T) {
}
func TestBuildHeapIterator ( t * testing . T ) {
periodConfig := config . PeriodConfig {
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
}
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( t , err )
var (
firstChunk = newLazyChunk ( logproto . Stream {
firstChunk = newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : "{foo=\"bar\"}" ,
Entries : [ ] logproto . Entry {
{
@ -1486,7 +1553,7 @@ func TestBuildHeapIterator(t *testing.T) {
} ,
} ,
} )
secondChunk = newLazyInvalidChunk ( logproto . Stream {
secondChunk = newLazyInvalidChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : "{foo=\"bar\"}" ,
Entries : [ ] logproto . Entry {
{
@ -1499,7 +1566,7 @@ func TestBuildHeapIterator(t *testing.T) {
} ,
} ,
} )
thirdChunk = newLazyChunk ( logproto . Stream {
thirdChunk = newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : "{foo=\"bar\"}" ,
Entries : [ ] logproto . Entry {
{
@ -1632,8 +1699,17 @@ func Test_IsInvalidChunkError(t *testing.T) {
}
func TestBatchCancel ( t * testing . T ) {
periodConfig := config . PeriodConfig {
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
}
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( t , err )
createChunk := func ( from time . Time ) * LazyChunk {
return newLazyChunk ( logproto . Stream {
return newLazyChunk ( chunkfmt , headfmt , logproto . Stream {
Labels : fooLabelsWithName . String ( ) ,
Entries : [ ] logproto . Entry {
{
@ -1674,13 +1750,22 @@ func TestBatchCancel(t *testing.T) {
var entry logproto . Entry
func Benchmark_store_OverlappingChunks ( b * testing . B ) {
periodConfig := config . PeriodConfig {
From : config . DayTime { Time : 0 } ,
Schema : "v11" ,
RowShards : 16 ,
}
chunkfmt , headfmt , err := periodConfig . ChunkFormat ( )
require . NoError ( b , err )
b . ReportAllocs ( )
st := & store {
chunkMetrics : NilMetrics ,
cfg : Config {
MaxChunkBatchSize : 50 ,
} ,
Store : newMockChunkStore ( newOverlappingStreams ( 200 , 200 ) ) ,
Store : newMockChunkStore ( chunkfmt , headfmt , newOverlappingStreams ( 200 , 200 ) ) ,
}
b . ResetTimer ( )
statsCtx , ctx := stats . NewContext ( user . InjectOrgID ( context . Background ( ) , "fake" ) )