aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-09-30 00:49:52 -0700
committerChris Lu <chris.lu@gmail.com>2018-09-30 00:49:52 -0700
commit56a5d5af8d627e513cbfa3c89f6159646fb07d49 (patch)
tree46f01e704d2c16359d9965f1c2934fbf2bc94a6a
parent98384b62fdce0ec4fef9c8dd6fec04e0fd7f65dd (diff)
downloadseaweedfs-56a5d5af8d627e513cbfa3c89f6159646fb07d49.tar.xz
seaweedfs-56a5d5af8d627e513cbfa3c89f6159646fb07d49.zip
ignore duplicated key error if the store has duplicated primary key prevention
fix https://github.com/chrislusf/seaweedfs/issues/741
-rw-r--r--weed/filer2/filer.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/filer2/filer.go b/weed/filer2/filer.go
index 2586c664c..d722e60ac 100644
--- a/weed/filer2/filer.go
+++ b/weed/filer2/filer.go
@@ -88,11 +88,13 @@ func (f *Filer) CreateEntry(entry *Entry) error {
glog.V(2).Infof("create directory: %s %v", dirPath, dirEntry.Mode)
mkdirErr := f.store.InsertEntry(dirEntry)
if mkdirErr != nil {
- return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
+ if _, err := f.FindEntry(FullPath(dirPath)); err == ErrNotFound {
+ return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
+ }
+ } else {
+ f.NotifyUpdateEvent(nil, dirEntry, false)
}
- f.NotifyUpdateEvent(nil, dirEntry, false)
-
} else if !dirEntry.IsDirectory() {
return fmt.Errorf("%s is a file", dirPath)
}