Skip to content

[Feature Request] Automatically retry writes on the gateway #379

Open

Description

@alaye-ms

Purpose of the feature.
Have gateway hold writes when it sees the backing DB has been shut down. The kubernetes operator needs to have this for seamless failovers when promoting/demoting postgres

Describe the solution you'd like
When the gateway receives a write request and sees that the PG database is down, instead of returning failure, retry that request for ~2 minutes.

Describe alternatives you've considered
The alternative would be to adjust the client to handle these exceptions.

Additional context
This feature is only relevant in the scenario where the gateway is running, but the PG instance is not.

Activity

  1. added
    enhancement
    on Nov 18, 2025
  2. self-assigned this
    on Nov 18, 2025
  3. AndrewKhoma commented on Nov 18, 2025

    @AndrewKhoma
    Member

    thanks for reporting this!

  4. added
    gateway
    on Nov 26, 2025
  5. AndrewKhoma commented on Mar 26, 2026

    @AndrewKhoma
    Member

    @alaye-ms #541 contained these changes, please, verify from your end

  6. documentdb-triage-tool commented on May 30, 2026

    @documentdb-triage-tool

    👋 @AndrewKhoma — this issue has been assigned for 64 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  7. documentdb-triage-tool commented on Jun 13, 2026

    @documentdb-triage-tool

    👋 @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  8. documentdb-triage-tool commented on Jun 28, 2026

    @documentdb-triage-tool

    👋 @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  9. documentdb-triage-tool commented on Jul 13, 2026

    @documentdb-triage-tool

    👋 @AndrewKhoma — this issue has been assigned for 15 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  10. added this to the 0.111-0 milestone on Jul 24, 2026
  11. xgerman commented on Jul 24, 2026

    @xgerman
    Contributor

    Verified against an isolated ghcr.io/documentdb/documentdb/documentdb-local:pg17-0.114.0 instance: this is not fixed.

    Repro:

    1. Confirmed a baseline insertOne succeeds through the gateway.
    2. Kept the gateway running and stopped its PostgreSQL process with pg_ctl -D /data -m immediate -w stop.
    3. Submitted db.items.insertOne({_id: 2, stage: "retried-after-postgres-restart"}) through the gateway while PostgreSQL was unavailable.
    4. Restarted PostgreSQL after 12 seconds with pg_ctl -D /data -o "-p 9712" -w start.

    Actual result: the write immediately returned MongoServerError: An unexpected internal error and was not persisted. Gateway logs show Request failed with kind Pool, code InternalError and error connecting to server; no request retry occurred.

    The requested behavior is to hold/retry writes while PostgreSQL is down, so removing the release milestone and merged label.

  12. removed this from the 0.111-0 milestone on Jul 24, 2026
  13. documentdb-triage-tool commented on Aug 8, 2026

    @documentdb-triage-tool

    👋 @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  14. self-assigned this
    on Aug 13, 2026
  15. tsharp commented on Aug 13, 2026

    @tsharp
    Contributor

    @xgerman - do you know what the time between the write failure and the backend coming back up was?

  16. documentdb-triage-tool commented on Aug 27, 2026

    @documentdb-triage-tool

    👋 @tsharp, @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  17. documentdb-triage-tool commented on Sep 11, 2026

    @documentdb-triage-tool

    👋 @tsharp, @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  18. documentdb-triage-tool commented on Sep 25, 2026

    @documentdb-triage-tool

    👋 @tsharp, @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  19. documentdb-triage-tool commented on Oct 9, 2026

    @documentdb-triage-tool

    👋 @tsharp, @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  20. documentdb-triage-tool commented on Oct 28, 2026

    @documentdb-triage-tool

    👋 @tsharp, @AndrewKhoma — this issue has been assigned for 19 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  21. documentdb-triage-tool commented on Nov 11, 2026

    @documentdb-triage-tool

    👋 @tsharp, @AndrewKhoma — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementgatewaypending sync

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions