@@ -191,24 +191,30 @@ async function main(): Promise<void> {
191191 }
192192 await new Promise ( r => setTimeout ( r , 500 ) ) ;
193193
194- // Pre-register Iceberg tables by triggering lazy-load via a query
194+ // Pre-register Iceberg tables by triggering lazy-load via a query (retry for R2 consistency)
195195 const icebergTables = [ "bench_iceberg_100k" ] ;
196196 for ( const tbl of icebergTables ) {
197- try {
198- const resp = await fetch ( `${ BASE_URL } /query` , {
199- method : "POST" ,
200- headers : { "content-type" : "application/json" } ,
201- body : JSON . stringify ( { table : tbl , filters : [ ] , projections : [ "id" ] , limit : 1 } ) ,
202- } ) ;
203- if ( resp . ok ) {
204- console . log ( ` Iceberg OK: ${ tbl } ` ) ;
205- } else {
206- const text = await resp . text ( ) ;
207- console . log ( ` Iceberg Skip: ${ tbl } (${ resp . status } : ${ text . slice ( 0 , 100 ) } )` ) ;
197+ let ok = false ;
198+ for ( let attempt = 0 ; attempt < 3 && ! ok ; attempt ++ ) {
199+ if ( attempt > 0 ) await new Promise ( r => setTimeout ( r , 2000 ) ) ;
200+ try {
201+ const resp = await fetch ( `${ BASE_URL } /query` , {
202+ method : "POST" ,
203+ headers : { "content-type" : "application/json" } ,
204+ body : JSON . stringify ( { table : tbl , filters : [ ] , projections : [ "id" ] , limit : 1 } ) ,
205+ } ) ;
206+ if ( resp . ok ) {
207+ console . log ( ` Iceberg OK: ${ tbl } ` ) ;
208+ ok = true ;
209+ } else {
210+ const text = await resp . text ( ) ;
211+ console . log ( ` Iceberg attempt ${ attempt + 1 } : ${ tbl } (${ resp . status } : ${ text . slice ( 0 , 80 ) } )` ) ;
212+ }
213+ } catch {
214+ console . log ( ` Iceberg attempt ${ attempt + 1 } : ${ tbl } (fetch error)` ) ;
208215 }
209- } catch {
210- console . log ( ` Iceberg Skip: ${ tbl } ` ) ;
211216 }
217+ if ( ! ok ) console . log ( ` Iceberg Skip: ${ tbl } ` ) ;
212218 }
213219 await new Promise ( r => setTimeout ( r , 500 ) ) ;
214220
0 commit comments