@balena/pinejs 14.49.0 → 14.50.0-linear-runtime-migrator-0e95f856335f4d8b3ac95c421f6570153eef23e2
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/.versionbot/CHANGELOG.yml +35 -1
- package/CHANGELOG.md +6 -0
- package/VERSION +1 -1
- package/docs/Migrations.md +109 -1
- package/out/config-loader/config-loader.js +86 -76
- package/out/config-loader/config-loader.js.map +1 -1
- package/out/config-loader/env.d.ts +4 -0
- package/out/config-loader/env.js +4 -0
- package/out/config-loader/env.js.map +1 -1
- package/out/migrator/async.d.ts +7 -0
- package/out/migrator/async.js +156 -0
- package/out/migrator/async.js.map +1 -0
- package/out/migrator/migrations.sbvr +49 -0
- package/out/migrator/sync.js +3 -12
- package/out/migrator/sync.js.map +1 -1
- package/out/migrator/utils.d.ts +49 -3
- package/out/migrator/utils.js +132 -1
- package/out/migrator/utils.js.map +1 -1
- package/out/sbvr-api/sbvr-utils.d.ts +1 -1
- package/out/sbvr-api/sbvr-utils.js +4 -0
- package/out/sbvr-api/sbvr-utils.js.map +1 -1
- package/package.json +2 -2
- package/src/config-loader/config-loader.ts +20 -4
- package/src/config-loader/env.ts +4 -0
- package/src/migrator/async.ts +304 -0
- package/src/migrator/migrations.sbvr +49 -0
- package/src/migrator/sync.ts +4 -21
- package/src/migrator/utils.ts +218 -2
- package/src/sbvr-api/sbvr-utils.ts +7 -0
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
- commits:
|
|
2
|
+
- subject: Add async migrator
|
|
3
|
+
hash: cf6fcd61659cb516bc5b436136335e53f1fa890a
|
|
4
|
+
body: >
|
|
5
|
+
Needed for long lasting / massive data affecting migrations for zero
|
|
6
|
+
downtime of API.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Depends-on: #555
|
|
10
|
+
footer:
|
|
11
|
+
Change-type: minor
|
|
12
|
+
change-type: minor
|
|
13
|
+
Signed-off-by: Harald Fischer <harald@balena.io>
|
|
14
|
+
signed-off-by: Harald Fischer <harald@balena.io>
|
|
15
|
+
author: Harald Fischer
|
|
16
|
+
nested: []
|
|
17
|
+
- subject: Add async migrator
|
|
18
|
+
hash: 69530504166e30518609b5a5388f0467bd0b474d
|
|
19
|
+
body: >
|
|
20
|
+
Needed for long lasting / massive data affecting migrations for zero
|
|
21
|
+
downtime of API.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Depends-on: #555
|
|
25
|
+
footer:
|
|
26
|
+
Change-type: minor
|
|
27
|
+
change-type: minor
|
|
28
|
+
Signed-off-by: Harald Fischer <harald@balena.io>
|
|
29
|
+
signed-off-by: Harald Fischer <harald@balena.io>
|
|
30
|
+
author: Harald Fischer
|
|
31
|
+
nested: []
|
|
32
|
+
version: 14.50.0
|
|
33
|
+
title: "'Async runtime migrator'"
|
|
34
|
+
date: 2022-08-04T13:07:42.154Z
|
|
1
35
|
- commits:
|
|
2
36
|
- subject: Make checking that read-only TX queries are SELECT queries optional
|
|
3
37
|
hash: 7d6ef12d558b6cd5438b5cf277d969ccaccb5c21
|
|
@@ -25,7 +59,7 @@
|
|
|
25
59
|
nested: []
|
|
26
60
|
version: 14.49.0
|
|
27
61
|
title: "'Make checking that read-only TX queries are SELECT queries optional'"
|
|
28
|
-
date: 2022-08-
|
|
62
|
+
date: 2022-08-04T12:48:55.107Z
|
|
29
63
|
- commits:
|
|
30
64
|
- subject: Refactur checkModelExists to isModelNew
|
|
31
65
|
hash: 28725993f36edb2f372145addb3841b9a899d880
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file
|
|
|
4
4
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
# v14.50.0
|
|
8
|
+
## (2022-08-04)
|
|
9
|
+
|
|
10
|
+
* Add async migrator [Harald Fischer]
|
|
11
|
+
* Add async migrator [Harald Fischer]
|
|
12
|
+
|
|
7
13
|
# v14.49.0
|
|
8
14
|
## (2022-08-04)
|
|
9
15
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
14.
|
|
1
|
+
14.50.0
|
package/docs/Migrations.md
CHANGED
|
@@ -46,4 +46,112 @@ Migrations which are Node modules should export a function which will be called
|
|
|
46
46
|
|
|
47
47
|
You can execute SQL using `tx.executeSql(query)`, however note that the model for which the migration is running will *not* be available under `sbvrUtils.api`, as it has not executed yet.
|
|
48
48
|
|
|
49
|
-
You should return a promise so pinejs can wait for completion/errors.
|
|
49
|
+
You should return a promise so pinejs can wait for completion/errors.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Async Migrations
|
|
53
|
+
|
|
54
|
+
Migrations that may lock tables for a long time, eg. column renames on large tables, can be run as async migrations.
|
|
55
|
+
|
|
56
|
+
Async migrations are executed in small batches within individual transactions and run concurrently while Pine is serving requests. Async migrations are multi-instance safe. They are synchronized between instances via the `migration status` database table and the minimum interval between two migration executions is guaranteed across instances.
|
|
57
|
+
|
|
58
|
+
When Pine starts and determines there are multiple async migrations to be run, it starts all migrations concurrently. These migrations however do not run in parallel: only one migration batch is executed at any given time, then another, and so on. Thus, migrations should not depend on the result a previous one.
|
|
59
|
+
Once an async migration starts, it keeps running forever even after Pine instance restarts. The async migration will stop being executed when finalized with a dedicated flag in the async migration definition. This is to guarantee that new data inserted or updated at runtime can also be migrated. The status of running migrations can be checked in `migration status` table. The configured execution parameters and the execution metrics are stored and updated after each migration batch completes.
|
|
60
|
+
|
|
61
|
+
Each async migration needs to specify a pair of an async and a sync migration part, so that the sync migration statement closes the async migration and guarantees database consistency.
|
|
62
|
+
|
|
63
|
+
Async migrations are stored in the migrations folder, alongside synchronous migrations. Their file names are significant and must contain the string `.async.` so they are treated as async migrations. They can only be Typescript / Javascript (with `.ts`/`.js` extensions) files.
|
|
64
|
+
|
|
65
|
+
The async migration query must have a `LIMIT` statement to limit the maximum number of affected rows per batch.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Async migration procedure
|
|
69
|
+
An async migration procedure for adding / renaming a column may follow these steps:
|
|
70
|
+
1. Deployment
|
|
71
|
+
- Add new column (with independent sync migration) to contain new data and add code accessing the new column
|
|
72
|
+
- Old code reads/writes data to/from old column and async migration migrates data from old column to new column
|
|
73
|
+
- New code reads/writes to/from new column
|
|
74
|
+
- Async migrator runs forever
|
|
75
|
+
2. Deployment
|
|
76
|
+
- Finalize async migration => only sync migration part gets executed
|
|
77
|
+
- Sync migration migrates all left over data from old column to new column
|
|
78
|
+
- Sync migration deletes old column
|
|
79
|
+
- Only new code with reads/writes to/from new column
|
|
80
|
+
- Disable all old code that reads/writes to old column
|
|
81
|
+
|
|
82
|
+
### TS migration file format with SQL query string
|
|
83
|
+
|
|
84
|
+
The placeholder `%%ASYNC_BATCH_SIZE%%` will be replaced with the value specified by asyncBatchSize parameter
|
|
85
|
+
|
|
86
|
+
``` javascript
|
|
87
|
+
export = {
|
|
88
|
+
asyncSql: `\
|
|
89
|
+
UPDATE "device"
|
|
90
|
+
SET "note" = "device"."name"
|
|
91
|
+
WHERE id IN ( SELECT id FROM (
|
|
92
|
+
SELECT id FROM "device"
|
|
93
|
+
WHERE "device"."name" <> "device"."note" OR "device"."note" IS NULL
|
|
94
|
+
LIMIT %%ASYNC_BATCH_SIZE%%
|
|
95
|
+
) tmp
|
|
96
|
+
);
|
|
97
|
+
`,
|
|
98
|
+
syncSql: `\
|
|
99
|
+
UPDATE "device"
|
|
100
|
+
SET "note" = "device"."name"
|
|
101
|
+
WHERE id IN ( SELECT id FROM (
|
|
102
|
+
SELECT id FROM "device"
|
|
103
|
+
WHERE "device"."name" <> "device"."note" OR "device"."note" IS NULL
|
|
104
|
+
) tmp
|
|
105
|
+
);
|
|
106
|
+
`,
|
|
107
|
+
delayMS: 100,
|
|
108
|
+
backoffDelayMS: 4000,
|
|
109
|
+
errorThreshold: 15,
|
|
110
|
+
asyncBatchSize: 1,
|
|
111
|
+
finalize: true,
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### TS migration file format with migrator function definition
|
|
116
|
+
|
|
117
|
+
`${options.batchSize}` will be the value specified by asyncBatchSize parameter.
|
|
118
|
+
|
|
119
|
+
``` javascript
|
|
120
|
+
export = {
|
|
121
|
+
asyncFn: async (tx: any, options) => {
|
|
122
|
+
const staticSql = `\
|
|
123
|
+
UPDATE "device"
|
|
124
|
+
SET "note" = "device"."name"
|
|
125
|
+
WHERE id IN ( SELECT id FROM (
|
|
126
|
+
SELECT id FROM "device"
|
|
127
|
+
WHERE "device"."name" <> "device"."note" OR "device"."note" IS NULL
|
|
128
|
+
LIMIT ${options.batchSize}
|
|
129
|
+
) tmp
|
|
130
|
+
);
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
return await tx.executeSql(staticSql);
|
|
134
|
+
},
|
|
135
|
+
syncFn: async (tx: any) => {
|
|
136
|
+
const staticSql = `\
|
|
137
|
+
UPDATE "device"
|
|
138
|
+
SET "note" = "device"."name"
|
|
139
|
+
WHERE id IN ( SELECT id FROM (
|
|
140
|
+
SELECT id FROM "device"
|
|
141
|
+
WHERE "device"."name" <> "device"."note" OR "device"."note" IS NULL
|
|
142
|
+
) tmp
|
|
143
|
+
);
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
await tx.executeSql(staticSql);
|
|
147
|
+
},
|
|
148
|
+
asyncBatchSize: 1,
|
|
149
|
+
delayMS: 100,
|
|
150
|
+
backoffDelayMS: 4000,
|
|
151
|
+
errorThreshold: 15,
|
|
152
|
+
finalize: true,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
### SQL query file (plain text)
|
|
157
|
+
Plain SQL files are not supported as they cannot bundle async and sync migration statements in one file. Moreover they cannot carry migration metadata.
|
|
@@ -35,91 +35,93 @@ const getOrCreatePermission = async (authApiTx, permissionName) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
const setup = (app) => {
|
|
38
|
-
const loadConfig =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
for (const permissionName of user.permissions) {
|
|
54
|
-
(_a = permissionsCache[permissionName]) !== null && _a !== void 0 ? _a : (permissionsCache[permissionName] = getOrCreatePermission(authApiTx, permissionName));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
await Promise.all(users.map(async (user) => {
|
|
58
|
-
try {
|
|
59
|
-
const userID = await getOrCreate(authApiTx, 'user', {
|
|
60
|
-
username: user.username,
|
|
61
|
-
}, {
|
|
62
|
-
password: user.password,
|
|
63
|
-
});
|
|
64
|
-
if (user.permissions != null) {
|
|
65
|
-
await Promise.all(user.permissions.map(async (permissionName) => {
|
|
66
|
-
const permissionID = await permissionsCache[permissionName];
|
|
67
|
-
await getOrCreate(authApiTx, 'user__has__permission', {
|
|
68
|
-
user: userID,
|
|
69
|
-
permission: permissionID,
|
|
70
|
-
});
|
|
71
|
-
}));
|
|
38
|
+
const loadConfig = async (data) => {
|
|
39
|
+
await sbvrUtils.db.transaction(async (tx) => {
|
|
40
|
+
var _a;
|
|
41
|
+
const authApiTx = sbvrUtils.api.Auth.clone({
|
|
42
|
+
passthrough: {
|
|
43
|
+
tx,
|
|
44
|
+
req: permissions.root,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const { users } = data;
|
|
48
|
+
if (users != null) {
|
|
49
|
+
const permissionsCache = {};
|
|
50
|
+
for (const user of users) {
|
|
51
|
+
if (user.permissions == null) {
|
|
52
|
+
continue;
|
|
72
53
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
e.message = `Could not create or find user "${user.username}": ${e.message}`;
|
|
76
|
-
throw e;
|
|
77
|
-
}
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
await Promise.all(data.models.map(async (model) => {
|
|
81
|
-
if ((model.abstractSql != null || model.modelText != null) &&
|
|
82
|
-
model.apiRoot != null) {
|
|
83
|
-
try {
|
|
84
|
-
await sbvrUtils.executeModel(tx, model);
|
|
85
|
-
const apiRoute = `/${model.apiRoot}/*`;
|
|
86
|
-
app.options(apiRoute, (_req, res) => res.status(200).end());
|
|
87
|
-
app.all(apiRoute, sbvrUtils.handleODataRequest);
|
|
88
|
-
console.info('Successfully executed ' + model.modelName + ' model.');
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
const message = `Failed to execute ${model.modelName} model from ${model.modelFile}`;
|
|
92
|
-
if (_.isError(err)) {
|
|
93
|
-
err.message = message;
|
|
94
|
-
throw err;
|
|
54
|
+
for (const permissionName of user.permissions) {
|
|
55
|
+
(_a = permissionsCache[permissionName]) !== null && _a !== void 0 ? _a : (permissionsCache[permissionName] = getOrCreatePermission(authApiTx, permissionName));
|
|
95
56
|
}
|
|
96
|
-
throw new Error(message);
|
|
97
57
|
}
|
|
98
|
-
|
|
99
|
-
if (model.customServerCode != null) {
|
|
100
|
-
let customCode;
|
|
101
|
-
if (typeof model.customServerCode === 'string') {
|
|
58
|
+
await Promise.all(users.map(async (user) => {
|
|
102
59
|
try {
|
|
103
|
-
|
|
60
|
+
const userID = await getOrCreate(authApiTx, 'user', {
|
|
61
|
+
username: user.username,
|
|
62
|
+
}, {
|
|
63
|
+
password: user.password,
|
|
64
|
+
});
|
|
65
|
+
if (user.permissions != null) {
|
|
66
|
+
await Promise.all(user.permissions.map(async (permissionName) => {
|
|
67
|
+
const permissionID = await permissionsCache[permissionName];
|
|
68
|
+
await getOrCreate(authApiTx, 'user__has__permission', {
|
|
69
|
+
user: userID,
|
|
70
|
+
permission: permissionID,
|
|
71
|
+
});
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
104
74
|
}
|
|
105
75
|
catch (e) {
|
|
106
|
-
e.message = `
|
|
76
|
+
e.message = `Could not create or find user "${user.username}": ${e.message}`;
|
|
107
77
|
throw e;
|
|
108
78
|
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
await Promise.all(data.models.map(async (model) => {
|
|
82
|
+
if ((model.abstractSql != null || model.modelText != null) &&
|
|
83
|
+
model.apiRoot != null) {
|
|
84
|
+
try {
|
|
85
|
+
await sbvrUtils.executeModel(tx, model);
|
|
86
|
+
const apiRoute = `/${model.apiRoot}/*`;
|
|
87
|
+
app.options(apiRoute, (_req, res) => res.status(200).end());
|
|
88
|
+
app.all(apiRoute, sbvrUtils.handleODataRequest);
|
|
89
|
+
console.info('Successfully executed ' + model.modelName + ' model.');
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
const message = `Failed to execute ${model.modelName} model from ${model.modelFile}`;
|
|
93
|
+
if (_.isError(err)) {
|
|
94
|
+
err.message = message;
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
throw new Error(message);
|
|
98
|
+
}
|
|
109
99
|
}
|
|
110
|
-
|
|
111
|
-
customCode
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
100
|
+
if (model.customServerCode != null) {
|
|
101
|
+
let customCode;
|
|
102
|
+
if (typeof model.customServerCode === 'string') {
|
|
103
|
+
try {
|
|
104
|
+
customCode = nodeRequire(model.customServerCode).setup;
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
e.message = `Error loading custom server code: '${e.message}'`;
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (typeof model.customServerCode === 'object') {
|
|
112
|
+
customCode = model.customServerCode.setup;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw new Error(`Invalid type for customServerCode '${typeof model.customServerCode}'`);
|
|
116
|
+
}
|
|
117
|
+
if (typeof customCode !== 'function') {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
await customCode(app, sbvrUtils, sbvrUtils.db);
|
|
118
121
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
});
|
|
122
|
+
}));
|
|
123
|
+
});
|
|
124
|
+
};
|
|
123
125
|
const loadConfigFile = async (configPath) => {
|
|
124
126
|
console.info('Loading config:', configPath);
|
|
125
127
|
return await Promise.resolve().then(() => require(configPath));
|
|
@@ -174,12 +176,16 @@ const setup = (app) => {
|
|
|
174
176
|
migrationCategory = fileNameParts[1];
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
177
|
-
console.error(`
|
|
179
|
+
console.error(`Unrecognized migration file category ${fileNameParts[1]}, skipping: ${path.extname(filename)}`);
|
|
178
180
|
return;
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
const assignMigrationWithCategory = (newMigrationKey, newMigration) => {
|
|
182
184
|
const catMigrations = migrations[migrationCategory] || {};
|
|
185
|
+
if (typeof newMigration === 'object' &&
|
|
186
|
+
migrationCategory === 'async') {
|
|
187
|
+
newMigration.type = 'async';
|
|
188
|
+
}
|
|
183
189
|
if (typeof catMigrations === 'object') {
|
|
184
190
|
migrations[migrationCategory] = {
|
|
185
191
|
[newMigrationKey]: newMigration,
|
|
@@ -194,6 +200,10 @@ const setup = (app) => {
|
|
|
194
200
|
assignMigrationWithCategory(migrationKey, nodeRequire(filePath));
|
|
195
201
|
break;
|
|
196
202
|
case '.sql':
|
|
203
|
+
if (migrationCategory === 'async') {
|
|
204
|
+
console.error(`Plain async migration sql statement not supported, needs to be an object, skipping: ${path.extname(filename)}`);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
197
207
|
assignMigrationWithCategory(migrationKey, await fs.promises.readFile(filePath, 'utf8'));
|
|
198
208
|
break;
|
|
199
209
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/config-loader/config-loader.ts"],"names":[],"mappings":";;;AAKA,6CAK2B;AAE3B,yBAAyB;AACzB,4BAA4B;AAC5B,6BAA6B;AAE7B,oDAAoD;AAEpD,uDAAuD;AAmCvD,MAAM,WAAW,GAAG,KAAK,EACxB,SAAiC,EACjC,QAAgB,EAChB,YAAuB,EACvB,WAAuB,EACtB,EAAE;IACH,MAAM,MAAM,GAAG,CAAC,MAAM,SAAS,CAAC,GAAG,CAAC;QACnC,QAAQ;QACR,EAAE,EAAE,YAAY;QAChB,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;KACD,CAAC,CAA+B,CAAC;IAClC,IAAI,MAAM,IAAI,IAAI,EAAE;QACnB,OAAO,MAAM,CAAC,EAAE,CAAC;KACjB;IACD,MAAM,EAAE,EAAE,EAAE,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC;QACpC,QAAQ;QACR,IAAI,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,WAAW,EAAE;QACzC,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE;KAClC,CAAC,CAAmB,CAAC;IACtB,OAAO,EAAE,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,KAAK,EAClC,SAAiC,EACjC,cAAsB,EACrB,EAAE;IACH,IAAI;QACH,OAAO,MAAM,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;KAC5E;IAAC,OAAO,CAAM,EAAE;QAChB,CAAC,CAAC,OAAO,GAAG,wCAAwC,cAAc,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QACpF,MAAM,CAAC,CAAC;KACR;AACF,CAAC,CAAC;AAGK,MAAM,KAAK,GAAG,CAAC,GAAwB,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/config-loader/config-loader.ts"],"names":[],"mappings":";;;AAKA,6CAK2B;AAE3B,yBAAyB;AACzB,4BAA4B;AAC5B,6BAA6B;AAE7B,oDAAo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CAAC,CAAC;IAEF,OAAO;QACN,UAAU;QACV,qBAAqB;KACrB,CAAC;AACH,CAAC,CAAC;AAtQW,QAAA,KAAK,SAsQhB"}
|
|
@@ -43,5 +43,9 @@ export declare const db: {
|
|
|
43
43
|
export declare const migrator: {
|
|
44
44
|
lockTimeout: number;
|
|
45
45
|
lockFailDelay: number;
|
|
46
|
+
asyncMigrationDefaultDelayMS: number;
|
|
47
|
+
asyncMigrationDefaultBackoffDelayMS: number;
|
|
48
|
+
asyncMigrationDefaultErrorThreshold: number;
|
|
49
|
+
asyncMigrationDefaultBatchSize: number;
|
|
46
50
|
};
|
|
47
51
|
export {};
|
package/out/config-loader/env.js
CHANGED
|
@@ -74,5 +74,9 @@ exports.db = {
|
|
|
74
74
|
exports.migrator = {
|
|
75
75
|
lockTimeout: 5 * 60 * 1000,
|
|
76
76
|
lockFailDelay: 20 * 1000,
|
|
77
|
+
asyncMigrationDefaultDelayMS: 1000,
|
|
78
|
+
asyncMigrationDefaultBackoffDelayMS: 60000,
|
|
79
|
+
asyncMigrationDefaultErrorThreshold: 10,
|
|
80
|
+
asyncMigrationDefaultBatchSize: 1000,
|
|
77
81
|
};
|
|
78
82
|
//# sourceMappingURL=env.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config-loader/env.ts"],"names":[],"mappings":";;;AACA,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AACzD,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;IAEtD,OAAO,CAAC,IAAI,CAAC,mCAAmC,YAAY,GAAG,CAAC,CAAC;CACjE;AAEY,QAAA,KAAK,GACjB,YAAY,KAAK,GAAG,IAAI,CAAC,YAAY,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC;AA0Bp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gB,EAAE,SAA+B;IACjD,YAAY,EAAE,SAA+B;IAC7C,uBAAuB,EAAE,KAA2B;IACpD,SAAS,EAAE,IAA2B;IACtC,eAAe,EAAE,KAAK;IACtB,SAAS;IACT,OAAO,EAAE,QAAQ;IACjB,kBAAkB,EAAE,CAAC;IASrB,oBAAoB,EAAE,aAAK;CAC3B,CAAC;AAEW,QAAA,QAAQ,GAAG;IACvB,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAE1B,aAAa,EAAE,EAAE,GAAG,IAAI;IACxB,4BAA4B,EAAE,IAAI;IAClC,mCAAmC,EAAE,KAAK;IAC1C,mCAAmC,EAAE,EAAE;IACvC,8BAA8B,EAAE,IAAI;CACpC,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
const sbvrUtils = require("../sbvr-api/sbvr-utils");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const run = async (tx, model) => {
|
|
8
|
+
const { migrations } = model;
|
|
9
|
+
if (migrations == null || _.isEmpty(migrations)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const asyncMigrations = (0, utils_1.getRunnableAsyncMigrations)(migrations);
|
|
13
|
+
if (asyncMigrations == null || typeof asyncMigrations !== 'object') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
await $run(tx, model, asyncMigrations);
|
|
17
|
+
};
|
|
18
|
+
exports.run = run;
|
|
19
|
+
const $run = async (setupTx, model, migrations) => {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
|
+
const modelName = model.apiRoot;
|
|
22
|
+
const asyncMigrationSetup = [];
|
|
23
|
+
const modelIsNew = await sbvrUtils.isModelNew(setupTx, modelName);
|
|
24
|
+
if (modelIsNew) {
|
|
25
|
+
((_b = (_a = sbvrUtils.api.migrations) === null || _a === void 0 ? void 0 : _a.logger.info) !== null && _b !== void 0 ? _b : console.info)('First time model has executed, skipping async migrations');
|
|
26
|
+
await (0, utils_1.setExecutedMigrations)(setupTx, modelName, Object.keys(migrations));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const executedMigrations = await (0, utils_1.getExecutedMigrations)(setupTx, modelName);
|
|
30
|
+
const pendingMigrations = (0, utils_1.filterAndSortPendingMigrations)(migrations, executedMigrations);
|
|
31
|
+
for (const [key, migration] of pendingMigrations) {
|
|
32
|
+
let asyncRunnerMigratorFn;
|
|
33
|
+
const initMigrationState = {
|
|
34
|
+
migration_key: key,
|
|
35
|
+
start_time: new Date(),
|
|
36
|
+
last_run_time: new Date(),
|
|
37
|
+
run_counter: 0,
|
|
38
|
+
migrated_rows: 0,
|
|
39
|
+
error_counter: 0,
|
|
40
|
+
error_threshold: utils_1.migratorEnv.asyncMigrationDefaultErrorThreshold,
|
|
41
|
+
delayMS: utils_1.migratorEnv.asyncMigrationDefaultDelayMS,
|
|
42
|
+
backoffDelayMS: utils_1.migratorEnv.asyncMigrationDefaultBackoffDelayMS,
|
|
43
|
+
converged_time: undefined,
|
|
44
|
+
last_error_message: undefined,
|
|
45
|
+
is_backoff: false,
|
|
46
|
+
};
|
|
47
|
+
if (typeof migration === 'object') {
|
|
48
|
+
const batchSize = migration.asyncBatchSize || utils_1.migratorEnv.asyncMigrationDefaultBatchSize;
|
|
49
|
+
if (migration.asyncFn && typeof migration.asyncFn === 'function') {
|
|
50
|
+
asyncRunnerMigratorFn = async (tx) => (await migration.asyncFn(tx, {
|
|
51
|
+
batchSize,
|
|
52
|
+
}, sbvrUtils)).rowsAffected;
|
|
53
|
+
}
|
|
54
|
+
else if (migration.asyncSql && typeof migration.asyncSql === 'string') {
|
|
55
|
+
const asyncMigrationSqlStatement = (_c = migration.asyncSql) === null || _c === void 0 ? void 0 : _c.replace('%%ASYNC_BATCH_SIZE%%', `${batchSize}`);
|
|
56
|
+
asyncRunnerMigratorFn = async (tx) => (await tx.executeSql(asyncMigrationSqlStatement)).rowsAffected;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
((_e = (_d = sbvrUtils.api.migrations) === null || _d === void 0 ? void 0 : _d.logger.error) !== null && _e !== void 0 ? _e : console.error)(`Invalid migration object: ${JSON.stringify(migration, null, 2)}`);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
initMigrationState.backoffDelayMS =
|
|
63
|
+
migration.backoffDelayMS ||
|
|
64
|
+
utils_1.migratorEnv.asyncMigrationDefaultBackoffDelayMS;
|
|
65
|
+
initMigrationState.delayMS =
|
|
66
|
+
migration.delayMS || utils_1.migratorEnv.asyncMigrationDefaultDelayMS;
|
|
67
|
+
initMigrationState.error_threshold =
|
|
68
|
+
migration.errorThreshold ||
|
|
69
|
+
utils_1.migratorEnv.asyncMigrationDefaultErrorThreshold;
|
|
70
|
+
}
|
|
71
|
+
else if (typeof migration === 'string') {
|
|
72
|
+
asyncRunnerMigratorFn = async (tx) => (await tx.executeSql(migration)).rowsAffected;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
((_g = (_f = sbvrUtils.api.migrations) === null || _f === void 0 ? void 0 : _f.logger.error) !== null && _g !== void 0 ? _g : console.error)(`Invalid async migration object: ${JSON.stringify(migration, null, 2)}`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
await (0, utils_1.initMigrationStatus)(setupTx, initMigrationState);
|
|
79
|
+
asyncMigrationSetup.push({
|
|
80
|
+
key,
|
|
81
|
+
initMigrationState,
|
|
82
|
+
asyncRunnerMigratorFn,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
setupTx.on('end', () => {
|
|
86
|
+
for (const { key, initMigrationState, asyncRunnerMigratorFn, } of asyncMigrationSetup) {
|
|
87
|
+
const asyncRunner = async () => {
|
|
88
|
+
await sbvrUtils.db.transaction(async (tx) => {
|
|
89
|
+
await (0, utils_1.lockMigrations)(tx, modelName, async () => {
|
|
90
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
91
|
+
const migrationState = await (0, utils_1.readMigrationStatus)(tx, key);
|
|
92
|
+
if (!migrationState) {
|
|
93
|
+
((_b = (_a = sbvrUtils.api.migrations) === null || _a === void 0 ? void 0 : _a.logger.info) !== null && _b !== void 0 ? _b : console.info)(`stopping async migration: ${key}`);
|
|
94
|
+
clearInterval(asyncScheduler);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
clearInterval(asyncScheduler);
|
|
99
|
+
if (migrationState.last_run_time) {
|
|
100
|
+
const durationSinceLastRun = Date.now() - migrationState.last_run_time.getTime();
|
|
101
|
+
if ((migrationState.is_backoff &&
|
|
102
|
+
durationSinceLastRun < initMigrationState.backoffDelayMS) ||
|
|
103
|
+
(!migrationState.is_backoff &&
|
|
104
|
+
durationSinceLastRun < initMigrationState.delayMS)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
migrationState.last_run_time = new Date();
|
|
109
|
+
migrationState.run_counter += 1;
|
|
110
|
+
let migratedRows = 0;
|
|
111
|
+
await sbvrUtils.db.transaction(async (migrationTx) => {
|
|
112
|
+
var _a;
|
|
113
|
+
migratedRows =
|
|
114
|
+
(_a = (await (asyncRunnerMigratorFn === null || asyncRunnerMigratorFn === void 0 ? void 0 : asyncRunnerMigratorFn(migrationTx)))) !== null && _a !== void 0 ? _a : 0;
|
|
115
|
+
});
|
|
116
|
+
migrationState.migrated_rows += migratedRows;
|
|
117
|
+
if (migratedRows === 0) {
|
|
118
|
+
migrationState.is_backoff = true;
|
|
119
|
+
(_c = migrationState.converged_time) !== null && _c !== void 0 ? _c : (migrationState.converged_time = new Date());
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
migrationState.is_backoff = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
migrationState.error_counter++;
|
|
127
|
+
if (err instanceof Error) {
|
|
128
|
+
if (migrationState.error_counter %
|
|
129
|
+
initMigrationState.error_threshold ===
|
|
130
|
+
0) {
|
|
131
|
+
migrationState.last_error_message = `${err.name} ${err.message}`;
|
|
132
|
+
((_e = (_d = sbvrUtils.api.migrations) === null || _d === void 0 ? void 0 : _d.logger.error) !== null && _e !== void 0 ? _e : console.error)(`${key}: ${err.name} ${err.message}`);
|
|
133
|
+
migrationState.is_backoff = true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
((_g = (_f = sbvrUtils.api.migrations) === null || _f === void 0 ? void 0 : _f.logger.error) !== null && _g !== void 0 ? _g : console.error)(`async migration error unknown: ${key}: ${err}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
if (migrationState.is_backoff) {
|
|
142
|
+
asyncScheduler = setInterval(asyncRunner, initMigrationState.backoffDelayMS);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
asyncScheduler = setInterval(asyncRunner, initMigrationState.delayMS);
|
|
146
|
+
}
|
|
147
|
+
await (0, utils_1.updateMigrationStatus)(tx, migrationState);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
let asyncScheduler = setInterval(asyncRunner, initMigrationState.delayMS);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../src/migrator/async.ts"],"names":[],"mappings":";;;AAGA,4BAA4B;AAC5B,oDAAoD;AAIpD,mCAciB;AAEV,MAAM,GAAG,GAAG,KAAK,EAAE,EAAM,EAAE,KAAmB,EAAiB,EAAE;IACvE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC7B,IAAI,UAAU,IAAI,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC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