// upgradeWAL converts an older version of the etcdServer data to the newest version. // It must ensure that, after upgrading, the most recent version is present. func upgradeWAL(cfg *ServerConfig, ver wal.WalVersion) error { if ver == wal.WALv0_4 { log.Print("etcdserver: converting v0.4 log to v2.0") err := migrate.Migrate4To2(cfg.DataDir, cfg.Name) if err != nil { log.Fatalf("etcdserver: failed migrating data-dir: %v", err) return err } } return nil }
func main() { from := flag.String("data-dir", "", "etcd v0.4 data-dir") name := flag.String("name", "", "etcd node name") flag.Parse() if *from == "" { log.Fatal("Must provide -data-dir flag") } err := migrate.Migrate4To2(*from, *name) if err != nil { log.Fatalf("Failed migrating data-dir: %v", err) } }
// upgradeWAL converts an older version of the etcdServer data to the newest version. // It must ensure that, after upgrading, the most recent version is present. func upgradeDataDir(baseDataDir string, name string, ver version.DataDirVersion) error { switch ver { case version.DataDir0_4: plog.Infof("converting v0.4 log to v2.0") err := migrate.Migrate4To2(baseDataDir, name) if err != nil { plog.Fatalf("failed to migrate data-dir (%v)", err) return err } fallthrough case version.DataDir2_0: err := makeMemberDir(baseDataDir) if err != nil { return err } fallthrough case version.DataDir2_0_1: fallthrough default: } return nil }
// upgradeWAL converts an older version of the etcdServer data to the newest version. // It must ensure that, after upgrading, the most recent version is present. func upgradeDataDir(baseDataDir string, name string, ver version.DataDirVersion) error { switch ver { case version.DataDir0_4: log.Print("etcdserver: converting v0.4 log to v2.0") err := migrate.Migrate4To2(baseDataDir, name) if err != nil { log.Fatalf("etcdserver: failed migrating data-dir: %v", err) return err } fallthrough case version.DataDir2_0: err := makeMemberDir(baseDataDir) if err != nil { return err } fallthrough case version.DataDir2_0_1: fallthrough default: log.Printf("etcdserver: datadir is valid for the 2.0.1 format") } return nil }