Manual physical snapshots start additional snapshot and retention schedulers

オープン
#403 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, postgresql
領域
backend, databases

調査の方向性

Read engine/internal/srv/routes.go and engine/internal/retrieval/retrieval.go around the named createSnapshot and SnapshotData paths, then inspect engine/internal/retrieval/engine/postgres/snapshot/physical.go for scheduler startup and lifecycle. Reproduce the reported sequence of startup followed by four manual requests and observe scheduled callbacks. Done means manual snapshots do not add recurring schedulers, and snapshot and retention jobs run once per pool with operations coordinated.

索引モデルが issue の本文から書いたものです。

説明

While testing physical snapshots on DBLab Engine v4.2.0, I noticed that each manual POST /snapshot request starts another recurring scheduler. After four manual snapshots, the scheduled snapshot and retention jobs run five times instead of once.

I also reproduced the scheduler behavior against the v4.2.2 retrieval code in an isolated Go test. That test skipped storage operations; it was not a full v4.2.2 database restore test.

Steps to reproduce

  1. Start an engine with a ZFS pool and physicalRestore / physicalSnapshot configured.

  2. Enable scheduled snapshots and retention. For example, this is the relevant configuration section:

    retrieval:
      jobs: [physicalRestore, physicalSnapshot]
      spec:
        physicalSnapshot:
          options:
            scheduler:
              snapshot:
                timetable: "0 * * * *"
              retention:
                timetable: "30 * * * *"
                limit: 2
    
  3. Wait for initialization to finish, then request four manual snapshots sequentially, letting each request finish before starting the next. For a pool named test_pool:

    curl --fail-with-body --request POST \
      --header 'Verification-Token: <token>' \
      --header 'Content-Type: application/json' \
      --data '{"poolName":"test_pool"}' \
      http://127.0.0.1:2345/snapshot
    
  4. Check the logs at the next scheduled snapshot and retention times.

Actual behavior

  • Startup logs Snapshot scheduler has been started once. Each manual request adds another occurrence, without stopping the previous scheduler.
  • After four manual requests, five snapshot jobs start at the scheduled time. One succeeds; the others collide with it and report that the dataset already exists.
  • The retention callbacks also run concurrently against the same targets. I observed dataset is busy errors during these overlapping cleanup attempts.

The isolated test exercised the real SnapshotData and scheduler startup path. The number of active schedulers increased from 1 -> 2 -> 3 -> 4 -> 5, and callbacks from all five fired. Cancelling the startup context stopped only the first scheduler; the four created with context.Background() continued running. The test explicitly stopped all schedulers afterward.

Expected behavior

A manual snapshot should take one snapshot without adding another recurring schedule. Scheduled snapshot creation and retention should continue running once per pool, with manual and scheduled operations coordinated.

Relevant code

  • createSnapshot calls SnapshotData(context.Background(), poolName).
  • SnapshotData constructs new jobs and replaces statefulJobs without stopping the previous jobs.
  • PhysicalInitial.Run starts a scheduler on return. Each instance registers both snapshot and retention callbacks and has its own mutex, so the instances do not serialize their operations with each other.

Workaround

Restarting the engine clears the extra schedulers. Avoiding manual POST /snapshot requests afterward prevents them from accumulating again.

主要言語
Go
スター
2.8k
フォーク
90
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

postgres-ai/database-lab-engine のほかの issue

postgres-ai/database-lab-engine の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。