@cubejs-backend/query-orchestrator 0.23.3 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -2
  3. package/dist/src/driver/BaseDriver.d.ts +36 -0
  4. package/dist/src/driver/BaseDriver.d.ts.map +1 -0
  5. package/dist/src/driver/BaseDriver.js +175 -0
  6. package/dist/src/driver/BaseDriver.js.map +1 -0
  7. package/dist/src/driver/index.d.ts +3 -0
  8. package/dist/src/driver/index.d.ts.map +1 -0
  9. package/dist/src/driver/index.js +15 -0
  10. package/dist/src/driver/index.js.map +1 -0
  11. package/dist/src/driver/utils.d.ts +2 -0
  12. package/dist/src/driver/utils.d.ts.map +1 -0
  13. package/dist/src/driver/utils.js +17 -0
  14. package/dist/src/driver/utils.js.map +1 -0
  15. package/dist/src/index.d.ts +3 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/index.js +15 -0
  18. package/dist/src/index.js.map +1 -0
  19. package/dist/src/orchestrator/BaseQueueDriver.d.ts +4 -0
  20. package/dist/src/orchestrator/BaseQueueDriver.d.ts.map +1 -0
  21. package/dist/src/orchestrator/BaseQueueDriver.js +16 -0
  22. package/dist/src/orchestrator/BaseQueueDriver.js.map +1 -0
  23. package/dist/src/orchestrator/ContinueWaitError.d.ts +3 -0
  24. package/dist/src/orchestrator/ContinueWaitError.d.ts.map +1 -0
  25. package/dist/src/orchestrator/ContinueWaitError.js +10 -0
  26. package/dist/src/orchestrator/ContinueWaitError.js.map +1 -0
  27. package/dist/src/orchestrator/LocalCacheDriver.d.ts +8 -0
  28. package/dist/src/orchestrator/LocalCacheDriver.d.ts.map +1 -0
  29. package/dist/src/orchestrator/LocalCacheDriver.js +30 -0
  30. package/dist/src/orchestrator/LocalCacheDriver.js.map +1 -0
  31. package/dist/src/orchestrator/LocalQueueDriver.d.ts +57 -0
  32. package/dist/src/orchestrator/LocalQueueDriver.d.ts.map +1 -0
  33. package/dist/src/orchestrator/LocalQueueDriver.js +230 -0
  34. package/dist/src/orchestrator/LocalQueueDriver.js.map +1 -0
  35. package/dist/src/orchestrator/PreAggregations.d.ts +26 -0
  36. package/dist/src/orchestrator/PreAggregations.d.ts.map +1 -0
  37. package/dist/src/orchestrator/PreAggregations.js +565 -0
  38. package/dist/src/orchestrator/PreAggregations.js.map +1 -0
  39. package/dist/src/orchestrator/QueryCache.d.ts +51 -0
  40. package/dist/src/orchestrator/QueryCache.d.ts.map +1 -0
  41. package/dist/src/orchestrator/QueryCache.js +293 -0
  42. package/dist/src/orchestrator/QueryCache.js.map +1 -0
  43. package/dist/src/orchestrator/QueryOrchestrator.d.ts +27 -0
  44. package/dist/src/orchestrator/QueryOrchestrator.d.ts.map +1 -0
  45. package/dist/src/orchestrator/QueryOrchestrator.js +79 -0
  46. package/dist/src/orchestrator/QueryOrchestrator.js.map +1 -0
  47. package/dist/src/orchestrator/QueryQueue.d.ts +36 -0
  48. package/dist/src/orchestrator/QueryQueue.d.ts.map +1 -0
  49. package/dist/src/orchestrator/QueryQueue.js +351 -0
  50. package/dist/src/orchestrator/QueryQueue.js.map +1 -0
  51. package/dist/src/orchestrator/RedisCacheDriver.d.ts +12 -0
  52. package/dist/src/orchestrator/RedisCacheDriver.d.ts.map +1 -0
  53. package/dist/src/orchestrator/RedisCacheDriver.js +50 -0
  54. package/dist/src/orchestrator/RedisCacheDriver.js.map +1 -0
  55. package/dist/src/orchestrator/RedisFactory.d.ts +3 -0
  56. package/dist/src/orchestrator/RedisFactory.d.ts.map +1 -0
  57. package/dist/src/orchestrator/RedisFactory.js +45 -0
  58. package/dist/src/orchestrator/RedisFactory.js.map +1 -0
  59. package/dist/src/orchestrator/RedisPool.d.ts +10 -0
  60. package/dist/src/orchestrator/RedisPool.d.ts.map +1 -0
  61. package/dist/src/orchestrator/RedisPool.js +57 -0
  62. package/dist/src/orchestrator/RedisPool.js.map +1 -0
  63. package/dist/src/orchestrator/RedisQueueDriver.d.ts +47 -0
  64. package/dist/src/orchestrator/RedisQueueDriver.d.ts.map +1 -0
  65. package/dist/src/orchestrator/RedisQueueDriver.js +253 -0
  66. package/dist/src/orchestrator/RedisQueueDriver.js.map +1 -0
  67. package/dist/src/orchestrator/TimeoutError.d.ts +4 -0
  68. package/dist/src/orchestrator/TimeoutError.d.ts.map +1 -0
  69. package/dist/src/orchestrator/TimeoutError.js +7 -0
  70. package/dist/src/orchestrator/TimeoutError.js.map +1 -0
  71. package/dist/src/orchestrator/index.d.ts +14 -0
  72. package/dist/src/orchestrator/index.d.ts.map +1 -0
  73. package/dist/src/orchestrator/index.js +26 -0
  74. package/dist/src/orchestrator/index.js.map +1 -0
  75. package/driver/BaseDriver.js +5 -221
  76. package/driver/README.md +3 -0
  77. package/driver/utils.js +8 -12
  78. package/orchestrator/BaseQueueDriver.js +5 -8
  79. package/orchestrator/ContinueWaitError.js +6 -5
  80. package/orchestrator/LocalCacheDriver.js +5 -29
  81. package/orchestrator/LocalQueueDriver.js +5 -256
  82. package/orchestrator/PreAggregations.js +4 -764
  83. package/orchestrator/QueryCache.js +5 -381
  84. package/orchestrator/QueryOrchestrator.js +5 -100
  85. package/orchestrator/QueryQueue.js +5 -378
  86. package/orchestrator/README.md +3 -0
  87. package/orchestrator/RedisCacheDriver.js +5 -45
  88. package/orchestrator/RedisFactory.js +6 -46
  89. package/orchestrator/RedisPool.js +5 -49
  90. package/orchestrator/RedisQueueDriver.js +5 -283
  91. package/orchestrator/TimeoutError.js +6 -1
  92. package/package.json +29 -10
  93. package/test/integration/PreAggregations.test.js +0 -337
  94. package/test/integration/QueryQueueRedis.test.js +0 -6
  95. package/test/unit/QueryOrchestrator.test.js +0 -301
  96. package/test/unit/QueryQueue.test.js +0 -249
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LocalQueueDriver = exports.LocalQueueDriverConnection = void 0;
4
+ const R = require('ramda');
5
+ const { BaseQueueDriver } = require('./BaseQueueDriver');
6
+ class LocalQueueDriverConnection {
7
+ constructor(driver, options) {
8
+ this.redisQueuePrefix = options.redisQueuePrefix;
9
+ this.continueWaitTimeout = options.continueWaitTimeout;
10
+ this.orphanedTimeout = options.orphanedTimeout;
11
+ this.heartBeatTimeout = options.heartBeatTimeout;
12
+ this.concurrency = options.concurrency;
13
+ this.driver = driver;
14
+ this.results = driver.results;
15
+ this.resultPromises = driver.resultPromises;
16
+ this.queryDef = driver.queryDef;
17
+ this.toProcess = driver.toProcess;
18
+ this.recent = driver.recent;
19
+ this.active = driver.active;
20
+ this.heartBeat = driver.heartBeat;
21
+ this.processingCounter = driver.processingCounter;
22
+ this.processingLocks = driver.processingLocks;
23
+ }
24
+ getResultPromise(resultListKey) {
25
+ if (!this.resultPromises[resultListKey]) {
26
+ let resolveMethod = null;
27
+ this.resultPromises[resultListKey] = new Promise(resolve => {
28
+ resolveMethod = resolve;
29
+ });
30
+ this.resultPromises[resultListKey].resolve = resolveMethod;
31
+ }
32
+ return this.resultPromises[resultListKey];
33
+ }
34
+ async getResultBlocking(queryKey) {
35
+ const resultListKey = this.resultListKey(queryKey);
36
+ if (!this.queryDef[this.redisHash(queryKey)] && !this.resultPromises[resultListKey]) {
37
+ return null;
38
+ }
39
+ const timeoutPromise = (timeout) => new Promise((resolve) => setTimeout(() => resolve(null), timeout));
40
+ const res = await Promise.race([
41
+ this.getResultPromise(resultListKey),
42
+ timeoutPromise(this.continueWaitTimeout * 1000),
43
+ ]);
44
+ if (res) {
45
+ delete this.resultPromises[resultListKey];
46
+ }
47
+ return res;
48
+ }
49
+ async getResult(queryKey) {
50
+ const resultListKey = this.resultListKey(queryKey);
51
+ if (this.resultPromises[resultListKey] && this.resultPromises[resultListKey].resolved) {
52
+ return this.getResultBlocking(queryKey);
53
+ }
54
+ return null;
55
+ }
56
+ queueArray(queueObj, orderFilterLessThan) {
57
+ return R.pipe(R.values, R.filter(orderFilterLessThan ? q => q.order < orderFilterLessThan : R.identity), R.sortBy(q => q.order), R.map(q => q.key))(queueObj);
58
+ }
59
+ addToQueue(keyScore, queryKey, time, queryHandler, query, priority, options) {
60
+ const queryQueueObj = {
61
+ queryHandler,
62
+ query,
63
+ queryKey,
64
+ stageQueryKey: options.stageQueryKey,
65
+ priority,
66
+ requestId: options.requestId,
67
+ addedToQueueTime: new Date().getTime()
68
+ };
69
+ const key = this.redisHash(queryKey);
70
+ if (!this.queryDef[key]) {
71
+ this.queryDef[key] = queryQueueObj;
72
+ }
73
+ let added = 0;
74
+ if (!this.toProcess[key]) {
75
+ this.toProcess[key] = {
76
+ order: keyScore,
77
+ key
78
+ };
79
+ added = 1;
80
+ }
81
+ this.recent[key] = { order: time, key };
82
+ return [added, null, null, Object.keys(this.toProcess).length]; // TODO nulls
83
+ }
84
+ getToProcessQueries() {
85
+ return this.queueArray(this.toProcess);
86
+ }
87
+ getActiveQueries() {
88
+ return this.queueArray(this.active);
89
+ }
90
+ async getQueryAndRemove(queryKey) {
91
+ const key = this.redisHash(queryKey);
92
+ const query = this.queryDef[key];
93
+ delete this.active[key];
94
+ delete this.heartBeat[key];
95
+ delete this.toProcess[key];
96
+ delete this.recent[key];
97
+ delete this.queryDef[key];
98
+ delete this.processingLocks[key];
99
+ return [query];
100
+ }
101
+ async setResultAndRemoveQuery(queryKey, executionResult, processingId) {
102
+ const key = this.redisHash(queryKey);
103
+ if (this.processingLocks[key] !== processingId) {
104
+ return false;
105
+ }
106
+ const promise = this.getResultPromise(this.resultListKey(queryKey));
107
+ delete this.active[key];
108
+ delete this.heartBeat[key];
109
+ delete this.toProcess[key];
110
+ delete this.recent[key];
111
+ delete this.queryDef[key];
112
+ delete this.processingLocks[key];
113
+ promise.resolved = true;
114
+ promise.resolve(executionResult);
115
+ return true;
116
+ }
117
+ getNextProcessingId() {
118
+ this.processingCounter.counter = this.processingCounter.counter ? this.processingCounter.counter + 1 : 1;
119
+ return this.processingCounter.counter;
120
+ }
121
+ getOrphanedQueries() {
122
+ return this.queueArray(this.recent, new Date().getTime() - this.orphanedTimeout * 1000);
123
+ }
124
+ getStalledQueries() {
125
+ return this.queueArray(this.heartBeat, new Date().getTime() - this.heartBeatTimeout * 1000);
126
+ }
127
+ async getQueryStageState(onlyKeys) {
128
+ return [this.queueArray(this.active), this.queueArray(this.toProcess), onlyKeys ? {} : R.clone(this.queryDef)];
129
+ }
130
+ async getQueryDef(queryKey) {
131
+ return this.queryDef[this.redisHash(queryKey)];
132
+ }
133
+ updateHeartBeat(queryKey) {
134
+ const key = this.redisHash(queryKey);
135
+ if (this.heartBeat[key]) {
136
+ this.heartBeat[key] = { key, order: new Date().getTime() };
137
+ }
138
+ }
139
+ retrieveForProcessing(queryKey, processingId) {
140
+ const key = this.redisHash(queryKey);
141
+ let lockAcquired = false;
142
+ if (!this.processingLocks[key]) {
143
+ this.processingLocks[key] = processingId;
144
+ lockAcquired = true;
145
+ }
146
+ else {
147
+ return null;
148
+ }
149
+ let added = 0;
150
+ if (Object.keys(this.active).length < this.concurrency && !this.active[key]) {
151
+ this.active[key] = { key, order: processingId };
152
+ added = 1;
153
+ }
154
+ this.heartBeat[key] = { key, order: new Date().getTime() };
155
+ return [
156
+ added, null, this.queueArray(this.active), Object.keys(this.toProcess).length, this.queryDef[key], lockAcquired
157
+ ]; // TODO nulls
158
+ }
159
+ freeProcessingLock(queryKey, processingId, activated) {
160
+ const key = this.redisHash(queryKey);
161
+ if (this.processingLocks[key] === processingId) {
162
+ delete this.processingLocks[key];
163
+ if (activated) {
164
+ delete this.active[key];
165
+ }
166
+ }
167
+ }
168
+ async optimisticQueryUpdate(queryKey, toUpdate, processingId) {
169
+ const key = this.redisHash(queryKey);
170
+ if (this.processingLocks[key] !== processingId) {
171
+ return false;
172
+ }
173
+ this.queryDef[key] = Object.assign(Object.assign({}, this.queryDef[key]), toUpdate);
174
+ return true;
175
+ }
176
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
177
+ release() {
178
+ }
179
+ queryRedisKey(queryKey, suffix) {
180
+ return `${this.redisQueuePrefix}_${this.redisHash(queryKey)}_${suffix}`;
181
+ }
182
+ resultListKey(queryKey) {
183
+ return this.queryRedisKey(queryKey, 'RESULT');
184
+ }
185
+ redisHash(queryKey) {
186
+ return this.driver.redisHash(queryKey);
187
+ }
188
+ }
189
+ exports.LocalQueueDriverConnection = LocalQueueDriverConnection;
190
+ const results = {};
191
+ const resultPromises = {};
192
+ const queryDef = {};
193
+ const toProcess = {};
194
+ const recent = {};
195
+ const active = {};
196
+ const heartBeat = {};
197
+ const processingCounters = {};
198
+ const processingLocks = {};
199
+ class LocalQueueDriver extends BaseQueueDriver {
200
+ constructor(options) {
201
+ super();
202
+ this.options = options;
203
+ results[options.redisQueuePrefix] = results[options.redisQueuePrefix] || {};
204
+ resultPromises[options.redisQueuePrefix] = resultPromises[options.redisQueuePrefix] || {};
205
+ queryDef[options.redisQueuePrefix] = queryDef[options.redisQueuePrefix] || {};
206
+ toProcess[options.redisQueuePrefix] = toProcess[options.redisQueuePrefix] || {};
207
+ recent[options.redisQueuePrefix] = recent[options.redisQueuePrefix] || {};
208
+ active[options.redisQueuePrefix] = active[options.redisQueuePrefix] || {};
209
+ heartBeat[options.redisQueuePrefix] = heartBeat[options.redisQueuePrefix] || {};
210
+ processingCounters[options.redisQueuePrefix] = processingCounters[options.redisQueuePrefix] || {};
211
+ processingLocks[options.redisQueuePrefix] = processingLocks[options.redisQueuePrefix] || {};
212
+ this.results = results[options.redisQueuePrefix];
213
+ this.resultPromises = resultPromises[options.redisQueuePrefix];
214
+ this.queryDef = queryDef[options.redisQueuePrefix];
215
+ this.toProcess = toProcess[options.redisQueuePrefix];
216
+ this.recent = recent[options.redisQueuePrefix];
217
+ this.active = active[options.redisQueuePrefix];
218
+ this.heartBeat = heartBeat[options.redisQueuePrefix];
219
+ this.processingCounter = processingCounters[options.redisQueuePrefix];
220
+ this.processingLocks = processingLocks[options.redisQueuePrefix];
221
+ }
222
+ createConnection() {
223
+ return new LocalQueueDriverConnection(this, this.options);
224
+ }
225
+ release(client) {
226
+ client.release();
227
+ }
228
+ }
229
+ exports.LocalQueueDriver = LocalQueueDriver;
230
+ //# sourceMappingURL=LocalQueueDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalQueueDriver.js","sourceRoot":"","sources":["../../../src/orchestrator/LocalQueueDriver.js"],"names":[],"mappings":";;;AAAA,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC3B,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEzD,MAAa,0BAA0B;IACrC,YAAY,MAAM,EAAE,OAAO;QACzB,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACvD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAClD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,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AAI,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnE,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,0BAA0B,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,CAAC,MAAM;QACZ,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;CACF;AA/BD,4CA+BC"}
@@ -0,0 +1,26 @@
1
+ export class PreAggregations {
2
+ static preAggregationQueryCacheKey(preAggregation: any): any;
3
+ static targetTableName(versionEntry: any): string;
4
+ constructor(redisPrefix: any, clientFactory: any, logger: any, queryCache: any, options: any);
5
+ options: any;
6
+ redisPrefix: any;
7
+ driverFactory: any;
8
+ logger: any;
9
+ queryCache: any;
10
+ cacheDriver: LocalCacheDriver | RedisCacheDriver;
11
+ externalDriverFactory: any;
12
+ structureVersionPersistTime: any;
13
+ usedTablePersistTime: any;
14
+ externalRefresh: any;
15
+ tablesUsedRedisKey(tableName: any): string;
16
+ addTableUsed(tableName: any): Promise<any>;
17
+ tablesUsed(): Promise<any>;
18
+ loadAllPreAggregationsIfNeeded(queryBody: any): any;
19
+ getQueue(): import("./QueryQueue").QueryQueue;
20
+ queue: import("./QueryQueue").QueryQueue;
21
+ getLoadCacheQueue(): import("./QueryQueue").QueryQueue;
22
+ loadCacheQueue: import("./QueryQueue").QueryQueue;
23
+ }
24
+ import { LocalCacheDriver } from "./LocalCacheDriver";
25
+ import { RedisCacheDriver } from "./RedisCacheDriver";
26
+ //# sourceMappingURL=PreAggregations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreAggregations.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/PreAggregations.js"],"names":[],"mappings":"AAyoBA;IA8GE,6DAEC;IAED,kDAMC;IAvHD,8FAaC;IAZC,aAA4B;IAC5B,iBAA8B;IAC9B,mBAAkC;IAClC,YAAoB;IACpB,gBAA4B;IAC5B,iDAEwB;IACxB,2BAA0D;IAC1D,iCAA2F;IAC3F,0BAA+D;IAC/D,qBAA8C;IAGhD,2CAEC;IAED,2CAEC;IAED,2BAGC;IAED,oDAwBC;IAED,8CA2BC;IAzBG,yCAsBE;IAKN,uDAwBC;IAtBG,kDAmBC;CAgBN"}