Skip to content

Commit 4510d5c

Browse files
Merge pull request #393 from rustprooflabs/replication-force-notes
Handle Replication/Force combination
2 parents 9ffa896 + 04d4146 commit 4510d5c

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

docker/pgosm_flex.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ def run_pgosm_flex(ram, region, subregion, debug, force,
105105

106106
if replication:
107107
replication_update = check_replication_exists()
108+
if replication_update and force:
109+
err_msg = 'Using --force is invalid when --replication is running an update.'
110+
err_msg += ' See https://pgosm-flex.com/replication.html#resetting-replication'
111+
err_msg += ' for instructions around this on a development server.'
112+
logger.error(err_msg)
113+
sys.exit(f'ERROR: {err_msg}')
108114
else:
109115
replication_update = False
110116

docs/src/replication.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,26 @@ using `--schema-name`, replication via osm2pgsql-replication only supports
8686
a single source. See [this issue](https://github.com/openstreetmap/osm2pgsql/pull/1769)
8787
for details. Possibly this ability will be supported in the future.
8888

89+
90+
## Resetting Replication
91+
92+
> ⚠️ WARNING! ⚠️ This section is <strong>only suitable for DEVELOPMENT databases</strong>.
93+
> Do NOT USE on production databases!
94+
95+
Replication with PgOSM Flex `--replication` is simply a wrapper around the
96+
`osm2pgsql-replication` tool. If you need to reload a <strong>development</strong>
97+
database after using `--replication` you must remove the data from the
98+
`public.osm2pgsql_properties` table. If you do not remove this data,
99+
PgOSM Flex will detect the replication setup and attempt to update data, not
100+
load fresh.
101+
102+
103+
```sql
104+
DELETE FROM public.osm2pgsql_properties;
105+
```
106+
107+
> WARNING: This process works as an okay hack when you are using the same layerset
108+
> in the new import as was previously used. If you use a layerset with fewer
109+
> tables, the original tables from the original layerset will persist and can
110+
> cause confusion about what was loaded.
111+

0 commit comments

Comments
 (0)