@@ -26,6 +26,7 @@ import (
2626 "github.com/cortexproject/cortex/integration/e2ecortex"
2727 "github.com/cortexproject/cortex/pkg/storage/bucket"
2828 "github.com/cortexproject/cortex/pkg/storage/tsdb"
29+ "github.com/cortexproject/cortex/pkg/storage/tsdb/bucketindex"
2930 "github.com/cortexproject/cortex/pkg/util/log"
3031 cortex_testutil "github.com/cortexproject/cortex/pkg/util/test"
3132)
@@ -280,22 +281,33 @@ func TestParquetProjectionPushdown(t *testing.T) {
280281 err = block .Upload (ctx , log .Logger , bkt , filepath .Join (dir , id .String ()), metadata .NoneFunc )
281282 require .NoError (t , err )
282283
283- // Wait until we convert the blocks to parquet
284+ // Wait until we convert the blocks to parquet AND bucket index is updated
284285 cortex_testutil .Poll (t , 30 * time .Second , true , func () interface {} {
285- found := false
286- foundBucketIndex := false
287-
286+ // Check if parquet marker exists
287+ markerFound := false
288288 err := bkt .Iter (context .Background (), "" , func (name string ) error {
289289 if name == fmt .Sprintf ("parquet-markers/%v-parquet-converter-mark.json" , id .String ()) {
290- found = true
291- }
292- if name == "bucket-index.json.gz" {
293- foundBucketIndex = true
290+ markerFound = true
294291 }
295292 return nil
296293 }, objstore .WithRecursiveIter ())
297- require .NoError (t , err )
298- return found && foundBucketIndex
294+ if err != nil || ! markerFound {
295+ return false
296+ }
297+
298+ // Check if bucket index exists AND contains the parquet block metadata
299+ idx , err := bucketindex .ReadIndex (ctx , bkt , "user-1" , nil , log .Logger )
300+ if err != nil {
301+ return false
302+ }
303+
304+ // Verify the block is in the bucket index with parquet metadata
305+ for _ , b := range idx .Blocks {
306+ if b .ID == id && b .Parquet != nil {
307+ return true
308+ }
309+ }
310+ return false
299311 })
300312
301313 c , err := e2ecortex .NewClient ("" , cortex .HTTPEndpoint (), "" , "" , "user-1" )
0 commit comments