Skip to content

snapshot/manager.py のアーカイブ名と展開コマンドの組み立てが restore・作成・clear_command に散らばっている #266

Description

@takemi-ohama

何を見つけたか

lib/devbase/snapshot/manager.py の SnapshotManager に、同じ形の文字列の組み立てが複数ある。

  • restore が full と各 incr の展開で zstd -d ... | tar --listed-incremental=/dev/null -xf - -C /target を 2 か所に書いている(R4-001)
  • アーカイブ名(full.tar.zst / incr-NNN.tar.zst / snapshot.snar)の文字列が restore / _create_full / _create_incremental に散らばっている(R3-003)。last_snapshot_time も full.tar.zst / incr-*.tar.zst の判定を独自に持つ(manager.py 266〜270 行目)
  • clear_command と volume_mount_args が、マウント先のパス(/target/<sub> か /target)を別々に組み立てている(R4-004)

どこで見つけたか

PR #263 の構造改善(cross-refactoring)の提案ラウンド 1・2。適用されたコミット c2d75e0・5ed1d61・2b63b89 は PR から戻した(a81af47)。改修計画: #263 (comment)

なぜこの変更の範囲外なのか

PR #263(PLAN68、#248)の受け入れ条件 24 は restore の振る舞いを変えないことを求め、restore / clear_command は PR の差分に含まれない。--scope がファイル単位のため、同じファイルの既存の関数へ提案が向いた。

直さないと何が起きるか

振る舞いの不具合ではない。アーカイブ名や展開のオプションを変えるとき、片方だけを直して full と incr で扱いが食い違うおそれが残る。

由来

PR #263

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions