15
15
package etcdutl
16
16
17
17
import (
18
- "errors"
19
18
"fmt"
20
19
"strings"
21
20
@@ -25,12 +24,10 @@ import (
25
24
26
25
"go.etcd.io/etcd/api/v3/version"
27
26
"go.etcd.io/etcd/pkg/v3/cobrautl"
28
- "go.etcd.io/etcd/server/v3/etcdserver/api/snap"
29
27
"go.etcd.io/etcd/server/v3/storage/backend"
30
28
"go.etcd.io/etcd/server/v3/storage/datadir"
31
29
"go.etcd.io/etcd/server/v3/storage/schema"
32
30
"go.etcd.io/etcd/server/v3/storage/wal"
33
- "go.etcd.io/etcd/server/v3/storage/wal/walpb"
34
31
)
35
32
36
33
// NewMigrateCommand prints out the version of etcd.
@@ -114,26 +111,6 @@ func (o *migrateOptions) Config() (*migrateConfig, error) {
114
111
return c , nil
115
112
}
116
113
117
- func getLatestWALSnap (lg * zap.Logger , dataDir string ) (walpb.Snapshot , error ) {
118
- walPath := datadir .ToWALDir (dataDir )
119
- walSnaps , err := wal .ValidSnapshotEntries (lg , walPath )
120
- if err != nil {
121
- return walpb.Snapshot {}, err
122
- }
123
-
124
- ss := snap .New (lg , datadir .ToSnapDir (dataDir ))
125
- snapshot , err := ss .LoadNewestAvailable (walSnaps )
126
- if err != nil && ! errors .Is (err , snap .ErrNoSnapshot ) {
127
- return walpb.Snapshot {}, err
128
- }
129
-
130
- var walsnap walpb.Snapshot
131
- if snapshot != nil {
132
- walsnap .Index , walsnap .Term = snapshot .Metadata .Index , snapshot .Metadata .Term
133
- }
134
- return walsnap , nil
135
- }
136
-
137
114
type migrateConfig struct {
138
115
lg * zap.Logger
139
116
be backend.Backend
0 commit comments