diff --git a/snapshot2/DESIGN.md b/snapshot/DESIGN.md similarity index 100% rename from snapshot2/DESIGN.md rename to snapshot/DESIGN.md diff --git a/snapshot2/sink.go b/snapshot/sink.go similarity index 99% rename from snapshot2/sink.go rename to snapshot/sink.go index 7d89e937..a219b910 100644 --- a/snapshot2/sink.go +++ b/snapshot/sink.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "fmt" diff --git a/snapshot2/sink_test.go b/snapshot/sink_test.go similarity index 99% rename from snapshot2/sink_test.go rename to snapshot/sink_test.go index 14ea4e70..bd8c13b5 100644 --- a/snapshot2/sink_test.go +++ b/snapshot/sink_test.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "bytes" diff --git a/snapshot2/snapshot.go b/snapshot/snapshot.go similarity index 97% rename from snapshot2/snapshot.go rename to snapshot/snapshot.go index 9e6b5cf0..599e4137 100644 --- a/snapshot2/snapshot.go +++ b/snapshot/snapshot.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "expvar" diff --git a/snapshot2/store.go b/snapshot/store.go similarity index 99% rename from snapshot2/store.go rename to snapshot/store.go index 6b6adefb..aa63ec3a 100644 --- a/snapshot2/store.go +++ b/snapshot/store.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "encoding/json" diff --git a/snapshot2/store_test.go b/snapshot/store_test.go similarity index 99% rename from snapshot2/store_test.go rename to snapshot/store_test.go index b9812cc2..6c0e4293 100644 --- a/snapshot2/store_test.go +++ b/snapshot/store_test.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "os" diff --git a/snapshot2/testdata/db-and-wals/backup.db b/snapshot/testdata/db-and-wals/backup.db similarity index 100% rename from snapshot2/testdata/db-and-wals/backup.db rename to snapshot/testdata/db-and-wals/backup.db diff --git a/snapshot2/testdata/db-and-wals/create-wals.py b/snapshot/testdata/db-and-wals/create-wals.py similarity index 100% rename from snapshot2/testdata/db-and-wals/create-wals.py rename to snapshot/testdata/db-and-wals/create-wals.py diff --git a/snapshot2/testdata/db-and-wals/full2.db b/snapshot/testdata/db-and-wals/full2.db similarity index 100% rename from snapshot2/testdata/db-and-wals/full2.db rename to snapshot/testdata/db-and-wals/full2.db diff --git a/snapshot2/testdata/db-and-wals/wal-00 b/snapshot/testdata/db-and-wals/wal-00 similarity index 100% rename from snapshot2/testdata/db-and-wals/wal-00 rename to snapshot/testdata/db-and-wals/wal-00 diff --git a/snapshot2/testdata/db-and-wals/wal-01 b/snapshot/testdata/db-and-wals/wal-01 similarity index 100% rename from snapshot2/testdata/db-and-wals/wal-01 rename to snapshot/testdata/db-and-wals/wal-01 diff --git a/snapshot2/testdata/db-and-wals/wal-02 b/snapshot/testdata/db-and-wals/wal-02 similarity index 100% rename from snapshot2/testdata/db-and-wals/wal-02 rename to snapshot/testdata/db-and-wals/wal-02 diff --git a/snapshot2/testdata/db-and-wals/wal-03 b/snapshot/testdata/db-and-wals/wal-03 similarity index 100% rename from snapshot2/testdata/db-and-wals/wal-03 rename to snapshot/testdata/db-and-wals/wal-03 diff --git a/snapshot2/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/meta.json b/snapshot/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/meta.json similarity index 100% rename from snapshot2/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/meta.json rename to snapshot/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/meta.json diff --git a/snapshot2/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/state.bin b/snapshot/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/state.bin similarity index 100% rename from snapshot2/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/state.bin rename to snapshot/testdata/upgrade/v7.20.3-snapshots/2-18-1686659761026/state.bin diff --git a/snapshot2/testdata/upgrade/v7.20.3-snapshots/2-8-1686659756627/meta.json b/snapshot/testdata/upgrade/v7.20.3-snapshots/2-8-1686659756627/meta.json similarity index 100% rename from snapshot2/testdata/upgrade/v7.20.3-snapshots/2-8-1686659756627/meta.json rename to snapshot/testdata/upgrade/v7.20.3-snapshots/2-8-1686659756627/meta.json diff --git a/snapshot2/upgrader.go b/snapshot/upgrader.go similarity index 99% rename from snapshot2/upgrader.go rename to snapshot/upgrader.go index 88405885..ae85d2a5 100644 --- a/snapshot2/upgrader.go +++ b/snapshot/upgrader.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "compress/gzip" diff --git a/snapshot2/upgrader_test.go b/snapshot/upgrader_test.go similarity index 99% rename from snapshot2/upgrader_test.go rename to snapshot/upgrader_test.go index a892ba04..9836de0d 100644 --- a/snapshot2/upgrader_test.go +++ b/snapshot/upgrader_test.go @@ -1,4 +1,4 @@ -package snapshot2 +package snapshot import ( "fmt" diff --git a/store/store.go b/store/store.go index b4db7a96..07004ad4 100644 --- a/store/store.go +++ b/store/store.go @@ -24,7 +24,7 @@ import ( "github.com/rqlite/rqlite/command/chunking" sql "github.com/rqlite/rqlite/db" rlog "github.com/rqlite/rqlite/log" - "github.com/rqlite/rqlite/snapshot2" + "github.com/rqlite/rqlite/snapshot" ) var ( @@ -387,12 +387,12 @@ func (s *Store) Open() (retErr error) { // Upgrade any pre-existing snapshots. oldSnapshotDir := filepath.Join(s.raftDir, "snapshots") snapshotDir := filepath.Join(s.raftDir, "rsnapshots") - if err := snapshot2.Upgrade(oldSnapshotDir, snapshotDir, s.logger); err != nil { + if err := snapshot.Upgrade(oldSnapshotDir, snapshotDir, s.logger); err != nil { return fmt.Errorf("failed to upgrade snapshots: %s", err) } // Create store for the Snapshots. - snapshotStore, err := snapshot2.NewStore(filepath.Join(snapshotDir)) + snapshotStore, err := snapshot.NewStore(filepath.Join(snapshotDir)) if err != nil { return fmt.Errorf("failed to create snapshot store: %s", err) } @@ -1676,7 +1676,7 @@ func (s *Store) Snapshot() (raft.FSMSnapshot, error) { if err != nil { return nil, err } - fsmSnapshot = snapshot2.NewSnapshot(dbFD) + fsmSnapshot = snapshot.NewSnapshot(dbFD) stats.Add(numSnapshotsFull, 1) } else { var b []byte @@ -1692,7 +1692,7 @@ func (s *Store) Snapshot() (raft.FSMSnapshot, error) { return nil, err } } - fsmSnapshot = snapshot2.NewSnapshot(io.NopCloser(bytes.NewBuffer(b))) + fsmSnapshot = snapshot.NewSnapshot(io.NopCloser(bytes.NewBuffer(b))) if err != nil { return nil, err } @@ -2001,7 +2001,7 @@ func RecoverNode(dataDir string, logger *log.Logger, logs raft.LogStore, stable if err != nil { return fmt.Errorf("failed to open temporary database file: %s", err) } - fsmSnapshot := snapshot2.NewSnapshot(tmpDBFD) // tmpDBPath contains full state now. + fsmSnapshot := snapshot.NewSnapshot(tmpDBFD) // tmpDBPath contains full state now. sink, err := snaps.Create(1, lastIndex, lastTerm, conf, 1, tn) if err != nil { return fmt.Errorf("failed to create snapshot: %v", err)