@reventlessdev/reventless-postgres 3.0.0-alpha.201 → 3.0.0-alpha.203
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/lib/bs/.compiler.log +2 -2
- package/lib/bs/compiler-info.json +1 -1
- package/lib/bs/src/DcbEventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres-ReventlessPostgres.cmj +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres.ast +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres.res +1 -1
- package/lib/bs/src/DcbEventLogStorage_Postgres.res.mjs +6 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres_Ops-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres_Ops-ReventlessPostgres.cmj +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres_Ops-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres_Ops.ast +0 -0
- package/lib/bs/src/DcbEventLogStorage_Postgres_Ops.res +12 -4
- package/lib/bs/src/DcbEventLogStorage_Postgres_Ops.res.mjs +11 -0
- package/lib/bs/src/EventLogChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/EventLogChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/EventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/EventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/EventLogStorage_Postgres_Ops-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/EventLogStorage_Postgres_Ops-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/PgChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/PgChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/PgSchema-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/PgSchema-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/PgSchema.ast +0 -0
- package/lib/bs/src/PgSchema.res +1 -1
- package/lib/bs/src/QueryDbStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres_Ops-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/QueryDbStorage_Postgres_Ops-ReventlessPostgres.cmt +0 -0
- package/lib/bs/src/QueryEnginePostgres-ReventlessPostgres.cmi +0 -0
- package/lib/bs/src/QueryEnginePostgres-ReventlessPostgres.cmt +0 -0
- package/lib/bs/tests/PostgresIntegrationTest-ReventlessPostgres.cmi +0 -0
- package/lib/bs/tests/PostgresIntegrationTest-ReventlessPostgres.cmt +0 -0
- package/lib/bs/tests/PostgresIntegrationTest.ast +0 -0
- package/lib/bs/tests/PostgresIntegrationTest.res +3 -3
- package/lib/bs/tests/QueryEnginePostgresListPageTest-ReventlessPostgres.cmi +0 -0
- package/lib/bs/tests/QueryEnginePostgresListPageTest-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/DcbEventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres-ReventlessPostgres.cmj +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres.ast +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres.res +1 -1
- package/lib/ocaml/DcbEventLogStorage_Postgres_Ops-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres_Ops-ReventlessPostgres.cmj +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres_Ops-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres_Ops.ast +0 -0
- package/lib/ocaml/DcbEventLogStorage_Postgres_Ops.res +12 -4
- package/lib/ocaml/EventLogChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/EventLogChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/EventLogStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/EventLogStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/EventLogStorage_Postgres_Ops-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/EventLogStorage_Postgres_Ops-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PgChangeFeed-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/PgChangeFeed-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PgSchema-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/PgSchema-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/PgSchema.ast +0 -0
- package/lib/ocaml/PgSchema.res +1 -1
- package/lib/ocaml/PostgresIntegrationTest.res +3 -3
- package/lib/ocaml/QueryDbStorage_Postgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres_Ops-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/QueryDbStorage_Postgres_Ops-ReventlessPostgres.cmt +0 -0
- package/lib/ocaml/QueryEnginePostgres-ReventlessPostgres.cmi +0 -0
- package/lib/ocaml/QueryEnginePostgres-ReventlessPostgres.cmt +0 -0
- package/package.json +6 -6
- package/src/DcbEventLogStorage_Postgres.res +1 -1
- package/src/DcbEventLogStorage_Postgres.res.mjs +6 -0
- package/src/DcbEventLogStorage_Postgres_Ops.res +12 -4
- package/src/DcbEventLogStorage_Postgres_Ops.res.mjs +11 -0
- package/src/PgSchema.res +1 -1
- package/tests/PostgresIntegrationTest.res +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.203 (2026-11-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @reventlessdev/reventless-postgres
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 3.0.0-alpha.202 (2026-11-12)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @reventlessdev/reventless-postgres
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# 3.0.0-alpha.201 (2026-11-11)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @reventlessdev/reventless-postgres
|
package/lib/bs/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1794767340782)
|
|
2
|
+
#Done(1794767343230)
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
"bsc_hash": "1006241435e8d5052329c523202a7fe6359a37e1e1688c023d37d6a7ebb5fb6d",
|
|
5
5
|
"rescript_config_hash": "af2af60a0fa33b8249a96ff2758f36482843126dc4e07b9302842d011e0ad8c6",
|
|
6
6
|
"runtime_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/runtime",
|
|
7
|
-
"generated_at": "
|
|
7
|
+
"generated_at": "1794767343238"
|
|
8
8
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -18,6 +18,10 @@ function makeStorage(pool, name, indexes, partitionTag, crossPartitionTagKeys, o
|
|
|
18
18
|
];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
let lockStrategies = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.lockStrategies;
|
|
22
|
+
|
|
23
|
+
let lockStrategyOfName = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.lockStrategyOfName;
|
|
24
|
+
|
|
21
25
|
let strategyParam = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.strategyParam;
|
|
22
26
|
|
|
23
27
|
let noTracking = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.noTracking;
|
|
@@ -53,6 +57,8 @@ let positionsOfAppend = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.posit
|
|
|
53
57
|
let makeOps = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.makeOps;
|
|
54
58
|
|
|
55
59
|
export {
|
|
60
|
+
lockStrategies,
|
|
61
|
+
lockStrategyOfName,
|
|
56
62
|
strategyParam,
|
|
57
63
|
noTracking,
|
|
58
64
|
selectColumns,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,11 +14,19 @@ open Reventless
|
|
|
14
14
|
// Lock strategy for concurrent appends (B4). Advisory (default) is safe under
|
|
15
15
|
// PgBouncer transaction mode; RowLocks avoids advisory-lock connection pinning
|
|
16
16
|
// on RDS Proxy at the cost of a companion `dcb_scope` table.
|
|
17
|
-
|
|
17
|
+
// A connection config names it by the case's own name (`"RowLocks"`).
|
|
18
|
+
type lockStrategy = AdvisoryLocks | RowLocks
|
|
19
|
+
|
|
20
|
+
let lockStrategies = [AdvisoryLocks, RowLocks]
|
|
21
|
+
|
|
22
|
+
/** The strategy a connection config names; `None` for a name that names none. */
|
|
23
|
+
let lockStrategyOfName = (name: string): option<lockStrategy> =>
|
|
24
|
+
lockStrategies->Array.find(s => (s :> string) == name)
|
|
25
|
+
|
|
18
26
|
let strategyParam = s =>
|
|
19
27
|
switch s {
|
|
20
|
-
|
|
|
21
|
-
|
|
|
28
|
+
| AdvisoryLocks => "advisory"
|
|
29
|
+
| RowLocks => "rows"
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
// Injected by reventless-local to feed the projection-checkpoint low-watermark
|
|
@@ -255,7 +263,7 @@ let makeOps = (
|
|
|
255
263
|
~partitionTag as _,
|
|
256
264
|
~crossPartitionTagKeys as _=?,
|
|
257
265
|
~opts as _,
|
|
258
|
-
~lockStrategy: lockStrategy
|
|
266
|
+
~lockStrategy: lockStrategy=AdvisoryLocks,
|
|
259
267
|
~onAppended=noTracking,
|
|
260
268
|
): (string, DcbEventLog_Adapter.operations) => {
|
|
261
269
|
// Fenced head cursor: the highest (transaction_id, position) visible under the
|
|
@@ -14,6 +14,15 @@ import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_excep
|
|
|
14
14
|
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
15
15
|
import * as PgDriver$ReventlessPostgres from "./PgDriver.res.mjs";
|
|
16
16
|
|
|
17
|
+
let lockStrategies = [
|
|
18
|
+
"AdvisoryLocks",
|
|
19
|
+
"RowLocks"
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function lockStrategyOfName(name) {
|
|
23
|
+
return lockStrategies.find(s => s === name);
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
function strategyParam(s) {
|
|
18
27
|
if (s === "AdvisoryLocks") {
|
|
19
28
|
return "advisory";
|
|
@@ -416,6 +425,8 @@ function makeOps(pool, name, param, param$1, param$2, param$3, lockStrategyOpt,
|
|
|
416
425
|
let pageSize = 500;
|
|
417
426
|
|
|
418
427
|
export {
|
|
428
|
+
lockStrategies,
|
|
429
|
+
lockStrategyOfName,
|
|
419
430
|
strategyParam,
|
|
420
431
|
noTracking,
|
|
421
432
|
selectColumns,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/bs/src/PgSchema.ast
CHANGED
|
Binary file
|
package/lib/bs/src/PgSchema.res
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// event_log / snapshot — classic OCC log (Phase A)
|
|
9
9
|
// dcb_event — DCB log; positions are a global IDENTITY sequence,
|
|
10
10
|
// rows stamped with the committing xid8 (Phase B)
|
|
11
|
-
// dcb_scope — companion table for the
|
|
11
|
+
// dcb_scope — companion table for the RowLocks strategy (B4)
|
|
12
12
|
// dcb_subscription — change-feed checkpoints (Phase D)
|
|
13
13
|
// dcb_condition_where(...) — compiles a DcbTag.query jsonb AST → SQL WHERE
|
|
14
14
|
// dcb_append(...) — the concurrency-critical append (B1): scoped
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// - write-skew: two genuinely concurrent conditional appends on one boundary —
|
|
11
11
|
// exactly one commits, the other conflicts cleanly (the anomaly the advisory
|
|
12
12
|
// locks close)
|
|
13
|
-
// - both
|
|
13
|
+
// - both AdvisoryLocks and RowLocks strategies
|
|
14
14
|
|
|
15
15
|
open JestGlobals
|
|
16
16
|
open ReventlessCore
|
|
@@ -184,8 +184,8 @@ switch processEnv->Dict.get("PG_URL") {
|
|
|
184
184
|
},
|
|
185
185
|
)
|
|
186
186
|
|
|
187
|
-
writeSkew(
|
|
188
|
-
writeSkew(
|
|
187
|
+
writeSkew(AdvisoryLocks, "dcb-skew-advisory")
|
|
188
|
+
writeSkew(RowLocks, "dcb-skew-rows")
|
|
189
189
|
|
|
190
190
|
testPromise("hot tag: N concurrent conditional appends, exactly one wins", async () => {
|
|
191
191
|
let (_n, ops, _s) = makeLog("dcb-hot")
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/.compiler.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#Start(
|
|
2
|
-
#Done(
|
|
1
|
+
#Start(1794767340782)
|
|
2
|
+
#Done(1794767343230)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,11 +14,19 @@ open Reventless
|
|
|
14
14
|
// Lock strategy for concurrent appends (B4). Advisory (default) is safe under
|
|
15
15
|
// PgBouncer transaction mode; RowLocks avoids advisory-lock connection pinning
|
|
16
16
|
// on RDS Proxy at the cost of a companion `dcb_scope` table.
|
|
17
|
-
|
|
17
|
+
// A connection config names it by the case's own name (`"RowLocks"`).
|
|
18
|
+
type lockStrategy = AdvisoryLocks | RowLocks
|
|
19
|
+
|
|
20
|
+
let lockStrategies = [AdvisoryLocks, RowLocks]
|
|
21
|
+
|
|
22
|
+
/** The strategy a connection config names; `None` for a name that names none. */
|
|
23
|
+
let lockStrategyOfName = (name: string): option<lockStrategy> =>
|
|
24
|
+
lockStrategies->Array.find(s => (s :> string) == name)
|
|
25
|
+
|
|
18
26
|
let strategyParam = s =>
|
|
19
27
|
switch s {
|
|
20
|
-
|
|
|
21
|
-
|
|
|
28
|
+
| AdvisoryLocks => "advisory"
|
|
29
|
+
| RowLocks => "rows"
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
// Injected by reventless-local to feed the projection-checkpoint low-watermark
|
|
@@ -255,7 +263,7 @@ let makeOps = (
|
|
|
255
263
|
~partitionTag as _,
|
|
256
264
|
~crossPartitionTagKeys as _=?,
|
|
257
265
|
~opts as _,
|
|
258
|
-
~lockStrategy: lockStrategy
|
|
266
|
+
~lockStrategy: lockStrategy=AdvisoryLocks,
|
|
259
267
|
~onAppended=noTracking,
|
|
260
268
|
): (string, DcbEventLog_Adapter.operations) => {
|
|
261
269
|
// Fenced head cursor: the highest (transaction_id, position) visible under the
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/ocaml/PgSchema.ast
CHANGED
|
Binary file
|
package/lib/ocaml/PgSchema.res
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// event_log / snapshot — classic OCC log (Phase A)
|
|
9
9
|
// dcb_event — DCB log; positions are a global IDENTITY sequence,
|
|
10
10
|
// rows stamped with the committing xid8 (Phase B)
|
|
11
|
-
// dcb_scope — companion table for the
|
|
11
|
+
// dcb_scope — companion table for the RowLocks strategy (B4)
|
|
12
12
|
// dcb_subscription — change-feed checkpoints (Phase D)
|
|
13
13
|
// dcb_condition_where(...) — compiles a DcbTag.query jsonb AST → SQL WHERE
|
|
14
14
|
// dcb_append(...) — the concurrency-critical append (B1): scoped
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// - write-skew: two genuinely concurrent conditional appends on one boundary —
|
|
11
11
|
// exactly one commits, the other conflicts cleanly (the anomaly the advisory
|
|
12
12
|
// locks close)
|
|
13
|
-
// - both
|
|
13
|
+
// - both AdvisoryLocks and RowLocks strategies
|
|
14
14
|
|
|
15
15
|
open JestGlobals
|
|
16
16
|
open ReventlessCore
|
|
@@ -184,8 +184,8 @@ switch processEnv->Dict.get("PG_URL") {
|
|
|
184
184
|
},
|
|
185
185
|
)
|
|
186
186
|
|
|
187
|
-
writeSkew(
|
|
188
|
-
writeSkew(
|
|
187
|
+
writeSkew(AdvisoryLocks, "dcb-skew-advisory")
|
|
188
|
+
writeSkew(RowLocks, "dcb-skew-rows")
|
|
189
189
|
|
|
190
190
|
testPromise("hot tag: N concurrent conditional appends, exactly one wins", async () => {
|
|
191
191
|
let (_n, ops, _s) = makeLog("dcb-hot")
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-postgres",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.203",
|
|
4
4
|
"description": "Postgres storage backend for Reventless (classic + DCB event logs, query DB, change feed). Connection-string only — RDS/Aurora, any managed provider, or a local container.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"pg": "^8.13.1",
|
|
24
24
|
"sury": "11.1.0",
|
|
25
25
|
"@reventlessdev/rescript-effect": "1.0.0-alpha.3",
|
|
26
|
-
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
27
|
-
"@reventlessdev/reventless-core": "3.0.0-alpha.337",
|
|
28
26
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
29
|
-
"@reventlessdev/reventless-
|
|
30
|
-
"@reventlessdev/reventless-
|
|
27
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.339",
|
|
28
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.232",
|
|
29
|
+
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
30
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.201"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/pg": "^8.11.10",
|
|
34
34
|
"rescript": "12.3.1",
|
|
35
35
|
"sury-ppx": "11.1.0",
|
|
36
|
-
"@reventlessdev/reventless-ppx": "1.0.0-alpha.
|
|
36
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.113"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"rescript": "^12.3.1"
|
|
@@ -18,6 +18,10 @@ function makeStorage(pool, name, indexes, partitionTag, crossPartitionTagKeys, o
|
|
|
18
18
|
];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
let lockStrategies = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.lockStrategies;
|
|
22
|
+
|
|
23
|
+
let lockStrategyOfName = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.lockStrategyOfName;
|
|
24
|
+
|
|
21
25
|
let strategyParam = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.strategyParam;
|
|
22
26
|
|
|
23
27
|
let noTracking = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.noTracking;
|
|
@@ -53,6 +57,8 @@ let positionsOfAppend = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.posit
|
|
|
53
57
|
let makeOps = DcbEventLogStorage_Postgres_Ops$ReventlessPostgres.makeOps;
|
|
54
58
|
|
|
55
59
|
export {
|
|
60
|
+
lockStrategies,
|
|
61
|
+
lockStrategyOfName,
|
|
56
62
|
strategyParam,
|
|
57
63
|
noTracking,
|
|
58
64
|
selectColumns,
|
|
@@ -14,11 +14,19 @@ open Reventless
|
|
|
14
14
|
// Lock strategy for concurrent appends (B4). Advisory (default) is safe under
|
|
15
15
|
// PgBouncer transaction mode; RowLocks avoids advisory-lock connection pinning
|
|
16
16
|
// on RDS Proxy at the cost of a companion `dcb_scope` table.
|
|
17
|
-
|
|
17
|
+
// A connection config names it by the case's own name (`"RowLocks"`).
|
|
18
|
+
type lockStrategy = AdvisoryLocks | RowLocks
|
|
19
|
+
|
|
20
|
+
let lockStrategies = [AdvisoryLocks, RowLocks]
|
|
21
|
+
|
|
22
|
+
/** The strategy a connection config names; `None` for a name that names none. */
|
|
23
|
+
let lockStrategyOfName = (name: string): option<lockStrategy> =>
|
|
24
|
+
lockStrategies->Array.find(s => (s :> string) == name)
|
|
25
|
+
|
|
18
26
|
let strategyParam = s =>
|
|
19
27
|
switch s {
|
|
20
|
-
|
|
|
21
|
-
|
|
|
28
|
+
| AdvisoryLocks => "advisory"
|
|
29
|
+
| RowLocks => "rows"
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
// Injected by reventless-local to feed the projection-checkpoint low-watermark
|
|
@@ -255,7 +263,7 @@ let makeOps = (
|
|
|
255
263
|
~partitionTag as _,
|
|
256
264
|
~crossPartitionTagKeys as _=?,
|
|
257
265
|
~opts as _,
|
|
258
|
-
~lockStrategy: lockStrategy
|
|
266
|
+
~lockStrategy: lockStrategy=AdvisoryLocks,
|
|
259
267
|
~onAppended=noTracking,
|
|
260
268
|
): (string, DcbEventLog_Adapter.operations) => {
|
|
261
269
|
// Fenced head cursor: the highest (transaction_id, position) visible under the
|
|
@@ -14,6 +14,15 @@ import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_excep
|
|
|
14
14
|
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
15
15
|
import * as PgDriver$ReventlessPostgres from "./PgDriver.res.mjs";
|
|
16
16
|
|
|
17
|
+
let lockStrategies = [
|
|
18
|
+
"AdvisoryLocks",
|
|
19
|
+
"RowLocks"
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function lockStrategyOfName(name) {
|
|
23
|
+
return lockStrategies.find(s => s === name);
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
function strategyParam(s) {
|
|
18
27
|
if (s === "AdvisoryLocks") {
|
|
19
28
|
return "advisory";
|
|
@@ -416,6 +425,8 @@ function makeOps(pool, name, param, param$1, param$2, param$3, lockStrategyOpt,
|
|
|
416
425
|
let pageSize = 500;
|
|
417
426
|
|
|
418
427
|
export {
|
|
428
|
+
lockStrategies,
|
|
429
|
+
lockStrategyOfName,
|
|
419
430
|
strategyParam,
|
|
420
431
|
noTracking,
|
|
421
432
|
selectColumns,
|
package/src/PgSchema.res
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// event_log / snapshot — classic OCC log (Phase A)
|
|
9
9
|
// dcb_event — DCB log; positions are a global IDENTITY sequence,
|
|
10
10
|
// rows stamped with the committing xid8 (Phase B)
|
|
11
|
-
// dcb_scope — companion table for the
|
|
11
|
+
// dcb_scope — companion table for the RowLocks strategy (B4)
|
|
12
12
|
// dcb_subscription — change-feed checkpoints (Phase D)
|
|
13
13
|
// dcb_condition_where(...) — compiles a DcbTag.query jsonb AST → SQL WHERE
|
|
14
14
|
// dcb_append(...) — the concurrency-critical append (B1): scoped
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// - write-skew: two genuinely concurrent conditional appends on one boundary —
|
|
11
11
|
// exactly one commits, the other conflicts cleanly (the anomaly the advisory
|
|
12
12
|
// locks close)
|
|
13
|
-
// - both
|
|
13
|
+
// - both AdvisoryLocks and RowLocks strategies
|
|
14
14
|
|
|
15
15
|
open JestGlobals
|
|
16
16
|
open ReventlessCore
|
|
@@ -184,8 +184,8 @@ switch processEnv->Dict.get("PG_URL") {
|
|
|
184
184
|
},
|
|
185
185
|
)
|
|
186
186
|
|
|
187
|
-
writeSkew(
|
|
188
|
-
writeSkew(
|
|
187
|
+
writeSkew(AdvisoryLocks, "dcb-skew-advisory")
|
|
188
|
+
writeSkew(RowLocks, "dcb-skew-rows")
|
|
189
189
|
|
|
190
190
|
testPromise("hot tag: N concurrent conditional appends, exactly one wins", async () => {
|
|
191
191
|
let (_n, ops, _s) = makeLog("dcb-hot")
|