Browse Source

fix(server): only set NOCOW for log file

Yicheng Qin 11 years ago
parent
commit
1eff547af6
2 changed files with 6 additions and 6 deletions
  1. 0 6
      etcd/etcd.go
  2. 6 0
      server/peer_server.go

+ 0 - 6
etcd/etcd.go

@@ -33,7 +33,6 @@ import (
 	ehttp "github.com/coreos/etcd/http"
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/metrics"
-	"github.com/coreos/etcd/pkg/fs"
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/store"
 )
@@ -103,11 +102,6 @@ func (e *Etcd) Run() {
 		log.Warnf("All cached configuration is now ignored. The file %s can be removed.", info)
 	}
 
-	// Set NOCOW for data directory in btrfs
-	if fs.IsBtrfs(e.Config.DataDir) {
-		fs.SetNOCOW(e.Config.DataDir)
-	}
-
 	var mbName string
 	if e.Config.Trace() {
 		mbName = e.Config.MetricsBucketName()

+ 6 - 0
server/peer_server.go

@@ -19,6 +19,7 @@ import (
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/metrics"
+	"github.com/coreos/etcd/pkg/fs"
 	"github.com/coreos/etcd/store"
 )
 
@@ -291,6 +292,11 @@ func (s *PeerServer) Start(snapshot bool, discoverURL string, peers []string) er
 
 	s.raftServer.Init()
 
+	// Set NOCOW for data directory in btrfs
+	if fs.IsBtrfs(s.raftServer.LogPath()) {
+		fs.SetNOCOW(s.raftServer.LogPath())
+	}
+
 	s.findCluster(discoverURL, peers)
 
 	s.closeChan = make(chan bool)