@hoshinotatsuya/pg-replica-sync 0.2.2 → 0.3.0

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.
Files changed (215) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/dist/compare-lsn.d.mts +3 -3
  4. package/dist/compare-lsn.d.ts +3 -3
  5. package/dist/compare-lsn.js +3 -3
  6. package/dist/constants/exclusion-reason.constant.d.mts +12 -12
  7. package/dist/constants/exclusion-reason.constant.d.ts +12 -12
  8. package/dist/constants/exclusion-reason.constant.d.ts.map +1 -1
  9. package/dist/constants/exclusion-reason.constant.js +12 -12
  10. package/dist/constants/exclusion-reason.constant.js.map +1 -1
  11. package/dist/constants/node-role.constant.d.mts +1 -1
  12. package/dist/constants/node-role.constant.d.ts +1 -1
  13. package/dist/constants/node-role.constant.d.ts.map +1 -1
  14. package/dist/constants/node-role.constant.js +1 -1
  15. package/dist/constants/node-role.constant.js.map +1 -1
  16. package/dist/constants/probe-sql.constant.d.mts +25 -25
  17. package/dist/constants/probe-sql.constant.d.ts +25 -25
  18. package/dist/constants/probe-sql.constant.js +25 -25
  19. package/dist/constants/replica-sync-defaults.constant.d.mts +26 -26
  20. package/dist/constants/replica-sync-defaults.constant.d.ts +26 -26
  21. package/dist/constants/replica-sync-defaults.constant.d.ts.map +1 -1
  22. package/dist/constants/replica-sync-defaults.constant.js +26 -26
  23. package/dist/constants/replica-sync-defaults.constant.js.map +1 -1
  24. package/dist/constants/route-reason.constant.d.mts +13 -13
  25. package/dist/constants/route-reason.constant.d.ts +13 -13
  26. package/dist/constants/route-reason.constant.d.ts.map +1 -1
  27. package/dist/constants/route-reason.constant.js +13 -13
  28. package/dist/constants/route-reason.constant.js.map +1 -1
  29. package/dist/constants/token-format.constant.d.mts +11 -11
  30. package/dist/constants/token-format.constant.d.ts +11 -11
  31. package/dist/constants/token-format.constant.d.ts.map +1 -1
  32. package/dist/constants/token-format.constant.js +11 -11
  33. package/dist/constants/token-format.constant.js.map +1 -1
  34. package/dist/constants/wal-format.constant.d.mts +6 -6
  35. package/dist/constants/wal-format.constant.d.ts +6 -6
  36. package/dist/constants/wal-format.constant.d.ts.map +1 -1
  37. package/dist/constants/wal-format.constant.js +6 -6
  38. package/dist/constants/wal-format.constant.js.map +1 -1
  39. package/dist/decode-canonical-base64url.d.mts +1 -1
  40. package/dist/decode-canonical-base64url.d.ts +1 -1
  41. package/dist/decode-canonical-base64url.d.ts.map +1 -1
  42. package/dist/decode-canonical-base64url.js +1 -1
  43. package/dist/decode-canonical-base64url.js.map +1 -1
  44. package/dist/deep-freeze.d.mts +7 -7
  45. package/dist/deep-freeze.d.ts +7 -7
  46. package/dist/deep-freeze.js +9 -9
  47. package/dist/deep-freeze.js.map +1 -1
  48. package/dist/destroy-client.d.mts +3 -3
  49. package/dist/destroy-client.d.ts +3 -3
  50. package/dist/destroy-client.js +3 -3
  51. package/dist/evaluate-replica.d.mts +3 -3
  52. package/dist/evaluate-replica.d.ts +3 -3
  53. package/dist/evaluate-replica.js +3 -3
  54. package/dist/format-lsn.d.mts +1 -1
  55. package/dist/format-lsn.d.ts +1 -1
  56. package/dist/format-lsn.d.ts.map +1 -1
  57. package/dist/format-lsn.js +2 -2
  58. package/dist/format-lsn.js.map +1 -1
  59. package/dist/invalid-lsn.error.d.mts +1 -1
  60. package/dist/invalid-lsn.error.d.ts +1 -1
  61. package/dist/invalid-lsn.error.d.ts.map +1 -1
  62. package/dist/invalid-lsn.error.js +2 -2
  63. package/dist/invalid-lsn.error.js.map +1 -1
  64. package/dist/invalid-replica-sync-options.error.d.mts +1 -1
  65. package/dist/invalid-replica-sync-options.error.d.ts +1 -1
  66. package/dist/invalid-replica-sync-options.error.d.ts.map +1 -1
  67. package/dist/invalid-replica-sync-options.error.js +1 -1
  68. package/dist/invalid-replica-sync-options.error.js.map +1 -1
  69. package/dist/lag-bytes.d.mts +3 -3
  70. package/dist/lag-bytes.d.ts +3 -3
  71. package/dist/lag-bytes.js +3 -3
  72. package/dist/lsn-or-null.d.mts +1 -1
  73. package/dist/lsn-or-null.d.ts +1 -1
  74. package/dist/lsn-or-null.d.ts.map +1 -1
  75. package/dist/lsn-or-null.js +1 -1
  76. package/dist/lsn-or-null.js.map +1 -1
  77. package/dist/notify.d.mts +7 -7
  78. package/dist/notify.d.ts +7 -7
  79. package/dist/notify.js +8 -8
  80. package/dist/notify.js.map +1 -1
  81. package/dist/parse-lsn.d.mts +3 -3
  82. package/dist/parse-lsn.d.ts +3 -3
  83. package/dist/parse-lsn.js +3 -3
  84. package/dist/probe-connection-closed.error.d.mts +1 -1
  85. package/dist/probe-connection-closed.error.d.ts +1 -1
  86. package/dist/probe-connection-closed.error.d.ts.map +1 -1
  87. package/dist/probe-connection-closed.error.js +2 -2
  88. package/dist/probe-connection-closed.error.js.map +1 -1
  89. package/dist/probe-connection.d.mts +20 -20
  90. package/dist/probe-connection.d.ts +20 -20
  91. package/dist/probe-connection.d.ts.map +1 -1
  92. package/dist/probe-connection.js +25 -25
  93. package/dist/probe-connection.js.map +1 -1
  94. package/dist/probe-timeout.error.d.mts +1 -1
  95. package/dist/probe-timeout.error.d.ts +1 -1
  96. package/dist/probe-timeout.error.d.ts.map +1 -1
  97. package/dist/probe-timeout.error.js +2 -2
  98. package/dist/probe-timeout.error.js.map +1 -1
  99. package/dist/read-node-state.d.mts +3 -3
  100. package/dist/read-node-state.d.ts +3 -3
  101. package/dist/read-node-state.js +4 -4
  102. package/dist/read-node-state.js.map +1 -1
  103. package/dist/replica-router.d.mts +133 -133
  104. package/dist/replica-router.d.ts +133 -133
  105. package/dist/replica-router.d.ts.map +1 -1
  106. package/dist/replica-router.js +162 -162
  107. package/dist/replica-router.js.map +1 -1
  108. package/dist/require-integer.d.mts +1 -1
  109. package/dist/require-integer.d.ts +1 -1
  110. package/dist/require-integer.d.ts.map +1 -1
  111. package/dist/require-integer.js +3 -3
  112. package/dist/require-integer.js.map +1 -1
  113. package/dist/secret-weakness.d.mts +13 -13
  114. package/dist/secret-weakness.d.ts +13 -13
  115. package/dist/secret-weakness.js +16 -16
  116. package/dist/secret-weakness.js.map +1 -1
  117. package/dist/smallest-period.d.mts +4 -4
  118. package/dist/smallest-period.d.ts +4 -4
  119. package/dist/smallest-period.js +4 -4
  120. package/dist/sql-state-of.d.mts +6 -6
  121. package/dist/sql-state-of.d.ts +6 -6
  122. package/dist/sql-state-of.js +6 -6
  123. package/dist/state-cache.d.mts +14 -14
  124. package/dist/state-cache.d.ts +14 -14
  125. package/dist/state-cache.d.ts.map +1 -1
  126. package/dist/state-cache.js +15 -15
  127. package/dist/state-cache.js.map +1 -1
  128. package/dist/timeline-of.d.mts +2 -2
  129. package/dist/timeline-of.d.ts +2 -2
  130. package/dist/timeline-of.js +2 -2
  131. package/dist/to-error.d.mts +1 -1
  132. package/dist/to-error.d.ts +1 -1
  133. package/dist/to-error.d.ts.map +1 -1
  134. package/dist/to-error.js +1 -1
  135. package/dist/to-error.js.map +1 -1
  136. package/dist/token-codec.d.mts +10 -10
  137. package/dist/token-codec.d.ts +10 -10
  138. package/dist/token-codec.js +31 -31
  139. package/dist/token-codec.js.map +1 -1
  140. package/dist/token-lsn.d.mts +13 -13
  141. package/dist/token-lsn.d.ts +13 -13
  142. package/dist/token-lsn.js +13 -13
  143. package/dist/transaction-not-committed.error.d.mts +2 -2
  144. package/dist/transaction-not-committed.error.d.ts +2 -2
  145. package/dist/transaction-not-committed.error.d.ts.map +1 -1
  146. package/dist/transaction-not-committed.error.js +3 -3
  147. package/dist/transaction-not-committed.error.js.map +1 -1
  148. package/dist/transaction-not-open.error.d.mts +5 -5
  149. package/dist/transaction-not-open.error.d.ts +5 -5
  150. package/dist/transaction-not-open.error.js +6 -6
  151. package/dist/transaction-not-open.error.js.map +1 -1
  152. package/dist/types/cache-entry.type.d.mts +4 -4
  153. package/dist/types/cache-entry.type.d.ts +4 -4
  154. package/dist/types/clock.type.d.mts +3 -3
  155. package/dist/types/clock.type.d.ts +3 -3
  156. package/dist/types/confirm-event.type.d.mts +3 -3
  157. package/dist/types/confirm-event.type.d.ts +3 -3
  158. package/dist/types/decoded-token.type.d.mts +2 -2
  159. package/dist/types/decoded-token.type.d.ts +2 -2
  160. package/dist/types/evaluated.type.d.mts +1 -1
  161. package/dist/types/evaluated.type.d.ts +1 -1
  162. package/dist/types/evaluated.type.d.ts.map +1 -1
  163. package/dist/types/exclusion.type.d.mts +1 -1
  164. package/dist/types/exclusion.type.d.ts +1 -1
  165. package/dist/types/exclusion.type.d.ts.map +1 -1
  166. package/dist/types/node-state.type.d.mts +13 -13
  167. package/dist/types/node-state.type.d.ts +13 -13
  168. package/dist/types/node-state.type.d.ts.map +1 -1
  169. package/dist/types/not-a-pool.type.d.mts +5 -5
  170. package/dist/types/not-a-pool.type.d.ts +5 -5
  171. package/dist/types/probe-event.type.d.mts +1 -1
  172. package/dist/types/probe-event.type.d.ts +1 -1
  173. package/dist/types/probe-event.type.d.ts.map +1 -1
  174. package/dist/types/probe-outcome.type.d.mts +1 -1
  175. package/dist/types/probe-outcome.type.d.ts +1 -1
  176. package/dist/types/probe-outcome.type.d.ts.map +1 -1
  177. package/dist/types/probe-sample.type.d.mts +1 -1
  178. package/dist/types/probe-sample.type.d.ts +1 -1
  179. package/dist/types/probe-sample.type.d.ts.map +1 -1
  180. package/dist/types/replica-node.type.d.mts +7 -7
  181. package/dist/types/replica-node.type.d.ts +7 -7
  182. package/dist/types/replica-requirement.type.d.mts +2 -2
  183. package/dist/types/replica-requirement.type.d.ts +2 -2
  184. package/dist/types/replica-router-options.type.d.mts +25 -25
  185. package/dist/types/replica-router-options.type.d.ts +25 -25
  186. package/dist/types/replica-router-options.type.d.ts.map +1 -1
  187. package/dist/types/route-decision.type.d.mts +5 -5
  188. package/dist/types/route-decision.type.d.ts +5 -5
  189. package/dist/types/route-decision.type.d.ts.map +1 -1
  190. package/dist/types/router-observer.type.d.mts +5 -5
  191. package/dist/types/router-observer.type.d.ts +5 -5
  192. package/dist/types/router-observer.type.d.ts.map +1 -1
  193. package/dist/types/router-stats.type.d.mts +8 -8
  194. package/dist/types/router-stats.type.d.ts +8 -8
  195. package/dist/types/router-stats.type.d.ts.map +1 -1
  196. package/dist/types/sql-command-executor.type.d.mts +4 -4
  197. package/dist/types/sql-command-executor.type.d.ts +4 -4
  198. package/dist/types/sql-query-executor.type.d.mts +3 -3
  199. package/dist/types/sql-query-executor.type.d.ts +3 -3
  200. package/dist/types/wal-layout.type.d.mts +1 -1
  201. package/dist/types/wal-layout.type.d.ts +1 -1
  202. package/dist/types/wal-layout.type.d.ts.map +1 -1
  203. package/dist/types/wal-position.type.d.mts +5 -5
  204. package/dist/types/wal-position.type.d.ts +5 -5
  205. package/dist/types/wal-position.type.d.ts.map +1 -1
  206. package/dist/value-text.d.mts +5 -5
  207. package/dist/value-text.d.ts +5 -5
  208. package/dist/value-text.js +6 -6
  209. package/dist/value-text.js.map +1 -1
  210. package/dist/wal-layout-of.d.mts +1 -1
  211. package/dist/wal-layout-of.d.ts +1 -1
  212. package/dist/wal-layout-of.d.ts.map +1 -1
  213. package/dist/wal-layout-of.js +1 -1
  214. package/dist/wal-layout-of.js.map +1 -1
  215. package/package.json +11 -9
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to this package are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package uses
5
5
  [Semantic Versioning](https://semver.org/) (before 1.0 a breaking change bumps the minor version).
6
6
 
7
+ ## 0.3.0 — 2026-11-29
8
+
9
+ - **Breaking for anyone matching message text:** all error messages (`InvalidReplicaSyncOptionsError`,
10
+ `ProbeTimeoutError`, `TransactionNotOpenError`, `TransactionNotCommittedError`, `InvalidLsnError` and
11
+ the router's own errors), the `detail` of an `invalid` decoded token, log lines of the scripts, code
12
+ comments and test names are now in English. Error classes, `ROUTE_REASON` and `EXCLUSION_REASON`
13
+ values are unchanged — match on them instead of text.
14
+
7
15
  ## 0.2.2 — 2026-11-21
8
16
 
9
17
  First public release as `@hoshinotatsuya/pg-replica-sync`, MIT; documentation in English and Russian; no
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm](https://img.shields.io/npm/v/@hoshinotatsuya/pg-replica-sync.svg)](https://www.npmjs.com/package/@hoshinotatsuya/pg-replica-sync)
4
4
  [![CI](https://github.com/HoshinoTatsuya/pg-replica-sync/actions/workflows/ci.yml/badge.svg)](https://github.com/HoshinoTatsuya/pg-replica-sync/actions/workflows/ci.yml)
5
5
 
6
- [Русская версия](README.ru.md) · [Changelog](CHANGELOG.md)
6
+ [Russian version](README.ru.md) · [Changelog](CHANGELOG.md)
7
7
 
8
8
  Reads from PostgreSQL replicas with a **read-your-writes** guarantee, by WAL position. After a write the client
9
9
  gets a signed position token. A read carrying the token goes to a replica only when it is **proven** that the
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Сравнение позиций WAL как 64-битных чисел: -1, 0 или 1. Принимает текст
3
- * `X/Y` (разбирается строго) или уже разобранную позицию. Единственная точка
4
- * сравнения позиций в пакете.
2
+ * Comparison of WAL positions as 64-bit numbers: -1, 0 or 1. Accepts the text
3
+ * `X/Y` (parsed strictly) or an already parsed position. The single point of
4
+ * position comparison in the package.
5
5
  */
6
6
  export declare function compareLsn(left: string | bigint, right: string | bigint): -1 | 0 | 1;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Сравнение позиций WAL как 64-битных чисел: -1, 0 или 1. Принимает текст
3
- * `X/Y` (разбирается строго) или уже разобранную позицию. Единственная точка
4
- * сравнения позиций в пакете.
2
+ * Comparison of WAL positions as 64-bit numbers: -1, 0 or 1. Accepts the text
3
+ * `X/Y` (parsed strictly) or an already parsed position. The single point of
4
+ * position comparison in the package.
5
5
  */
6
6
  export declare function compareLsn(left: string | bigint, right: string | bigint): -1 | 0 | 1;
7
7
  //# sourceMappingURL=compare-lsn.d.ts.map
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.compareLsn = compareLsn;
4
4
  const parse_lsn_1 = require("./parse-lsn");
5
5
  /**
6
- * Сравнение позиций WAL как 64-битных чисел: -1, 0 или 1. Принимает текст
7
- * `X/Y` (разбирается строго) или уже разобранную позицию. Единственная точка
8
- * сравнения позиций в пакете.
6
+ * Comparison of WAL positions as 64-bit numbers: -1, 0 or 1. Accepts the text
7
+ * `X/Y` (parsed strictly) or an already parsed position. The single point of
8
+ * position comparison in the package.
9
9
  */
10
10
  function compareLsn(left, right) {
11
11
  const a = typeof left === 'bigint' ? left : (0, parse_lsn_1.parseLsn)(left);
@@ -1,26 +1,26 @@
1
1
  /**
2
- * Почему реплика не подошла для этого чтения. Любое «не смогли определить»
3
- * — отдельное значение и исключение, а не «подошла».
2
+ * Why a replica did not fit this read. Every "could not determine"
3
+ * is a separate value and an exclusion, not "fits".
4
4
  */
5
5
  export declare const EXCLUSION_REASON: {
6
- /** Зонд не ответил: отказ соединения, ошибка или потолок времени. */
6
+ /** The probe did not answer: a connection refusal, an error or the time ceiling. */
7
7
  readonly unavailable: "unavailable";
8
- /** `pg_is_in_recovery() = false`: узел стал мастером. */
8
+ /** `pg_is_in_recovery() = false`: the node became the primary. */
9
9
  readonly promoted: "promoted";
10
- /** Воспроизведение WAL на паузе (`pg_wal_replay_pause`). */
10
+ /** WAL replay is paused (`pg_wal_replay_pause`). */
11
11
  readonly paused: "paused";
12
- /** Роль зонда не видит `pg_stat_wal_receiver` (нужен pg_read_all_stats / pg_monitor). */
12
+ /** The probe role does not see `pg_stat_wal_receiver` (pg_read_all_stats / pg_monitor is needed). */
13
13
  readonly noStatsPrivilege: "no-stats-privilege";
14
- /** Линию времени определить не смогли (приёмник WAL не работает). */
14
+ /** The timeline could not be determined (the WAL receiver does not work). */
15
15
  readonly timelineUnknown: "timeline-unknown";
16
- /** Линия времени реплики не та, что у токена (или у мастера). */
16
+ /** The replica timeline is not the one of the token (or of the primary). */
17
17
  readonly timelineMismatch: "timeline-mismatch";
18
- /** Реплика из другого кластера (system identifier). */
18
+ /** A replica from another cluster (system identifier). */
19
19
  readonly otherCluster: "other-cluster";
20
- /** Состояние пришло, но не разбирается (позиция WAL пуста или не в форме `X/Y`). */
20
+ /** The state came but does not parse (the WAL position is empty or not in the `X/Y` form). */
21
21
  readonly stateUnknown: "state-unknown";
22
- /** Позиция воспроизведения меньше позиции токена. */
22
+ /** The replay position is smaller than the token position. */
23
23
  readonly behind: "behind";
24
- /** Без токена: отставание больше потолка. */
24
+ /** Without a token: the lag is above the ceiling. */
25
25
  readonly lagExceeded: "lag-exceeded";
26
26
  };
@@ -1,27 +1,27 @@
1
1
  /**
2
- * Почему реплика не подошла для этого чтения. Любое «не смогли определить»
3
- * — отдельное значение и исключение, а не «подошла».
2
+ * Why a replica did not fit this read. Every "could not determine"
3
+ * is a separate value and an exclusion, not "fits".
4
4
  */
5
5
  export declare const EXCLUSION_REASON: {
6
- /** Зонд не ответил: отказ соединения, ошибка или потолок времени. */
6
+ /** The probe did not answer: a connection refusal, an error or the time ceiling. */
7
7
  readonly unavailable: "unavailable";
8
- /** `pg_is_in_recovery() = false`: узел стал мастером. */
8
+ /** `pg_is_in_recovery() = false`: the node became the primary. */
9
9
  readonly promoted: "promoted";
10
- /** Воспроизведение WAL на паузе (`pg_wal_replay_pause`). */
10
+ /** WAL replay is paused (`pg_wal_replay_pause`). */
11
11
  readonly paused: "paused";
12
- /** Роль зонда не видит `pg_stat_wal_receiver` (нужен pg_read_all_stats / pg_monitor). */
12
+ /** The probe role does not see `pg_stat_wal_receiver` (pg_read_all_stats / pg_monitor is needed). */
13
13
  readonly noStatsPrivilege: "no-stats-privilege";
14
- /** Линию времени определить не смогли (приёмник WAL не работает). */
14
+ /** The timeline could not be determined (the WAL receiver does not work). */
15
15
  readonly timelineUnknown: "timeline-unknown";
16
- /** Линия времени реплики не та, что у токена (или у мастера). */
16
+ /** The replica timeline is not the one of the token (or of the primary). */
17
17
  readonly timelineMismatch: "timeline-mismatch";
18
- /** Реплика из другого кластера (system identifier). */
18
+ /** A replica from another cluster (system identifier). */
19
19
  readonly otherCluster: "other-cluster";
20
- /** Состояние пришло, но не разбирается (позиция WAL пуста или не в форме `X/Y`). */
20
+ /** The state came but does not parse (the WAL position is empty or not in the `X/Y` form). */
21
21
  readonly stateUnknown: "state-unknown";
22
- /** Позиция воспроизведения меньше позиции токена. */
22
+ /** The replay position is smaller than the token position. */
23
23
  readonly behind: "behind";
24
- /** Без токена: отставание больше потолка. */
24
+ /** Without a token: the lag is above the ceiling. */
25
25
  readonly lagExceeded: "lag-exceeded";
26
26
  };
27
27
  //# sourceMappingURL=exclusion-reason.constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exclusion-reason.constant.d.ts","sourceRoot":"","sources":["../../src/constants/exclusion-reason.constant.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,qEAAqE;;IAErE,yDAAyD;;IAEzD,4DAA4D;;IAE5D,yFAAyF;;IAEzF,qEAAqE;;IAErE,iEAAiE;;IAEjE,uDAAuD;;IAEvD,oFAAoF;;IAEpF,qDAAqD;;IAErD,6CAA6C;;CAErC,CAAC"}
1
+ {"version":3,"file":"exclusion-reason.constant.d.ts","sourceRoot":"","sources":["../../src/constants/exclusion-reason.constant.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,oFAAoF;;IAEpF,kEAAkE;;IAElE,oDAAoD;;IAEpD,qGAAqG;;IAErG,6EAA6E;;IAE7E,4EAA4E;;IAE5E,0DAA0D;;IAE1D,8FAA8F;;IAE9F,8DAA8D;;IAE9D,qDAAqD;;CAE7C,CAAC"}
@@ -3,29 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EXCLUSION_REASON = void 0;
4
4
  const deep_freeze_1 = require("../deep-freeze");
5
5
  /**
6
- * Почему реплика не подошла для этого чтения. Любое «не смогли определить»
7
- * — отдельное значение и исключение, а не «подошла».
6
+ * Why a replica did not fit this read. Every "could not determine"
7
+ * is a separate value and an exclusion, not "fits".
8
8
  */
9
9
  exports.EXCLUSION_REASON = {
10
- /** Зонд не ответил: отказ соединения, ошибка или потолок времени. */
10
+ /** The probe did not answer: a connection refusal, an error or the time ceiling. */
11
11
  unavailable: 'unavailable',
12
- /** `pg_is_in_recovery() = false`: узел стал мастером. */
12
+ /** `pg_is_in_recovery() = false`: the node became the primary. */
13
13
  promoted: 'promoted',
14
- /** Воспроизведение WAL на паузе (`pg_wal_replay_pause`). */
14
+ /** WAL replay is paused (`pg_wal_replay_pause`). */
15
15
  paused: 'paused',
16
- /** Роль зонда не видит `pg_stat_wal_receiver` (нужен pg_read_all_stats / pg_monitor). */
16
+ /** The probe role does not see `pg_stat_wal_receiver` (pg_read_all_stats / pg_monitor is needed). */
17
17
  noStatsPrivilege: 'no-stats-privilege',
18
- /** Линию времени определить не смогли (приёмник WAL не работает). */
18
+ /** The timeline could not be determined (the WAL receiver does not work). */
19
19
  timelineUnknown: 'timeline-unknown',
20
- /** Линия времени реплики не та, что у токена (или у мастера). */
20
+ /** The replica timeline is not the one of the token (or of the primary). */
21
21
  timelineMismatch: 'timeline-mismatch',
22
- /** Реплика из другого кластера (system identifier). */
22
+ /** A replica from another cluster (system identifier). */
23
23
  otherCluster: 'other-cluster',
24
- /** Состояние пришло, но не разбирается (позиция WAL пуста или не в форме `X/Y`). */
24
+ /** The state came but does not parse (the WAL position is empty or not in the `X/Y` form). */
25
25
  stateUnknown: 'state-unknown',
26
- /** Позиция воспроизведения меньше позиции токена. */
26
+ /** The replay position is smaller than the token position. */
27
27
  behind: 'behind',
28
- /** Без токена: отставание больше потолка. */
28
+ /** Without a token: the lag is above the ceiling. */
29
29
  lagExceeded: 'lag-exceeded',
30
30
  };
31
31
  (0, deep_freeze_1.deepFreeze)(exports.EXCLUSION_REASON);
@@ -1 +1 @@
1
- {"version":3,"file":"exclusion-reason.constant.js","sourceRoot":"","sources":["../../src/constants/exclusion-reason.constant.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C;;;GAGG;AACU,QAAA,gBAAgB,GAAG;IAC9B,qEAAqE;IACrE,WAAW,EAAE,aAAa;IAC1B,yDAAyD;IACzD,QAAQ,EAAE,UAAU;IACpB,4DAA4D;IAC5D,MAAM,EAAE,QAAQ;IAChB,yFAAyF;IACzF,gBAAgB,EAAE,oBAAoB;IACtC,qEAAqE;IACrE,eAAe,EAAE,kBAAkB;IACnC,iEAAiE;IACjE,gBAAgB,EAAE,mBAAmB;IACrC,uDAAuD;IACvD,YAAY,EAAE,eAAe;IAC7B,oFAAoF;IACpF,YAAY,EAAE,eAAe;IAC7B,qDAAqD;IACrD,MAAM,EAAE,QAAQ;IAChB,6CAA6C;IAC7C,WAAW,EAAE,cAAc;CACnB,CAAC;AACX,IAAA,wBAAU,EAAC,wBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"exclusion-reason.constant.js","sourceRoot":"","sources":["../../src/constants/exclusion-reason.constant.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C;;;GAGG;AACU,QAAA,gBAAgB,GAAG;IAC9B,oFAAoF;IACpF,WAAW,EAAE,aAAa;IAC1B,kEAAkE;IAClE,QAAQ,EAAE,UAAU;IACpB,oDAAoD;IACpD,MAAM,EAAE,QAAQ;IAChB,qGAAqG;IACrG,gBAAgB,EAAE,oBAAoB;IACtC,6EAA6E;IAC7E,eAAe,EAAE,kBAAkB;IACnC,4EAA4E;IAC5E,gBAAgB,EAAE,mBAAmB;IACrC,0DAA0D;IAC1D,YAAY,EAAE,eAAe;IAC7B,8FAA8F;IAC9F,YAAY,EAAE,eAAe;IAC7B,8DAA8D;IAC9D,MAAM,EAAE,QAAQ;IAChB,qDAAqD;IACrD,WAAW,EAAE,cAAc;CACnB,CAAC;AACX,IAAA,wBAAU,EAAC,wBAAgB,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- /** Роль узла, на который ушло чтение. */
1
+ /** The role of the node the read went to. */
2
2
  export declare const NODE_ROLE: {
3
3
  readonly primary: "primary";
4
4
  readonly replica: "replica";
@@ -1,4 +1,4 @@
1
- /** Роль узла, на который ушло чтение. */
1
+ /** The role of the node the read went to. */
2
2
  export declare const NODE_ROLE: {
3
3
  readonly primary: "primary";
4
4
  readonly replica: "replica";
@@ -1 +1 @@
1
- {"version":3,"file":"node-role.constant.d.ts","sourceRoot":"","sources":["../../src/constants/node-role.constant.ts"],"names":[],"mappings":"AAEA,yCAAyC;AACzC,eAAO,MAAM,SAAS;;;CAGZ,CAAC"}
1
+ {"version":3,"file":"node-role.constant.d.ts","sourceRoot":"","sources":["../../src/constants/node-role.constant.ts"],"names":[],"mappings":"AAEA,6CAA6C;AAC7C,eAAO,MAAM,SAAS;;;CAGZ,CAAC"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NODE_ROLE = void 0;
4
4
  const deep_freeze_1 = require("../deep-freeze");
5
- /** Роль узла, на который ушло чтение. */
5
+ /** The role of the node the read went to. */
6
6
  exports.NODE_ROLE = {
7
7
  primary: 'primary',
8
8
  replica: 'replica',
@@ -1 +1 @@
1
- {"version":3,"file":"node-role.constant.js","sourceRoot":"","sources":["../../src/constants/node-role.constant.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C,yCAAyC;AAC5B,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AACX,IAAA,wBAAU,EAAC,iBAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"node-role.constant.js","sourceRoot":"","sources":["../../src/constants/node-role.constant.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C,6CAA6C;AAChC,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AACX,IAAA,wBAAU,EAAC,iBAAS,CAAC,CAAC"}
@@ -1,30 +1,30 @@
1
1
  /**
2
- * Зонд состояния узла — один запрос, одинаковый для мастера и реплики.
3
- * Функции, падающие «не в том» режиме (`pg_get_wal_replay_pause_state` вне
4
- * recovery, `pg_walfile_name` в recovery), — под CASE: Postgres вычисляет
5
- * ветку только при выполнении условия (проверено на 17).
2
+ * The node state probe is one query, the same for the primary and a replica.
3
+ * Functions that fail in the "wrong" mode (`pg_get_wal_replay_pause_state` outside
4
+ * recovery, `pg_walfile_name` in recovery) are under CASE: Postgres evaluates
5
+ * a branch only when its condition holds (checked on 17).
6
6
  *
7
- * - Линия времени мастера — из имени WAL-файла текущей позиции вставки:
8
- * `pg_control_checkpoint().timeline_id` после промоции остаётся старым до
9
- * ближайшей контрольной точки (замер: промоция → 2 по WAL, 1 по checkpoint).
10
- * - Линия времени реплики — `pg_stat_wal_receiver.received_tli`; без
11
- * pg_read_all_stats колонка пуста (замер под ролью без прав), поэтому право
12
- * запрашивается тем же запросом: «нет прав» и «приёмник стоит» — разные причины.
13
- * - Позиция мастера — `pg_current_wal_insert_lsn()`, а не `pg_current_wal_lsn()`:
14
- * при `synchronous_commit = off` запись коммита может быть ещё не записана,
15
- * и позиция записи окажется МЕНЬШЕ конца коммита. Позиция вставки — нет.
16
- * - `write_pending` — у соединения есть номер незавершённой транзакции: токен,
17
- * выданный до COMMIT, был бы меньше позиции коммита, и реплика «догнала бы»
18
- * его без этой записи. Такой токен не выдаётся.
19
- * - `started_at` — момент старта postmaster в секундах эпохи (не `::text`
20
- * метки времени: её вид зависит от DateStyle и TimeZone сессии, и одно и то
21
- * же соединение чтения и зонда давали бы разные экземпляры): вместе с
22
- * `system_identifier` это экземпляр сервера. После перезапуска реплики позиция воспроизведения
23
- * откатывается к minRecoveryPoint (замер: на 69–94 МБ), и всё, что снято до
24
- * перезапуска, к ней больше не относится.
25
- * - `wal_layout` — выравнивание, размер страницы и сегмента WAL мастера
26
- * (`pg_control_init()`): по ним позиция вставки сразу за заголовком страницы
27
- * сводится к границе страницы (`tokenLsn`).
7
+ * - The primary timeline comes from the WAL file name of the current insert position:
8
+ * `pg_control_checkpoint().timeline_id` after a promotion stays old until
9
+ * the next checkpoint (measured: promotion → 2 by WAL, 1 by checkpoint).
10
+ * - The replica timeline is `pg_stat_wal_receiver.received_tli`; without
11
+ * pg_read_all_stats the column is empty (measured under a role without privileges), so the privilege
12
+ * is requested by the same query: "no privileges" and "the receiver is stopped" are different reasons.
13
+ * - The primary position is `pg_current_wal_insert_lsn()`, not `pg_current_wal_lsn()`:
14
+ * with `synchronous_commit = off` the commit record may not be written yet,
15
+ * and the write position would be SMALLER than the end of the commit. The insert position is not.
16
+ * - `write_pending`: the connection has the number of an unfinished transaction: a token
17
+ * issued before COMMIT would be smaller than the commit position, and a replica would "catch up with"
18
+ * it without this write. Such a token is not issued.
19
+ * - `started_at` is the postmaster start moment in epoch seconds (not the `::text`
20
+ * of a timestamp: its form depends on the DateStyle and TimeZone of the session, and one and the
21
+ * same read and probe connection would give different instances): together with
22
+ * `system_identifier` this is the server instance. After a replica restart the replay position
23
+ * rolls back to minRecoveryPoint (measured: by 69–94 MB), and everything taken before
24
+ * the restart no longer applies to it.
25
+ * - `wal_layout` is the alignment, the page size and the WAL segment size of the primary
26
+ * (`pg_control_init()`): by them an insert position right after a page header
27
+ * is reduced to the page boundary (`tokenLsn`).
28
28
  */
29
29
  export declare const PROBE_SQL: {
30
30
  readonly STATE: "SELECT pg_is_in_recovery() AS in_recovery,\n (SELECT system_identifier::text FROM pg_control_system()) AS system_id,\n extract(epoch FROM pg_postmaster_start_time())::text AS started_at,\n CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn()::text END AS replay_lsn,\n CASE WHEN pg_is_in_recovery() THEN pg_get_wal_replay_pause_state() END AS pause_state,\n CASE WHEN pg_is_in_recovery() THEN (SELECT received_tli FROM pg_stat_wal_receiver LIMIT 1) END AS received_tli,\n pg_has_role(current_user, 'pg_read_all_stats', 'USAGE') AS has_stats,\n CASE WHEN NOT pg_is_in_recovery() THEN pg_current_wal_insert_lsn()::text END AS insert_lsn,\n CASE WHEN NOT pg_is_in_recovery() THEN pg_walfile_name(pg_current_wal_insert_lsn()) END AS wal_file,\n CASE WHEN NOT pg_is_in_recovery() THEN pg_current_xact_id_if_assigned() IS NOT NULL END AS write_pending,\n CASE WHEN NOT pg_is_in_recovery() THEN (SELECT ARRAY[max_data_alignment, wal_block_size, bytes_per_wal_segment] FROM pg_control_init()) END AS wal_layout";
@@ -1,30 +1,30 @@
1
1
  /**
2
- * Зонд состояния узла — один запрос, одинаковый для мастера и реплики.
3
- * Функции, падающие «не в том» режиме (`pg_get_wal_replay_pause_state` вне
4
- * recovery, `pg_walfile_name` в recovery), — под CASE: Postgres вычисляет
5
- * ветку только при выполнении условия (проверено на 17).
2
+ * The node state probe is one query, the same for the primary and a replica.
3
+ * Functions that fail in the "wrong" mode (`pg_get_wal_replay_pause_state` outside
4
+ * recovery, `pg_walfile_name` in recovery) are under CASE: Postgres evaluates
5
+ * a branch only when its condition holds (checked on 17).
6
6
  *
7
- * - Линия времени мастера — из имени WAL-файла текущей позиции вставки:
8
- * `pg_control_checkpoint().timeline_id` после промоции остаётся старым до
9
- * ближайшей контрольной точки (замер: промоция → 2 по WAL, 1 по checkpoint).
10
- * - Линия времени реплики — `pg_stat_wal_receiver.received_tli`; без
11
- * pg_read_all_stats колонка пуста (замер под ролью без прав), поэтому право
12
- * запрашивается тем же запросом: «нет прав» и «приёмник стоит» — разные причины.
13
- * - Позиция мастера — `pg_current_wal_insert_lsn()`, а не `pg_current_wal_lsn()`:
14
- * при `synchronous_commit = off` запись коммита может быть ещё не записана,
15
- * и позиция записи окажется МЕНЬШЕ конца коммита. Позиция вставки — нет.
16
- * - `write_pending` — у соединения есть номер незавершённой транзакции: токен,
17
- * выданный до COMMIT, был бы меньше позиции коммита, и реплика «догнала бы»
18
- * его без этой записи. Такой токен не выдаётся.
19
- * - `started_at` — момент старта postmaster в секундах эпохи (не `::text`
20
- * метки времени: её вид зависит от DateStyle и TimeZone сессии, и одно и то
21
- * же соединение чтения и зонда давали бы разные экземпляры): вместе с
22
- * `system_identifier` это экземпляр сервера. После перезапуска реплики позиция воспроизведения
23
- * откатывается к minRecoveryPoint (замер: на 69–94 МБ), и всё, что снято до
24
- * перезапуска, к ней больше не относится.
25
- * - `wal_layout` — выравнивание, размер страницы и сегмента WAL мастера
26
- * (`pg_control_init()`): по ним позиция вставки сразу за заголовком страницы
27
- * сводится к границе страницы (`tokenLsn`).
7
+ * - The primary timeline comes from the WAL file name of the current insert position:
8
+ * `pg_control_checkpoint().timeline_id` after a promotion stays old until
9
+ * the next checkpoint (measured: promotion → 2 by WAL, 1 by checkpoint).
10
+ * - The replica timeline is `pg_stat_wal_receiver.received_tli`; without
11
+ * pg_read_all_stats the column is empty (measured under a role without privileges), so the privilege
12
+ * is requested by the same query: "no privileges" and "the receiver is stopped" are different reasons.
13
+ * - The primary position is `pg_current_wal_insert_lsn()`, not `pg_current_wal_lsn()`:
14
+ * with `synchronous_commit = off` the commit record may not be written yet,
15
+ * and the write position would be SMALLER than the end of the commit. The insert position is not.
16
+ * - `write_pending`: the connection has the number of an unfinished transaction: a token
17
+ * issued before COMMIT would be smaller than the commit position, and a replica would "catch up with"
18
+ * it without this write. Such a token is not issued.
19
+ * - `started_at` is the postmaster start moment in epoch seconds (not the `::text`
20
+ * of a timestamp: its form depends on the DateStyle and TimeZone of the session, and one and the
21
+ * same read and probe connection would give different instances): together with
22
+ * `system_identifier` this is the server instance. After a replica restart the replay position
23
+ * rolls back to minRecoveryPoint (measured: by 69–94 MB), and everything taken before
24
+ * the restart no longer applies to it.
25
+ * - `wal_layout` is the alignment, the page size and the WAL segment size of the primary
26
+ * (`pg_control_init()`): by them an insert position right after a page header
27
+ * is reduced to the page boundary (`tokenLsn`).
28
28
  */
29
29
  export declare const PROBE_SQL: {
30
30
  readonly STATE: "SELECT pg_is_in_recovery() AS in_recovery,\n (SELECT system_identifier::text FROM pg_control_system()) AS system_id,\n extract(epoch FROM pg_postmaster_start_time())::text AS started_at,\n CASE WHEN pg_is_in_recovery() THEN pg_last_wal_replay_lsn()::text END AS replay_lsn,\n CASE WHEN pg_is_in_recovery() THEN pg_get_wal_replay_pause_state() END AS pause_state,\n CASE WHEN pg_is_in_recovery() THEN (SELECT received_tli FROM pg_stat_wal_receiver LIMIT 1) END AS received_tli,\n pg_has_role(current_user, 'pg_read_all_stats', 'USAGE') AS has_stats,\n CASE WHEN NOT pg_is_in_recovery() THEN pg_current_wal_insert_lsn()::text END AS insert_lsn,\n CASE WHEN NOT pg_is_in_recovery() THEN pg_walfile_name(pg_current_wal_insert_lsn()) END AS wal_file,\n CASE WHEN NOT pg_is_in_recovery() THEN pg_current_xact_id_if_assigned() IS NOT NULL END AS write_pending,\n CASE WHEN NOT pg_is_in_recovery() THEN (SELECT ARRAY[max_data_alignment, wal_block_size, bytes_per_wal_segment] FROM pg_control_init()) END AS wal_layout";
@@ -3,32 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROBE_SQL = void 0;
4
4
  const deep_freeze_1 = require("../deep-freeze");
5
5
  /**
6
- * Зонд состояния узла — один запрос, одинаковый для мастера и реплики.
7
- * Функции, падающие «не в том» режиме (`pg_get_wal_replay_pause_state` вне
8
- * recovery, `pg_walfile_name` в recovery), — под CASE: Postgres вычисляет
9
- * ветку только при выполнении условия (проверено на 17).
6
+ * The node state probe is one query, the same for the primary and a replica.
7
+ * Functions that fail in the "wrong" mode (`pg_get_wal_replay_pause_state` outside
8
+ * recovery, `pg_walfile_name` in recovery) are under CASE: Postgres evaluates
9
+ * a branch only when its condition holds (checked on 17).
10
10
  *
11
- * - Линия времени мастера — из имени WAL-файла текущей позиции вставки:
12
- * `pg_control_checkpoint().timeline_id` после промоции остаётся старым до
13
- * ближайшей контрольной точки (замер: промоция → 2 по WAL, 1 по checkpoint).
14
- * - Линия времени реплики — `pg_stat_wal_receiver.received_tli`; без
15
- * pg_read_all_stats колонка пуста (замер под ролью без прав), поэтому право
16
- * запрашивается тем же запросом: «нет прав» и «приёмник стоит» — разные причины.
17
- * - Позиция мастера — `pg_current_wal_insert_lsn()`, а не `pg_current_wal_lsn()`:
18
- * при `synchronous_commit = off` запись коммита может быть ещё не записана,
19
- * и позиция записи окажется МЕНЬШЕ конца коммита. Позиция вставки — нет.
20
- * - `write_pending` — у соединения есть номер незавершённой транзакции: токен,
21
- * выданный до COMMIT, был бы меньше позиции коммита, и реплика «догнала бы»
22
- * его без этой записи. Такой токен не выдаётся.
23
- * - `started_at` — момент старта postmaster в секундах эпохи (не `::text`
24
- * метки времени: её вид зависит от DateStyle и TimeZone сессии, и одно и то
25
- * же соединение чтения и зонда давали бы разные экземпляры): вместе с
26
- * `system_identifier` это экземпляр сервера. После перезапуска реплики позиция воспроизведения
27
- * откатывается к minRecoveryPoint (замер: на 69–94 МБ), и всё, что снято до
28
- * перезапуска, к ней больше не относится.
29
- * - `wal_layout` — выравнивание, размер страницы и сегмента WAL мастера
30
- * (`pg_control_init()`): по ним позиция вставки сразу за заголовком страницы
31
- * сводится к границе страницы (`tokenLsn`).
11
+ * - The primary timeline comes from the WAL file name of the current insert position:
12
+ * `pg_control_checkpoint().timeline_id` after a promotion stays old until
13
+ * the next checkpoint (measured: promotion → 2 by WAL, 1 by checkpoint).
14
+ * - The replica timeline is `pg_stat_wal_receiver.received_tli`; without
15
+ * pg_read_all_stats the column is empty (measured under a role without privileges), so the privilege
16
+ * is requested by the same query: "no privileges" and "the receiver is stopped" are different reasons.
17
+ * - The primary position is `pg_current_wal_insert_lsn()`, not `pg_current_wal_lsn()`:
18
+ * with `synchronous_commit = off` the commit record may not be written yet,
19
+ * and the write position would be SMALLER than the end of the commit. The insert position is not.
20
+ * - `write_pending`: the connection has the number of an unfinished transaction: a token
21
+ * issued before COMMIT would be smaller than the commit position, and a replica would "catch up with"
22
+ * it without this write. Such a token is not issued.
23
+ * - `started_at` is the postmaster start moment in epoch seconds (not the `::text`
24
+ * of a timestamp: its form depends on the DateStyle and TimeZone of the session, and one and the
25
+ * same read and probe connection would give different instances): together with
26
+ * `system_identifier` this is the server instance. After a replica restart the replay position
27
+ * rolls back to minRecoveryPoint (measured: by 69–94 MB), and everything taken before
28
+ * the restart no longer applies to it.
29
+ * - `wal_layout` is the alignment, the page size and the WAL segment size of the primary
30
+ * (`pg_control_init()`): by them an insert position right after a page header
31
+ * is reduced to the page boundary (`tokenLsn`).
32
32
  */
33
33
  exports.PROBE_SQL = {
34
34
  STATE: `SELECT pg_is_in_recovery() AS in_recovery,
@@ -1,51 +1,51 @@
1
- /** Умолчания маршрутизатора; каждое переопределяется опцией с тем же смыслом. */
1
+ /** The router defaults; each one is overridden by an option with the same meaning. */
2
2
  export declare const REPLICA_SYNC_DEFAULTS: {
3
- /** Сколько живёт состояние узла в кэше, мс. */
3
+ /** How long a node state lives in the cache, ms. */
4
4
  readonly STATE_TTL_MS: 250;
5
5
  /**
6
- * Потолок `stateTtlMs`, мс: окно, в котором перезапуск реплики (позиция
7
- * воспроизведения после него МЕНЬШЕ — откат к minRecoveryPoint) может остаться
8
- * незамеченным, если потеря соединения зонда не дошла до клиента.
6
+ * The ceiling of `stateTtlMs`, ms: the window in which a replica restart (the replay
7
+ * position after it is SMALLER — a rollback to minRecoveryPoint) may stay
8
+ * unnoticed if the loss of the probe connection did not reach the client.
9
9
  */
10
10
  readonly MAX_STATE_TTL_MS: 1000;
11
- /** Потолок одного зонда (установка соединения + запрос), мс. */
11
+ /** The ceiling of one probe (connection establishment + query), ms. */
12
12
  readonly PROBE_TIMEOUT_MS: 1000;
13
13
  /**
14
- * Потолок жизни соединения зонда, которое не установилось или запрос на котором
15
- * не ответил, мс (с начала установки или запроса). Зонд, не уложившийся в
16
- * `PROBE_TIMEOUT_MS`, — отказ этого зонда, но соединение не рвётся до этого
17
- * потолка: медленная, но живая реплика (установка дольше потолка зонда) получает
18
- * готовое соединение к следующему зонду, а замёрзшая остаётся недоступной.
14
+ * The lifetime ceiling of a probe connection that did not get established or on which a query
15
+ * did not answer, ms (from the start of the establishment or the query). A probe that did not fit into
16
+ * `PROBE_TIMEOUT_MS` is a refusal of this probe, but the connection is not torn until this
17
+ * ceiling: a slow but alive replica (establishment longer than the probe ceiling) gets
18
+ * a ready connection for the next probe, and a frozen one stays unavailable.
19
19
  */
20
20
  readonly CONNECT_TIMEOUT_MS: 10000;
21
- /** Сколько узел, не ответивший зонду, не опрашивается снова, мс. */
21
+ /** How long a node that did not answer a probe is not polled again, ms. */
22
22
  readonly UNAVAILABLE_RETRY_MS: 2000;
23
- /** Без токена: потолок отставания реплики от мастера, байт WAL. */
23
+ /** Without a token: the ceiling of a replica lag behind the primary, bytes of WAL. */
24
24
  readonly MAX_LAG_BYTES: 1048576;
25
- /** Ожидание догоняния перед уходом на мастер, мс (0 — не ждать). */
25
+ /** Waiting for catch-up before going to the primary, ms (0 — do not wait). */
26
26
  readonly WAIT_FOR_CATCH_UP_MS: 0;
27
- /** Интервал опроса реплик во время ожидания, мс. */
27
+ /** The interval of polling the replicas during the wait, ms. */
28
28
  readonly CATCH_UP_POLL_MS: 10;
29
29
  /**
30
- * Не чаще одного нового зонда узла за столько мс, при любом числе чтений:
31
- * токен впереди реплики требует свежего зонда, и без потолка отставшие реплики
32
- * опрашивались бы на каждое чтение.
30
+ * No more than one new probe of a node per this many ms, with any number of reads:
31
+ * a token ahead of a replica requires a fresh probe, and without a ceiling lagging replicas
32
+ * would be polled on every read.
33
33
  */
34
34
  readonly MIN_PROBE_INTERVAL_MS: 10;
35
35
  /**
36
- * Сколько токен, который после failover ни одна реплика выполнить не может
37
- * (другая линия времени, другой кластер, впереди мастера), держит чтения на
38
- * мастере, мс; старше — чтение как без токена. Токен «без позиции» не
39
- * стареет: его позиция неизвестна.
36
+ * How long a token that after a failover no replica can satisfy
37
+ * (another timeline, another cluster, ahead of the primary) holds reads on the
38
+ * primary, ms; an older one is read as without a token. A token "without a position" does not
39
+ * age: its position is unknown.
40
40
  */
41
41
  readonly TOKEN_TTL_MS: 60000;
42
42
  /**
43
- * Сколько позиций токенов маршрутизатор помнит (момент первой встречи — для
44
- * потолка частоты зондов и истечения); вытесняется давно не встречавшаяся (LRU).
43
+ * How many token positions the router remembers (the moment of the first encounter — for
44
+ * the probe frequency ceiling and expiry); the one not seen for the longest time is evicted (LRU).
45
45
  */
46
46
  readonly POSITION_MEMORY: 1024;
47
- /** Потолок значений, которые идут в таймеры (`setTimeout` больше 2³¹−1 мс срабатывает через 1 мс). */
47
+ /** The ceiling of values that go into timers (`setTimeout` above 2³¹−1 ms fires after 1 ms). */
48
48
  readonly MAX_TIMER_MS: 2147483647;
49
- /** `application_name` соединений зонда, если адрес его не задаёт: видно в pg_stat_activity. */
49
+ /** The `application_name` of the probe connections if the address does not set it: visible in pg_stat_activity. */
50
50
  readonly APPLICATION_NAME: "pg-replica-sync";
51
51
  };