Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wal: remove wal directory on windows before renaming tmpdir #7915

Closed
wants to merge 1 commit into from

Conversation

amdprophet
Copy link

Renaming on windows will not work if the destination already exists. This change removes the wal directory before the wal tmpdir is renamed to wal.

This has resolved an issue we had with embedded etcd failing to start. I'm not aware of any consequences of this change but please let me know if I'm missing something!

Renaming on windows will not work if the destination already exists. This
change removes the wal directory before the wal tmpdir is renamed to "wal".
@heyitsanthony
Copy link
Contributor

Won't this clobber data if two etcd processes launch on the same member directory concurrently?

@codecov-io
Copy link

Codecov Report

Merging #7915 into master will increase coverage by 0.17%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #7915      +/-   ##
=========================================
+ Coverage   75.62%   75.8%   +0.17%     
=========================================
  Files         336     336              
  Lines       26390   26390              
=========================================
+ Hits        19957   20004      +47     
+ Misses       4996    4948      -48     
- Partials     1437    1438       +1
Impacted Files Coverage Δ
pkg/fileutil/purge.go 73.68% <0%> (-7.9%) ⬇️
proxy/grpcproxy/watch.go 90.97% <0%> (-3.48%) ⬇️
lease/leasehttp/http.go 62.59% <0%> (-1.53%) ⬇️
rafthttp/peer.go 90.07% <0%> (-1.53%) ⬇️
etcdmain/etcd.go 44.2% <0%> (-1.29%) ⬇️
clientv3/balancer.go 93.98% <0%> (-1.1%) ⬇️
rafthttp/stream.go 88.59% <0%> (-1.01%) ⬇️
clientv3/lease.go 91.57% <0%> (-0.77%) ⬇️
etcdserver/server.go 80.09% <0%> (-0.58%) ⬇️
raft/node.go 89.73% <0%> (-0.45%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f63eb2f...eef0c44. Read the comment docs.

@amdprophet
Copy link
Author

@heyitsanthony If that is the case, wouldn't Rename end up with the same result if it had worked? Think mv on Linux and how it replaces the destination.

wal_unix.go is also already doing this. https://github.com/coreos/etcd/blob/master/wal/wal_unix.go#L33-L35

@heyitsanthony
Copy link
Contributor

heyitsanthony commented May 11, 2017

@amdprophet the unix one should be safe because it has the lock in the directory; windows doesn't

@heyitsanthony
Copy link
Contributor

some more testing around this path is probably warranted; etcd probably shouldn't be clobbering wal directories unless it knows that it has exclusive access and nothing else is using it

@heyitsanthony
Copy link
Contributor

Superseded by #8286. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants