@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.
- package/CHANGELOG.md +38 -0
- package/README.md +2 -2
- package/dist/src/driver/BaseDriver.d.ts +36 -0
- package/dist/src/driver/BaseDriver.d.ts.map +1 -0
- package/dist/src/driver/BaseDriver.js +175 -0
- package/dist/src/driver/BaseDriver.js.map +1 -0
- package/dist/src/driver/index.d.ts +3 -0
- package/dist/src/driver/index.d.ts.map +1 -0
- package/dist/src/driver/index.js +15 -0
- package/dist/src/driver/index.js.map +1 -0
- package/dist/src/driver/utils.d.ts +2 -0
- package/dist/src/driver/utils.d.ts.map +1 -0
- package/dist/src/driver/utils.js +17 -0
- package/dist/src/driver/utils.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +15 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/orchestrator/BaseQueueDriver.d.ts +4 -0
- package/dist/src/orchestrator/BaseQueueDriver.d.ts.map +1 -0
- package/dist/src/orchestrator/BaseQueueDriver.js +16 -0
- package/dist/src/orchestrator/BaseQueueDriver.js.map +1 -0
- package/dist/src/orchestrator/ContinueWaitError.d.ts +3 -0
- package/dist/src/orchestrator/ContinueWaitError.d.ts.map +1 -0
- package/dist/src/orchestrator/ContinueWaitError.js +10 -0
- package/dist/src/orchestrator/ContinueWaitError.js.map +1 -0
- package/dist/src/orchestrator/LocalCacheDriver.d.ts +8 -0
- package/dist/src/orchestrator/LocalCacheDriver.d.ts.map +1 -0
- package/dist/src/orchestrator/LocalCacheDriver.js +30 -0
- package/dist/src/orchestrator/LocalCacheDriver.js.map +1 -0
- package/dist/src/orchestrator/LocalQueueDriver.d.ts +57 -0
- package/dist/src/orchestrator/LocalQueueDriver.d.ts.map +1 -0
- package/dist/src/orchestrator/LocalQueueDriver.js +230 -0
- package/dist/src/orchestrator/LocalQueueDriver.js.map +1 -0
- package/dist/src/orchestrator/PreAggregations.d.ts +26 -0
- package/dist/src/orchestrator/PreAggregations.d.ts.map +1 -0
- package/dist/src/orchestrator/PreAggregations.js +565 -0
- package/dist/src/orchestrator/PreAggregations.js.map +1 -0
- package/dist/src/orchestrator/QueryCache.d.ts +51 -0
- package/dist/src/orchestrator/QueryCache.d.ts.map +1 -0
- package/dist/src/orchestrator/QueryCache.js +293 -0
- package/dist/src/orchestrator/QueryCache.js.map +1 -0
- package/dist/src/orchestrator/QueryOrchestrator.d.ts +27 -0
- package/dist/src/orchestrator/QueryOrchestrator.d.ts.map +1 -0
- package/dist/src/orchestrator/QueryOrchestrator.js +79 -0
- package/dist/src/orchestrator/QueryOrchestrator.js.map +1 -0
- package/dist/src/orchestrator/QueryQueue.d.ts +36 -0
- package/dist/src/orchestrator/QueryQueue.d.ts.map +1 -0
- package/dist/src/orchestrator/QueryQueue.js +351 -0
- package/dist/src/orchestrator/QueryQueue.js.map +1 -0
- package/dist/src/orchestrator/RedisCacheDriver.d.ts +12 -0
- package/dist/src/orchestrator/RedisCacheDriver.d.ts.map +1 -0
- package/dist/src/orchestrator/RedisCacheDriver.js +50 -0
- package/dist/src/orchestrator/RedisCacheDriver.js.map +1 -0
- package/dist/src/orchestrator/RedisFactory.d.ts +3 -0
- package/dist/src/orchestrator/RedisFactory.d.ts.map +1 -0
- package/dist/src/orchestrator/RedisFactory.js +45 -0
- package/dist/src/orchestrator/RedisFactory.js.map +1 -0
- package/dist/src/orchestrator/RedisPool.d.ts +10 -0
- package/dist/src/orchestrator/RedisPool.d.ts.map +1 -0
- package/dist/src/orchestrator/RedisPool.js +57 -0
- package/dist/src/orchestrator/RedisPool.js.map +1 -0
- package/dist/src/orchestrator/RedisQueueDriver.d.ts +47 -0
- package/dist/src/orchestrator/RedisQueueDriver.d.ts.map +1 -0
- package/dist/src/orchestrator/RedisQueueDriver.js +253 -0
- package/dist/src/orchestrator/RedisQueueDriver.js.map +1 -0
- package/dist/src/orchestrator/TimeoutError.d.ts +4 -0
- package/dist/src/orchestrator/TimeoutError.d.ts.map +1 -0
- package/dist/src/orchestrator/TimeoutError.js +7 -0
- package/dist/src/orchestrator/TimeoutError.js.map +1 -0
- package/dist/src/orchestrator/index.d.ts +14 -0
- package/dist/src/orchestrator/index.d.ts.map +1 -0
- package/dist/src/orchestrator/index.js +26 -0
- package/dist/src/orchestrator/index.js.map +1 -0
- package/driver/BaseDriver.js +5 -221
- package/driver/README.md +3 -0
- package/driver/utils.js +8 -12
- package/orchestrator/BaseQueueDriver.js +5 -8
- package/orchestrator/ContinueWaitError.js +6 -5
- package/orchestrator/LocalCacheDriver.js +5 -29
- package/orchestrator/LocalQueueDriver.js +5 -256
- package/orchestrator/PreAggregations.js +4 -764
- package/orchestrator/QueryCache.js +5 -381
- package/orchestrator/QueryOrchestrator.js +5 -100
- package/orchestrator/QueryQueue.js +5 -378
- package/orchestrator/README.md +3 -0
- package/orchestrator/RedisCacheDriver.js +5 -45
- package/orchestrator/RedisFactory.js +6 -46
- package/orchestrator/RedisPool.js +5 -49
- package/orchestrator/RedisQueueDriver.js +5 -283
- package/orchestrator/TimeoutError.js +6 -1
- package/package.json +29 -10
- package/test/integration/PreAggregations.test.js +0 -337
- package/test/integration/QueryQueueRedis.test.js +0 -6
- package/test/unit/QueryOrchestrator.test.js +0 -301
- package/test/unit/QueryQueue.test.js +0 -249
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RedisQueueDriver = exports.RedisQueueDriverConnection = void 0;
|
|
7
|
+
const ramda_1 = __importDefault(require("ramda"));
|
|
8
|
+
const BaseQueueDriver_1 = require("./BaseQueueDriver");
|
|
9
|
+
class RedisQueueDriverConnection {
|
|
10
|
+
constructor(driver, options) {
|
|
11
|
+
this.driver = driver;
|
|
12
|
+
this.redisClient = options.redisClient;
|
|
13
|
+
this.redisQueuePrefix = options.redisQueuePrefix;
|
|
14
|
+
this.continueWaitTimeout = options.continueWaitTimeout;
|
|
15
|
+
this.orphanedTimeout = options.orphanedTimeout;
|
|
16
|
+
this.heartBeatTimeout = options.heartBeatTimeout;
|
|
17
|
+
this.concurrency = options.concurrency;
|
|
18
|
+
}
|
|
19
|
+
async getResultBlocking(queryKey) {
|
|
20
|
+
const resultListKey = this.resultListKey(queryKey);
|
|
21
|
+
if (!(await this.redisClient.hgetAsync([this.queriesDefKey(), this.redisHash(queryKey)]))) {
|
|
22
|
+
return this.getResult(queryKey);
|
|
23
|
+
}
|
|
24
|
+
const result = await this.redisClient.brpopAsync([resultListKey, this.continueWaitTimeout]);
|
|
25
|
+
if (result) {
|
|
26
|
+
await this.redisClient.lpushAsync([resultListKey, result[1]]);
|
|
27
|
+
await this.redisClient.rpopAsync(resultListKey);
|
|
28
|
+
}
|
|
29
|
+
return result && JSON.parse(result[1]);
|
|
30
|
+
}
|
|
31
|
+
async getResult(queryKey) {
|
|
32
|
+
const resultListKey = this.resultListKey(queryKey);
|
|
33
|
+
const result = await this.redisClient.rpopAsync(resultListKey);
|
|
34
|
+
return result && JSON.parse(result);
|
|
35
|
+
}
|
|
36
|
+
addToQueue(keyScore, queryKey, time, queryHandler, query, priority, options) {
|
|
37
|
+
return this.redisClient.multi()
|
|
38
|
+
.zadd([this.toProcessRedisKey(), 'NX', keyScore, this.redisHash(queryKey)])
|
|
39
|
+
.zadd([this.recentRedisKey(), time, this.redisHash(queryKey)])
|
|
40
|
+
.hsetnx([
|
|
41
|
+
this.queriesDefKey(),
|
|
42
|
+
this.redisHash(queryKey),
|
|
43
|
+
JSON.stringify({
|
|
44
|
+
queryHandler,
|
|
45
|
+
query,
|
|
46
|
+
queryKey,
|
|
47
|
+
stageQueryKey: options.stageQueryKey,
|
|
48
|
+
priority,
|
|
49
|
+
requestId: options.requestId,
|
|
50
|
+
addedToQueueTime: new Date().getTime()
|
|
51
|
+
})
|
|
52
|
+
])
|
|
53
|
+
.zcard(this.toProcessRedisKey())
|
|
54
|
+
.execAsync();
|
|
55
|
+
}
|
|
56
|
+
getToProcessQueries() {
|
|
57
|
+
return this.redisClient.zrangeAsync([this.toProcessRedisKey(), 0, -1]);
|
|
58
|
+
}
|
|
59
|
+
getActiveQueries() {
|
|
60
|
+
return this.redisClient.zrangeAsync([this.activeRedisKey(), 0, -1]);
|
|
61
|
+
}
|
|
62
|
+
async getQueryAndRemove(queryKey) {
|
|
63
|
+
const [query, ...restResult] = await this.redisClient.multi()
|
|
64
|
+
.hget([this.queriesDefKey(), this.redisHash(queryKey)])
|
|
65
|
+
.zrem([this.activeRedisKey(), this.redisHash(queryKey)])
|
|
66
|
+
.zrem([this.heartBeatRedisKey(), this.redisHash(queryKey)])
|
|
67
|
+
.zrem([this.toProcessRedisKey(), this.redisHash(queryKey)])
|
|
68
|
+
.zrem([this.recentRedisKey(), this.redisHash(queryKey)])
|
|
69
|
+
.hdel([this.queriesDefKey(), this.redisHash(queryKey)])
|
|
70
|
+
.del(this.queryProcessingLockKey(queryKey))
|
|
71
|
+
.execAsync();
|
|
72
|
+
return [JSON.parse(query), ...restResult];
|
|
73
|
+
}
|
|
74
|
+
async setResultAndRemoveQuery(queryKey, executionResult, processingId) {
|
|
75
|
+
try {
|
|
76
|
+
await this.redisClient.watchAsync(this.queryProcessingLockKey(queryKey));
|
|
77
|
+
const currentProcessId = await this.redisClient.getAsync(this.queryProcessingLockKey(queryKey));
|
|
78
|
+
if (processingId !== currentProcessId) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
return this.redisClient.multi()
|
|
82
|
+
.lpush([this.resultListKey(queryKey), JSON.stringify(executionResult)])
|
|
83
|
+
.zrem([this.activeRedisKey(), this.redisHash(queryKey)])
|
|
84
|
+
.zrem([this.heartBeatRedisKey(), this.redisHash(queryKey)])
|
|
85
|
+
.zrem([this.toProcessRedisKey(), this.redisHash(queryKey)])
|
|
86
|
+
.zrem([this.recentRedisKey(), this.redisHash(queryKey)])
|
|
87
|
+
.hdel([this.queriesDefKey(), this.redisHash(queryKey)])
|
|
88
|
+
.del(this.queryProcessingLockKey(queryKey))
|
|
89
|
+
.execAsync();
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
await this.redisClient.unwatchAsync();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
getOrphanedQueries() {
|
|
96
|
+
return this.redisClient.zrangebyscoreAsync([this.recentRedisKey(), 0, (new Date().getTime() - this.orphanedTimeout * 1000)]);
|
|
97
|
+
}
|
|
98
|
+
getStalledQueries() {
|
|
99
|
+
return this.redisClient.zrangebyscoreAsync([this.heartBeatRedisKey(), 0, (new Date().getTime() - this.heartBeatTimeout * 1000)]);
|
|
100
|
+
}
|
|
101
|
+
async getQueryStageState(onlyKeys) {
|
|
102
|
+
let request = this.redisClient.multi()
|
|
103
|
+
.zrange([this.activeRedisKey(), 0, -1])
|
|
104
|
+
.zrange([this.toProcessRedisKey(), 0, -1]);
|
|
105
|
+
if (!onlyKeys) {
|
|
106
|
+
request = request.hgetall(this.queriesDefKey());
|
|
107
|
+
}
|
|
108
|
+
const [active, toProcess, allQueryDefs] = await request.execAsync();
|
|
109
|
+
return [active, toProcess, ramda_1.default.map(q => JSON.parse(q), allQueryDefs || {})];
|
|
110
|
+
}
|
|
111
|
+
async getQueryDef(queryKey) {
|
|
112
|
+
const query = await this.redisClient.hgetAsync([this.queriesDefKey(), this.redisHash(queryKey)]);
|
|
113
|
+
return JSON.parse(query);
|
|
114
|
+
}
|
|
115
|
+
updateHeartBeat(queryKey) {
|
|
116
|
+
return this.redisClient.zaddAsync([this.heartBeatRedisKey(), new Date().getTime(), this.redisHash(queryKey)]);
|
|
117
|
+
}
|
|
118
|
+
async getNextProcessingId() {
|
|
119
|
+
const id = await this.redisClient.incrAsync(this.processingIdKey());
|
|
120
|
+
return id && id.toString();
|
|
121
|
+
}
|
|
122
|
+
async retrieveForProcessing(queryKey, processingId) {
|
|
123
|
+
try {
|
|
124
|
+
const lockKey = this.queryProcessingLockKey(queryKey);
|
|
125
|
+
await this.redisClient.watchAsync(lockKey);
|
|
126
|
+
const currentProcessId = await this.redisClient.getAsync(lockKey);
|
|
127
|
+
if (currentProcessId) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const result = await this.redisClient.multi()
|
|
131
|
+
.zadd([this.activeRedisKey(), 'NX', processingId, this.redisHash(queryKey)])
|
|
132
|
+
.zremrangebyrank([this.activeRedisKey(), this.concurrency, -1])
|
|
133
|
+
.zrange([this.activeRedisKey(), 0, this.concurrency - 1])
|
|
134
|
+
.zcard(this.toProcessRedisKey())
|
|
135
|
+
.hget(([this.queriesDefKey(), this.redisHash(queryKey)]))
|
|
136
|
+
.set(lockKey, processingId, 'NX')
|
|
137
|
+
.zadd([this.heartBeatRedisKey(), 'NX', new Date().getTime(), this.redisHash(queryKey)])
|
|
138
|
+
.execAsync();
|
|
139
|
+
if (result) {
|
|
140
|
+
result[4] = JSON.parse(result[4]);
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
await this.redisClient.unwatchAsync();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async freeProcessingLock(queryKey, processingId, activated) {
|
|
149
|
+
try {
|
|
150
|
+
const lockKey = this.queryProcessingLockKey(queryKey);
|
|
151
|
+
await this.redisClient.watchAsync(lockKey);
|
|
152
|
+
const currentProcessId = await this.redisClient.getAsync(lockKey);
|
|
153
|
+
if (currentProcessId === processingId) {
|
|
154
|
+
let removeCommand = this.redisClient.multi()
|
|
155
|
+
.del(lockKey);
|
|
156
|
+
if (activated) {
|
|
157
|
+
removeCommand = removeCommand.zrem([this.activeRedisKey(), this.redisHash(queryKey)]);
|
|
158
|
+
}
|
|
159
|
+
await removeCommand
|
|
160
|
+
.execAsync();
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return currentProcessId;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
await this.redisClient.unwatchAsync();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async optimisticQueryUpdate(queryKey, toUpdate, processingId) {
|
|
172
|
+
try {
|
|
173
|
+
let query = await this.getQueryDef(queryKey);
|
|
174
|
+
for (let i = 0; i < 10; i++) {
|
|
175
|
+
if (query) {
|
|
176
|
+
// eslint-disable-next-line no-await-in-loop
|
|
177
|
+
await this.redisClient.watchAsync(this.queryProcessingLockKey(queryKey));
|
|
178
|
+
const currentProcessId = await this.redisClient.getAsync(this.queryProcessingLockKey(queryKey));
|
|
179
|
+
if (currentProcessId !== processingId) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
let [beforeUpdate] = await this.redisClient
|
|
183
|
+
.multi()
|
|
184
|
+
.hget([this.queriesDefKey(), this.redisHash(queryKey)])
|
|
185
|
+
.hset([this.queriesDefKey(), this.redisHash(queryKey), JSON.stringify(Object.assign(Object.assign({}, query), toUpdate))])
|
|
186
|
+
.execAsync();
|
|
187
|
+
beforeUpdate = JSON.parse(beforeUpdate);
|
|
188
|
+
if (JSON.stringify(query) === JSON.stringify(beforeUpdate)) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
query = beforeUpdate;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw new Error(`Can't update ${queryKey} with ${JSON.stringify(toUpdate)}`);
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
await this.redisClient.unwatchAsync();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
release() {
|
|
201
|
+
return this.redisClient.quit();
|
|
202
|
+
}
|
|
203
|
+
toProcessRedisKey() {
|
|
204
|
+
return this.queueRedisKey('QUEUE');
|
|
205
|
+
}
|
|
206
|
+
recentRedisKey() {
|
|
207
|
+
return this.queueRedisKey('RECENT');
|
|
208
|
+
}
|
|
209
|
+
activeRedisKey() {
|
|
210
|
+
return this.queueRedisKey('ACTIVE');
|
|
211
|
+
}
|
|
212
|
+
heartBeatRedisKey() {
|
|
213
|
+
return this.queueRedisKey('HEART_BEAT');
|
|
214
|
+
}
|
|
215
|
+
queryRedisKey(queryKey, suffix) {
|
|
216
|
+
return `${this.redisQueuePrefix}_${this.redisHash(queryKey)}_${suffix}`;
|
|
217
|
+
}
|
|
218
|
+
queueRedisKey(suffix) {
|
|
219
|
+
return `${this.redisQueuePrefix}_${suffix}`;
|
|
220
|
+
}
|
|
221
|
+
queriesDefKey() {
|
|
222
|
+
return this.queueRedisKey('QUERIES');
|
|
223
|
+
}
|
|
224
|
+
processingIdKey() {
|
|
225
|
+
return this.queueRedisKey('PROCESSING_COUNTER');
|
|
226
|
+
}
|
|
227
|
+
resultListKey(queryKey) {
|
|
228
|
+
return this.queryRedisKey(queryKey, 'RESULT');
|
|
229
|
+
}
|
|
230
|
+
queryProcessingLockKey(queryKey) {
|
|
231
|
+
return this.queryRedisKey(queryKey, 'LOCK');
|
|
232
|
+
}
|
|
233
|
+
redisHash(queryKey) {
|
|
234
|
+
return this.driver.redisHash(queryKey);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.RedisQueueDriverConnection = RedisQueueDriverConnection;
|
|
238
|
+
class RedisQueueDriver extends BaseQueueDriver_1.BaseQueueDriver {
|
|
239
|
+
constructor(options) {
|
|
240
|
+
super();
|
|
241
|
+
this.redisPool = options.redisPool;
|
|
242
|
+
this.options = options;
|
|
243
|
+
}
|
|
244
|
+
async createConnection() {
|
|
245
|
+
const redisClient = await this.redisPool.getClient();
|
|
246
|
+
return new RedisQueueDriverConnection(this, Object.assign({ redisClient }, this.options));
|
|
247
|
+
}
|
|
248
|
+
release(connection) {
|
|
249
|
+
this.redisPool.release(connection.redisClient);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.RedisQueueDriver = RedisQueueDriver;
|
|
253
|
+
//# sourceMappingURL=RedisQueueDriver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisQueueDriver.js","sourceRoot":"","sources":["../../../src/orchestrator/RedisQueueDriver.js"],"names":[],"mappings":";;;;;;AAAA,kDAAsB;AACtB,uDAAoD;AAEpD,MAAa,0BAA0B;IACrC,YAAY,MAAM,EAAE,OAAO;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,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;IACzC,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,QAAQ;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;YACzF,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACjC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC5F,IAAI,MAAM,EAAE;YACV,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,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IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAClD,CAAC;IAED,aAAa,CAAC,QAAQ;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED,sBAAsB,CAAC,QAAQ;QAC7B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS,CAAC,QAAQ;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AAnQD,gEAmQC;AAED,MAAa,gBAAiB,SAAQ,iCAAe;IACnD,YAAY,OAAO;QACjB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QACrD,OAAO,IAAI,0BAA0B,CAAC,IAAI,kBACxC,WAAW,IACR,IAAI,CAAC,OAAO,EACf,CAAC;IACL,CAAC;IAED,OAAO,CAAC,UAAU;QAChB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;CACF;AAlBD,4CAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeoutError.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/TimeoutError.js"],"names":[],"mappings":"AAAA;IACuhwC,8BAAmC;CADhhwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeoutError.js","sourceRoot":"","sources":["../../../src/orchestrator/TimeoutError.js"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;CAAG;AAA1C,oCAA0C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './BaseQueueDriver';
|
|
2
|
+
export * from './ContinueWaitError';
|
|
3
|
+
export * from './LocalCacheDriver';
|
|
4
|
+
export * from './LocalQueueDriver';
|
|
5
|
+
export * from './PreAggregations';
|
|
6
|
+
export * from './QueryCache';
|
|
7
|
+
export * from './QueryOrchestrator';
|
|
8
|
+
export * from './QueryQueue';
|
|
9
|
+
export * from './RedisCacheDriver';
|
|
10
|
+
export * from './RedisFactory';
|
|
11
|
+
export * from './RedisPool';
|
|
12
|
+
export * from './RedisQueueDriver';
|
|
13
|
+
export * from './TimeoutError';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./BaseQueueDriver"), exports);
|
|
14
|
+
__exportStar(require("./ContinueWaitError"), exports);
|
|
15
|
+
__exportStar(require("./LocalCacheDriver"), exports);
|
|
16
|
+
__exportStar(require("./LocalQueueDriver"), exports);
|
|
17
|
+
__exportStar(require("./PreAggregations"), exports);
|
|
18
|
+
__exportStar(require("./QueryCache"), exports);
|
|
19
|
+
__exportStar(require("./QueryOrchestrator"), exports);
|
|
20
|
+
__exportStar(require("./QueryQueue"), exports);
|
|
21
|
+
__exportStar(require("./RedisCacheDriver"), exports);
|
|
22
|
+
__exportStar(require("./RedisFactory"), exports);
|
|
23
|
+
__exportStar(require("./RedisPool"), exports);
|
|
24
|
+
__exportStar(require("./RedisQueueDriver"), exports);
|
|
25
|
+
__exportStar(require("./TimeoutError"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/orchestrator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,sDAAoC;AACpC,+CAA6B;AAC7B,qDAAmC;AACnC,iDAA+B;AAC/B,8CAA4B;AAC5B,qDAAmC;AACnC,iDAA+B"}
|
package/driver/BaseDriver.js
CHANGED
|
@@ -1,224 +1,8 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const { cancelCombinator } = require('./utils');
|
|
1
|
+
const { BaseDriver } = require('../dist/src/driver/BaseDriver');
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ordered[key] = unordered[key];
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
return ordered;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const DbTypeToGenericType = {
|
|
15
|
-
'timestamp without time zone': 'timestamp',
|
|
16
|
-
integer: 'int',
|
|
17
|
-
'character varying': 'text',
|
|
18
|
-
varchar: 'text',
|
|
19
|
-
nvarchar: 'text',
|
|
20
|
-
text: 'text',
|
|
21
|
-
string: 'text',
|
|
22
|
-
boolean: 'boolean',
|
|
23
|
-
bigint: 'bigint',
|
|
24
|
-
time: 'string',
|
|
25
|
-
datetime: 'timestamp',
|
|
26
|
-
date: 'date',
|
|
27
|
-
'double precision': 'decimal'
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Order of keys is important here: from more specific to less specific
|
|
31
|
-
const DbTypeValueMatcher = {
|
|
32
|
-
timestamp: (v) => v instanceof Date || v.toString().match(/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d/),
|
|
33
|
-
date: (v) => v instanceof Date || v.toString().match(/^\d\d\d\d-\d\d-\d\d$/),
|
|
34
|
-
int: (v) => Number.isInteger(v) || v.toString().match(/^\d+$/),
|
|
35
|
-
decimal: (v) => v instanceof Number || v.toString().match(/^\d+(\.\d+)?$/),
|
|
36
|
-
boolean: (v) => v === false || v === true || v.toString().toLowerCase() === 'true' || v.toString().toLowerCase() === 'false',
|
|
37
|
-
string: (v) => v.length < 256,
|
|
38
|
-
text: () => true
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
class BaseDriver {
|
|
42
|
-
informationSchemaQuery() {
|
|
43
|
-
return `
|
|
44
|
-
SELECT columns.column_name as ${this.quoteIdentifier('column_name')},
|
|
45
|
-
columns.table_name as ${this.quoteIdentifier('table_name')},
|
|
46
|
-
columns.table_schema as ${this.quoteIdentifier('table_schema')},
|
|
47
|
-
columns.data_type as ${this.quoteIdentifier('data_type')}
|
|
48
|
-
FROM information_schema.columns
|
|
49
|
-
WHERE columns.table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
testConnection() {
|
|
54
|
-
throw new Error('Not implemented');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
query() {
|
|
58
|
-
throw new Error('Not implemented');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async downloadQueryResults(query, values) {
|
|
62
|
-
const rows = await this.query(query, values);
|
|
63
|
-
const fields = Object.keys(rows[0]);
|
|
64
|
-
|
|
65
|
-
const types = fields.map(field => ({
|
|
66
|
-
name: field,
|
|
67
|
-
type: Object.keys(DbTypeValueMatcher).find(
|
|
68
|
-
type => !rows.filter(row => !!row[field]).find(row => !DbTypeValueMatcher[type](row[field])) &&
|
|
69
|
-
rows.find(row => !!row[field])
|
|
70
|
-
) || 'text'
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
rows,
|
|
75
|
-
types,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
readOnly() {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
tablesSchema() {
|
|
84
|
-
const query = this.informationSchemaQuery();
|
|
85
|
-
|
|
86
|
-
const reduceCb = (result, i) => {
|
|
87
|
-
let schema = (result[i.table_schema] || {});
|
|
88
|
-
const tables = (schema[i.table_name] || []);
|
|
89
|
-
|
|
90
|
-
tables.push({ name: i.column_name, type: i.data_type, attributes: i.key_type ? ['primaryKey'] : [] });
|
|
91
|
-
|
|
92
|
-
tables.sort();
|
|
93
|
-
schema[i.table_name] = tables;
|
|
94
|
-
schema = sortByKeys(schema);
|
|
95
|
-
result[i.table_schema] = schema;
|
|
96
|
-
|
|
97
|
-
return sortByKeys(result);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return this.query(query).then(data => reduce(reduceCb, {}, data));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
createSchemaIfNotExists(schemaName) {
|
|
104
|
-
return this.query(
|
|
105
|
-
`SELECT schema_name FROM information_schema.schemata WHERE schema_name = ${this.param(0)}`,
|
|
106
|
-
[schemaName]
|
|
107
|
-
).then((schemas) => {
|
|
108
|
-
if (schemas.length === 0) {
|
|
109
|
-
return this.query(`CREATE SCHEMA IF NOT EXISTS ${schemaName}`);
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
getTablesQuery(schemaName) {
|
|
116
|
-
return this.query(
|
|
117
|
-
`SELECT table_name FROM information_schema.tables WHERE table_schema = ${this.param(0)}`,
|
|
118
|
-
[schemaName]
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
loadPreAggregationIntoTable(preAggregationTableName, loadSql, params, options) {
|
|
123
|
-
return this.query(loadSql, params, options);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
dropTable(tableName, options) {
|
|
127
|
-
return this.query(`DROP TABLE ${tableName}`, [], options);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
param(/* paramIndex */) {
|
|
131
|
-
return '?';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
testConnectionTimeout() {
|
|
135
|
-
return 10000;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
async downloadTable(table) {
|
|
139
|
-
return { rows: await this.query(`SELECT * FROM ${table}`) };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async uploadTable(table, columns, tableData) {
|
|
143
|
-
if (!tableData.rows) {
|
|
144
|
-
throw new Error(`${this.constructor} driver supports only rows upload`);
|
|
145
|
-
}
|
|
146
|
-
await this.createTable(table, columns);
|
|
147
|
-
try {
|
|
148
|
-
for (let i = 0; i < tableData.rows.length; i++) {
|
|
149
|
-
await this.query(
|
|
150
|
-
`INSERT INTO ${table}
|
|
151
|
-
(${columns.map(c => this.quoteIdentifier(c.name)).join(', ')})
|
|
152
|
-
VALUES (${columns.map((c, paramIndex) => this.param(paramIndex)).join(', ')})`,
|
|
153
|
-
columns.map(c => this.toColumnValue(tableData.rows[i][c.name], c.type))
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
} catch (e) {
|
|
157
|
-
await this.dropTable(table);
|
|
158
|
-
throw e;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// eslint-disable-next-line no-unused-vars
|
|
163
|
-
toColumnValue(value, genericType) {
|
|
164
|
-
return value;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async tableColumnTypes(table) {
|
|
168
|
-
const [schema, name] = table.split('.');
|
|
169
|
-
const columns = await this.query(
|
|
170
|
-
`SELECT columns.column_name,
|
|
171
|
-
columns.table_name,
|
|
172
|
-
columns.table_schema,
|
|
173
|
-
columns.data_type
|
|
174
|
-
FROM information_schema.columns
|
|
175
|
-
WHERE table_name = ${this.param(0)} AND table_schema = ${this.param(1)}`,
|
|
176
|
-
[name, schema]
|
|
177
|
-
);
|
|
178
|
-
return columns.map(c => ({ name: c.column_name, type: this.toGenericType(c.data_type) }));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
createTable(quotedTableName, columns) {
|
|
182
|
-
const createTableSql = this.createTableSql(quotedTableName, columns);
|
|
183
|
-
return this.query(createTableSql, []).catch(e => {
|
|
184
|
-
e.message = `Error during create table: ${createTableSql}: ${e.message}`;
|
|
185
|
-
throw e;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
createTableSql(quotedTableName, columns) {
|
|
190
|
-
columns = columns.map(c => `${this.quoteIdentifier(c.name)} ${this.fromGenericType(c.type)}`);
|
|
191
|
-
return `CREATE TABLE ${quotedTableName} (${columns.join(', ')})`;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
toGenericType(columnType) {
|
|
195
|
-
return DbTypeToGenericType[columnType.toLowerCase()] || columnType;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
fromGenericType(columnType) {
|
|
199
|
-
return columnType;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
quoteIdentifier(identifier) {
|
|
203
|
-
return `"${identifier}"`;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
cancelCombinator(fn) {
|
|
207
|
-
return cancelCombinator(fn);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
setLogger(logger) {
|
|
211
|
-
this.logger = logger;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
reportQueryUsage(usage, queryOptions) {
|
|
215
|
-
if (this.logger) {
|
|
216
|
-
this.logger('SQL Query Usage', {
|
|
217
|
-
...usage,
|
|
218
|
-
...queryOptions
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
3
|
+
process.emitWarning(
|
|
4
|
+
'Using absolute import with @cubejs-backend/query-orchestrator is deprecated',
|
|
5
|
+
'DeprecationWarning'
|
|
6
|
+
);
|
|
223
7
|
|
|
224
8
|
module.exports = BaseDriver;
|
package/driver/README.md
ADDED
package/driver/utils.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const promise = fn(saveCancelFn);
|
|
10
|
-
promise.cancel = () => Promise.all(cancelFnArray.map(cancel => cancel()));
|
|
11
|
-
return promise;
|
|
12
|
-
};
|
|
1
|
+
const { cancelCombinator } = require('../dist/src/driver/utils');
|
|
2
|
+
|
|
3
|
+
process.emitWarning(
|
|
4
|
+
'Using absolute import with @cubejs-backend/query-orchestrator is deprecated',
|
|
5
|
+
'DeprecationWarning'
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
module.exports = cancelCombinator;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { BaseQueueDriver } = require('../dist/src/orchestrator/BaseQueueDriver');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
crypto.createHash('md5').update(JSON.stringify(queryKey)).digest('hex');
|
|
8
|
-
}
|
|
9
|
-
}
|
|
3
|
+
process.emitWarning(
|
|
4
|
+
'Using absolute import with @cubejs-backend/query-orchestrator is deprecated',
|
|
5
|
+
'DeprecationWarning'
|
|
6
|
+
);
|
|
10
7
|
|
|
11
8
|
module.exports = BaseQueueDriver;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const { ContinueWaitError } = require('../dist/src/orchestrator/ContinueWaitError');
|
|
2
|
+
|
|
3
|
+
process.emitWarning(
|
|
4
|
+
'Using absolute import with @cubejs-backend/query-orchestrator is deprecated',
|
|
5
|
+
'DeprecationWarning'
|
|
6
|
+
);
|
|
6
7
|
|
|
7
8
|
module.exports = ContinueWaitError;
|
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { LocalCacheDriver } = require('../dist/src/orchestrator/LocalCacheDriver');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
async get(key) {
|
|
9
|
-
if (this.store[key] && this.store[key].exp < new Date().getTime()) {
|
|
10
|
-
delete this.store[key];
|
|
11
|
-
}
|
|
12
|
-
return this.store[key] && this.store[key].value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async set(key, value, expiration) {
|
|
16
|
-
this.store[key] = {
|
|
17
|
-
value,
|
|
18
|
-
exp: new Date().getTime() + expiration * 1000
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async remove(key) {
|
|
23
|
-
delete this.store[key];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async keysStartingWith(prefix) {
|
|
27
|
-
return Object.keys(this.store)
|
|
28
|
-
.filter(k => k.indexOf(prefix) === 0 && this.store[k].exp > new Date().getTime());
|
|
29
|
-
}
|
|
30
|
-
}
|
|
3
|
+
process.emitWarning(
|
|
4
|
+
'Using absolute import with @cubejs-backend/query-orchestrator is deprecated',
|
|
5
|
+
'DeprecationWarning'
|
|
6
|
+
);
|
|
31
7
|
|
|
32
8
|
module.exports = LocalCacheDriver;
|