[Tile-serving] [osm2pgsql-dev/osm2pgsql] Add optional --end-at-sequence parameter to limit updates to a specific sequence number (PR #2329)

Infoscape Software notifications at github.com
Tue May 13 19:14:12 UTC 2025


## Summary

This pull request introduces an **optional `--end-at-sequence` parameter** to `osm2pgsql-replication update`, allowing users to **limit the replication process to a specific sequence number**.

If provided, the replication process stops **before applying** any sequence **strictly greater** than the specified value.

---

## Motivation

When managing large datasets or performing staged updates, it is sometimes necessary to:

- **Apply updates incrementally**, stopping at a known sequence checkpoint.
- **Avoid consuming all available diffs** in a single run.
- **Synchronize updates across multiple systems** or environments by controlling the applied range.

This feature makes such workflows **safer** and **more predictable**, without impacting the default behavior when the option is not provided.

---

## Example usage

```bash
osm2pgsql-replication update --database=mydb --end-at-sequence=12345
```

- Applies all diffs **up to and including 12345**.
- **Stops before applying 12346 or higher**.

If `--end-at-sequence` is not specified, the replication process behaves **exactly as before**.

---

## Implementation Details

- The option is parsed and passed as `args.end_at_sequence` (integer, optional).
- The update loop **checks `endseq` before applying diffs**.
- **No changes** to the replication state if the stop condition is met.
- Includes **informative log messages** when stopping due to this limit.

---

## Compatibility

- **Backward-compatible**: default behavior is unchanged if the option is not used.
- **No impact** on existing workflows.

---

## Additional Notes

- This feature was designed to support **controlled or audited replication workflows**.
- It may be useful in **data pipelines**, **batch updates**, or **multi-stage import processes**.

---
You can view, comment on, or merge this pull request online at:

  https://github.com/osm2pgsql-dev/osm2pgsql/pull/2329

-- Commit Summary --

  * ajout de l'option --end-at-sequence

-- File Changes --

    M scripts/osm2pgsql-replication (17)

-- Patch Links --

https://github.com/osm2pgsql-dev/osm2pgsql/pull/2329.patch
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2329.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2329
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/pull/2329 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20250513/47084e06/attachment.htm>


More information about the Tile-serving mailing list