Skip to content

Commit fd5e602

Browse files
committed
fix: Avoid excessive pre-aggregation invalidation in presence of multiple structure versions
1 parent 39f27d4 commit fd5e602

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/cubejs-query-orchestrator/orchestrator/PreAggregations.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,12 @@ class PreAggregationLoader {
257257
await this.driverFactory();
258258
await client.createSchemaIfNotExists(this.preAggregation.preAggregationsSchema);
259259
}
260-
// TODO can be array instead of last
261-
const versionEntry = versionEntries.find(e => e.table_name === this.preAggregation.tableName);
260+
// ensure we find appropriate structure version before invalidating anything
261+
const versionEntry = versionEntries.find(
262+
v => v.table_name === this.preAggregation.tableName && v.structure_version === structureVersion
263+
) || versionEntries.find(
264+
e => e.table_name === this.preAggregation.tableName
265+
);
262266
const newVersionEntry = {
263267
table_name: this.preAggregation.tableName,
264268
structure_version: structureVersion,

0 commit comments

Comments
 (0)