From fe5f85c7de2eaef5188238fe774cfc54867305e4 Mon Sep 17 00:00:00 2001 From: Amit Barve Date: Fri, 14 Jun 2024 11:39:03 -0700 Subject: [PATCH] Fix incorrect comment about ordering of parent layers The ParentIDs array in the Snapshot type is populated in the reverse order i.e the immediate parent is at the 0th index and the oldest parent is at the last index. It can be seen here: https://github.com/containerd/containerd/blob/main/core/snapshots/storage/bolt.go#L492 When applying these layers, the parent layer at the last index should be applied first and the parent layer at the 0th index should be applied last. However, the comment above the Snapshot type says the exact opposite thing. This commit fixes that comment. Signed-off-by: Amit Barve --- core/snapshots/storage/metastore.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/snapshots/storage/metastore.go b/core/snapshots/storage/metastore.go index 4b55aaeea..bbfc091ff 100644 --- a/core/snapshots/storage/metastore.go +++ b/core/snapshots/storage/metastore.go @@ -48,10 +48,10 @@ type Transactor interface { // Snapshot hold the metadata for an active or view snapshot transaction. The // ParentIDs hold the snapshot identifiers for the committed snapshots this -// active or view is based on. The ParentIDs are ordered from the lowest base -// to highest, meaning they should be applied in order from the first index to -// the last index. The last index should always be considered the active -// snapshots immediate parent. +// active or view is based on. The ParentIDs are ordered from the highest to the +// lowest base, meaning they should be applied in order from the last index to +// the first index. The first index should always be considered the active +// snapshot's immediate parent. type Snapshot struct { Kind snapshots.Kind ID string