Skip to content

Commit 5e3ffd5

Browse files
authored
Merge pull request #1012 from benthecarman/postgres-init-advisory-lock
Lock Postgres stores on initialization
2 parents 8da21bc + 4f762a4 commit 5e3ffd5

2 files changed

Lines changed: 192 additions & 46 deletions

File tree

src/builder.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,14 @@ impl NodeBuilder {
696696
/// The given `kv_table_name` will be used or default to
697697
/// [`DEFAULT_KV_TABLE_NAME`](io::postgres_store::DEFAULT_KV_TABLE_NAME).
698698
///
699+
/// # Warning
700+
///
701+
/// Do not point multiple [`Node`] instances at the same database and table. Concurrent access is
702+
/// unsafe and can corrupt node state. You must make sure that only one node accesses each
703+
/// database and table. The store uses a PostgreSQL advisory lock to reduce this risk. This lock
704+
/// is only a temporary safeguard and does not make concurrent access safe.
705+
/// Nodes using a different database or table on the same server may coexist.
706+
///
699707
/// If `certificate_pem` is `Some`, TLS will be used for database connections and the
700708
/// provided PEM-encoded CA certificate will be added to the system's default root
701709
/// certificates (it does not replace them). If `certificate_pem` is `None`, connections
@@ -1230,6 +1238,14 @@ impl ArcedNodeBuilder {
12301238
/// The given `kv_table_name` will be used or default to
12311239
/// [`DEFAULT_KV_TABLE_NAME`](io::postgres_store::DEFAULT_KV_TABLE_NAME).
12321240
///
1241+
/// # Warning
1242+
///
1243+
/// Do not point multiple [`Node`] instances at the same database and table. Concurrent access is
1244+
/// unsafe and can corrupt node state. You must make sure that only one node accesses each
1245+
/// database and table. The store uses a PostgreSQL advisory lock to reduce this risk. This lock
1246+
/// is only a temporary safeguard and does not make concurrent access safe.
1247+
/// Nodes using a different database or table on the same server may coexist.
1248+
///
12331249
/// If `certificate_pem` is `Some`, TLS will be used for database connections and the
12341250
/// provided PEM-encoded CA certificate will be added to the system's default root
12351251
/// certificates (it does not replace them). If `certificate_pem` is `None`, connections

0 commit comments

Comments
 (0)