@@ -171,6 +171,7 @@ describe('QueryOrchestrator', () => {
171171 let externalMockDriver = null ;
172172 let queryOrchestrator = null ;
173173 let queryOrchestratorExternalRefresh = null ;
174+ let queryOrchestratorDropWithoutTouch = null ;
174175 let testCount = 1 ;
175176
176177 beforeEach ( ( ) => {
@@ -227,6 +228,14 @@ describe('QueryOrchestrator', () => {
227228 externalRefresh : true ,
228229 } ,
229230 } ) ;
231+ queryOrchestratorDropWithoutTouch =
232+ new QueryOrchestrator ( redisPrefix , driverFactory , logger , {
233+ ...options ,
234+ preAggregationsOptions : {
235+ ...options . preAggregationsOptions ,
236+ dropPreAggregationsWithoutTouch : true ,
237+ } ,
238+ } ) ;
230239 mockDriver = mockDriverLocal ;
231240 fooMockDriver = fooMockDriverLocal ;
232241 barMockDriver = barMockDriverLocal ;
@@ -238,6 +247,7 @@ describe('QueryOrchestrator', () => {
238247 afterEach ( async ( ) => {
239248 await queryOrchestrator . cleanup ( ) ;
240249 await queryOrchestratorExternalRefresh . cleanup ( ) ;
250+ await queryOrchestratorDropWithoutTouch . cleanup ( ) ;
241251 } ) ;
242252
243253 test ( 'basic' , async ( ) => {
@@ -1300,4 +1310,42 @@ describe('QueryOrchestrator', () => {
13001310
13011311 expect ( streamingSourceMockDriver . downloadTableStreamOffset ) . toBe ( 'earliest' ) ;
13021312 } ) ;
1313+
1314+ test ( 'drop without touch does not affect tables in progress' , async ( ) => {
1315+ const firstQuery = queryOrchestratorDropWithoutTouch . fetchQuery ( {
1316+ query : 'SELECT * FROM stb_pre_aggregations.orders_delay_d20181102' ,
1317+ values : [ ] ,
1318+ cacheKeyQueries : {
1319+ renewalThreshold : 21600 ,
1320+ queries : [ ]
1321+ } ,
1322+ preAggregations : [ {
1323+ preAggregationsSchema : 'stb_pre_aggregations' ,
1324+ tableName : 'stb_pre_aggregations.orders_delay_d20181102' ,
1325+ loadSql : [ 'CREATE TABLE stb_pre_aggregations.orders_d20181102 AS SELECT * FROM public.orders_delay' , [ ] ] ,
1326+ invalidateKeyQueries : [ [ 'SELECT 2' , [ ] ] ]
1327+ } ] ,
1328+ requestId : 'drop without touch does not affect tables in progress'
1329+ } ) ;
1330+ const promises = [ firstQuery ] ;
1331+ for ( let i = 0 ; i < 10 ; i ++ ) {
1332+ promises . push ( queryOrchestratorDropWithoutTouch . fetchQuery ( {
1333+ query : `SELECT * FROM stb_pre_aggregations.orders_d201811${ i } ` ,
1334+ values : [ ] ,
1335+ cacheKeyQueries : {
1336+ renewalThreshold : 21600 ,
1337+ queries : [ ]
1338+ } ,
1339+ preAggregations : [ {
1340+ preAggregationsSchema : 'stb_pre_aggregations' ,
1341+ tableName : `stb_pre_aggregations.orders_d201811${ i } ` ,
1342+ loadSql : [ `CREATE TABLE stb_pre_aggregations.orders_d201811${ i } AS SELECT * FROM public.orders` , [ ] ] ,
1343+ invalidateKeyQueries : [ [ 'SELECT 2' , [ ] ] ]
1344+ } ] ,
1345+ requestId : 'drop without touch does not affect tables in progress'
1346+ } ) ) ;
1347+ }
1348+ await Promise . all ( promises ) ;
1349+ expect ( mockDriver . tables ) . toContainEqual ( expect . stringMatching ( / o r d e r s _ d e l a y / ) ) ;
1350+ } ) ;
13031351} ) ;
0 commit comments