@powersync/service-core 1.16.0 → 1.16.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 +16 -0
- package/dist/replication/ReplicationEngine.d.ts +1 -0
- package/dist/replication/ReplicationEngine.js +16 -1
- package/dist/replication/ReplicationEngine.js.map +1 -1
- package/dist/storage/SyncRulesBucketStorage.d.ts +4 -0
- package/dist/storage/SyncRulesBucketStorage.js.map +1 -1
- package/package.json +1 -1
- package/src/replication/ReplicationEngine.ts +16 -1
- package/src/storage/SyncRulesBucketStorage.ts +5 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @powersync/service-core
|
|
2
2
|
|
|
3
|
+
## 1.16.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b364581: Avoid re-compacting recently compacted buckets.
|
|
8
|
+
- d889219: Fix memory leaks when retrying replication after errors.
|
|
9
|
+
- 0ace0d3: Fix liveness probe when no connections are defined.
|
|
10
|
+
- 7eb7957: [Postgres] Remove usage of pg_logical_slot_peek_binary_changes due to performance issues in some cases
|
|
11
|
+
- b364581: Reduce batch size for checksum pre-calculations to reduce timeouts.
|
|
12
|
+
|
|
13
|
+
## 1.16.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- c6bdb4f: [MongoDB storage] Fix migration for indexes on connection_report_events.
|
|
18
|
+
|
|
3
19
|
## 1.16.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -2,6 +2,7 @@ import { AbstractReplicator } from './AbstractReplicator.js';
|
|
|
2
2
|
import { ConnectionTestResult } from './ReplicationModule.js';
|
|
3
3
|
export declare class ReplicationEngine {
|
|
4
4
|
private readonly replicators;
|
|
5
|
+
private probeInterval;
|
|
5
6
|
/**
|
|
6
7
|
* Register a Replicator with the engine
|
|
7
8
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { logger } from '@powersync/lib-services-framework';
|
|
1
|
+
import { container, logger } from '@powersync/lib-services-framework';
|
|
2
2
|
export class ReplicationEngine {
|
|
3
3
|
replicators = new Map();
|
|
4
|
+
probeInterval = null;
|
|
4
5
|
/**
|
|
5
6
|
* Register a Replicator with the engine
|
|
6
7
|
*
|
|
@@ -22,6 +23,17 @@ export class ReplicationEngine {
|
|
|
22
23
|
logger.info(`Starting Replicator: ${replicator.id}`);
|
|
23
24
|
replicator.start();
|
|
24
25
|
}
|
|
26
|
+
if (this.replicators.size == 0) {
|
|
27
|
+
// If a replicator is running, the replicators update the probes.
|
|
28
|
+
// If no connections are configured, then no replicator is running
|
|
29
|
+
// Typical when no connections are configured.
|
|
30
|
+
// In this case, update the probe here to avoid liveness probe failures.
|
|
31
|
+
this.probeInterval = setInterval(() => {
|
|
32
|
+
container.probes.touch().catch((e) => {
|
|
33
|
+
logger.error(`Failed to touch probe`, e);
|
|
34
|
+
});
|
|
35
|
+
}, 5_000);
|
|
36
|
+
}
|
|
25
37
|
logger.info('Successfully started Replication Engine.');
|
|
26
38
|
}
|
|
27
39
|
/**
|
|
@@ -33,6 +45,9 @@ export class ReplicationEngine {
|
|
|
33
45
|
logger.info(`Stopping Replicator: ${replicator.id}`);
|
|
34
46
|
await replicator.stop();
|
|
35
47
|
}
|
|
48
|
+
if (this.probeInterval) {
|
|
49
|
+
clearInterval(this.probeInterval);
|
|
50
|
+
}
|
|
36
51
|
logger.info('Successfully shut down Replication Engine.');
|
|
37
52
|
}
|
|
38
53
|
async testConnection() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReplicationEngine.js","sourceRoot":"","sources":["../../src/replication/ReplicationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"ReplicationEngine.js","sourceRoot":"","sources":["../../src/replication/Replic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AC,CAAC;QACZ,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ;QACnB,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACnD,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,wBAAwB,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;YACrD,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,cAAc;QACzB,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IAC5G,CAAC;CACF"}
|
|
@@ -173,6 +173,10 @@ export interface CompactOptions {
|
|
|
173
173
|
moveBatchLimit?: number;
|
|
174
174
|
/** Minimum of 1 */
|
|
175
175
|
moveBatchQueryLimit?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Minimum of 1, default of 10.
|
|
178
|
+
*/
|
|
179
|
+
minBucketChanges?: number;
|
|
176
180
|
/**
|
|
177
181
|
* Internal/testing use: Cache size for compacting parameters.
|
|
178
182
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncRulesBucketStorage.js","sourceRoot":"","sources":["../../src/storage/SyncRulesBucketStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SyncRulesBucketStorage.js","sourceRoot":"","sources":["../../src/storage/SyncRulesBucketStorage.ts"],"names":[],"mappings":"AAoUA,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,kBAAkB,EAAE,IAAI,GAAG,EAAU;IACrC,qBAAqB,EAAE,IAAI;IAC3B,uBAAuB,EAAE,IAAI,GAAG,EAAU;IAC1C,0BAA0B,EAAE,IAAI;CACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { logger } from '@powersync/lib-services-framework';
|
|
1
|
+
import { container, logger } from '@powersync/lib-services-framework';
|
|
2
2
|
import { AbstractReplicator } from './AbstractReplicator.js';
|
|
3
3
|
import { ConnectionTestResult } from './ReplicationModule.js';
|
|
4
4
|
|
|
5
5
|
export class ReplicationEngine {
|
|
6
6
|
private readonly replicators: Map<string, AbstractReplicator> = new Map();
|
|
7
|
+
private probeInterval: NodeJS.Timeout | null = null;
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Register a Replicator with the engine
|
|
@@ -27,6 +28,17 @@ export class ReplicationEngine {
|
|
|
27
28
|
logger.info(`Starting Replicator: ${replicator.id}`);
|
|
28
29
|
replicator.start();
|
|
29
30
|
}
|
|
31
|
+
if (this.replicators.size == 0) {
|
|
32
|
+
// If a replicator is running, the replicators update the probes.
|
|
33
|
+
// If no connections are configured, then no replicator is running
|
|
34
|
+
// Typical when no connections are configured.
|
|
35
|
+
// In this case, update the probe here to avoid liveness probe failures.
|
|
36
|
+
this.probeInterval = setInterval(() => {
|
|
37
|
+
container.probes.touch().catch((e) => {
|
|
38
|
+
logger.error(`Failed to touch probe`, e);
|
|
39
|
+
});
|
|
40
|
+
}, 5_000);
|
|
41
|
+
}
|
|
30
42
|
logger.info('Successfully started Replication Engine.');
|
|
31
43
|
}
|
|
32
44
|
|
|
@@ -39,6 +51,9 @@ export class ReplicationEngine {
|
|
|
39
51
|
logger.info(`Stopping Replicator: ${replicator.id}`);
|
|
40
52
|
await replicator.stop();
|
|
41
53
|
}
|
|
54
|
+
if (this.probeInterval) {
|
|
55
|
+
clearInterval(this.probeInterval);
|
|
56
|
+
}
|
|
42
57
|
logger.info('Successfully shut down Replication Engine.');
|
|
43
58
|
}
|
|
44
59
|
|
|
@@ -217,6 +217,11 @@ export interface CompactOptions {
|
|
|
217
217
|
/** Minimum of 1 */
|
|
218
218
|
moveBatchQueryLimit?: number;
|
|
219
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Minimum of 1, default of 10.
|
|
222
|
+
*/
|
|
223
|
+
minBucketChanges?: number;
|
|
224
|
+
|
|
220
225
|
/**
|
|
221
226
|
* Internal/testing use: Cache size for compacting parameters.
|
|
222
227
|
*/
|