You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file `pg-microsharding.config.ts` is searched in all parent folders starting from the current working directory when `pg-microsharding` is run (typically you want to have it in the root of your project, near the other configuration files).
103
+
Unless `--skip-config` flag is passed, the file `pg-microsharding.config.ts` is searched in all parent folders starting from the current working directory when `pg-microsharding` is run (typically you want to have it in the root of your project, near the other configuration files).
102
104
103
105
You can export-default a regular function, an async function, or even a plain constant object.
104
106
@@ -153,7 +155,8 @@ The tool runs `--migrate-cmd` command right after creating the inactive microsha
153
155
```bash
154
156
pg-microsharding move \
155
157
--shard=42 --from=host1 --to=host2 \
156
-
--activate-on-destination=yes
158
+
--activate-on-destination=yes \
159
+
--max-replication-lag-sec=20
157
160
```
158
161
159
162
Microshards can be moved from one PostgreSQL node to another. There is no need to stop writes while moving microshards: the tool uses PostgreSQL logical replication to stream each microshard table's data, and in the very end, acquires a quick write lock to finalize the move.
@@ -231,6 +234,12 @@ When you run `pg-microsharding factor --factor="*1.2"`, the tool artificially in
231
234
232
235
The "weight increase factor" is technically stored as a SQL comment on the microshard schema, and it travels along with the microshard when you move it.
233
236
237
+
### Replication Lag Prevention
238
+
239
+
The tool tries hard to not affect the replication lag of the destination nodes when moving or rebalancing microshards. It waits until the lag drops below `--max-replication-lag-sec` seconds before running heavy operations (or until the user presses Shift+S to force-continue).
240
+
241
+
Also, if you want the tool to pause explicitly and wait until the user presses Shift+S before activating the shard on the destination node, you can use the `--wait` option.
242
+
234
243
## PostgreSQL Stored Functions API
235
244
236
245
This is the second part of pg-microsharding tool: a set of stored functions you add to your database.
The file `pg-microsharding.config.ts` is searched in all parent folders starting from the current working directory when `pg-microsharding` is run (typically you want to have it in the root of your project, near the other configuration files).
107
+
Unless `--skip-config` flag is passed, the file `pg-microsharding.config.ts` is searched in all parent folders starting from the current working directory when `pg-microsharding` is run (typically you want to have it in the root of your project, near the other configuration files).
106
108
107
109
You can export-default a regular function, an async function, or even a plain constant object.
108
110
@@ -157,7 +159,8 @@ The tool runs `--migrate-cmd` command right after creating the inactive microsha
157
159
```bash
158
160
pg-microsharding move \
159
161
--shard=42 --from=host1 --to=host2 \
160
-
--activate-on-destination=yes
162
+
--activate-on-destination=yes \
163
+
--max-replication-lag-sec=20
161
164
```
162
165
163
166
Microshards can be moved from one PostgreSQL node to another. There is no need to stop writes while moving microshards: the tool uses PostgreSQL logical replication to stream each microshard table's data, and in the very end, acquires a quick write lock to finalize the move.
@@ -235,6 +238,12 @@ When you run `pg-microsharding factor --factor="*1.2"`, the tool artificially in
235
238
236
239
The "weight increase factor" is technically stored as a SQL comment on the microshard schema, and it travels along with the microshard when you move it.
237
240
241
+
### Replication Lag Prevention
242
+
243
+
The tool tries hard to not affect the replication lag of the destination nodes when moving or rebalancing microshards. It waits until the lag drops below `--max-replication-lag-sec` seconds before running heavy operations (or until the user presses Shift+S to force-continue).
244
+
245
+
Also, if you want the tool to pause explicitly and wait until the user presses Shift+S before activating the shard on the destination node, you can use the `--wait` option.
246
+
238
247
## PostgreSQL Stored Functions API
239
248
240
249
This is the second part of pg-microsharding tool: a set of stored functions you add to your database.
0 commit comments