diff options
| author | chrislu <chris.lu@gmail.com> | 2022-06-29 12:50:33 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-06-29 12:50:33 -0700 |
| commit | ffaa2163e0aa3aee3d9cd0312a2b3b81cae8c4d6 (patch) | |
| tree | c6de920ada79fc65f73f6c23a75a0a5d048f45e6 /weed | |
| parent | f3c4b07b8a5dd6dc3e91bfa9d1a423b18b958558 (diff) | |
| parent | 4ae9884a6e6375f81f709aa890458c8d4a61276d (diff) | |
| download | seaweedfs-ffaa2163e0aa3aee3d9cd0312a2b3b81cae8c4d6.tar.xz seaweedfs-ffaa2163e0aa3aee3d9cd0312a2b3b81cae8c4d6.zip | |
Merge branch 'master' of https://github.com/chrislusf/seaweedfs
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/command/filer_remote_gateway_buckets.go | 3 | ||||
| -rw-r--r-- | weed/filer/meta_aggregator.go | 6 | ||||
| -rw-r--r-- | weed/replication/sink/localsink/local_sink.go | 3 | ||||
| -rw-r--r-- | weed/s3api/s3_constants/s3_actions.go | 1 | ||||
| -rw-r--r-- | weed/s3api/s3api_bucket_handlers.go | 8 | ||||
| -rw-r--r-- | weed/s3api/s3api_object_multipart_handlers.go | 2 | ||||
| -rw-r--r-- | weed/s3api/s3api_objects_list_handlers.go | 2 | ||||
| -rw-r--r-- | weed/shell/command_s3_clean_uploads.go | 3 |
8 files changed, 17 insertions, 11 deletions
diff --git a/weed/command/filer_remote_gateway_buckets.go b/weed/command/filer_remote_gateway_buckets.go index c3ff756db..9fe0e29df 100644 --- a/weed/command/filer_remote_gateway_buckets.go +++ b/weed/command/filer_remote_gateway_buckets.go @@ -9,6 +9,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/pb/remote_pb" "github.com/chrislusf/seaweedfs/weed/remote_storage" "github.com/chrislusf/seaweedfs/weed/replication/source" + "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" "github.com/chrislusf/seaweedfs/weed/util" "github.com/golang/protobuf/proto" "math" @@ -181,7 +182,7 @@ func (option *RemoteGatewayOptions) makeBucketedEventProcessor(filerSource *sour if message.NewParentPath == option.bucketsDir { return handleCreateBucket(message.NewEntry) } - if strings.HasPrefix(message.NewParentPath, option.bucketsDir) && strings.Contains(message.NewParentPath, "/.uploads/") { + if strings.HasPrefix(message.NewParentPath, option.bucketsDir) && strings.Contains(message.NewParentPath, "/"+s3_constants.MultipartUploadsFolder+"/") { return nil } if !filer.HasData(message.NewEntry) { diff --git a/weed/filer/meta_aggregator.go b/weed/filer/meta_aggregator.go index fb96ee01b..1a805bde3 100644 --- a/weed/filer/meta_aggregator.go +++ b/weed/filer/meta_aggregator.go @@ -100,7 +100,8 @@ func (ma *MetaAggregator) loopSubscribeToOnefiler(f *Filer, self pb.ServerAddres } if err != nil { glog.V(0).Infof("subscribing remote %s meta change: %v", peer, err) - } else if lastTsNs < nextLastTsNs { + } + if lastTsNs < nextLastTsNs { lastTsNs = nextLastTsNs } time.Sleep(1733 * time.Millisecond) @@ -210,10 +211,9 @@ func (ma *MetaAggregator) doSubscribeToOneFiler(f *Filer, self pb.ServerAddress, if err := processEventFn(resp); err != nil { return fmt.Errorf("process %v: %v", resp, err) } - lastTsNs = resp.TsNs f.onMetadataChangeEvent(resp) - + lastTsNs = resp.TsNs } }) return lastTsNs, err diff --git a/weed/replication/sink/localsink/local_sink.go b/weed/replication/sink/localsink/local_sink.go index f3d3862ee..0a2109a22 100644 --- a/weed/replication/sink/localsink/local_sink.go +++ b/weed/replication/sink/localsink/local_sink.go @@ -7,6 +7,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/replication/repl_util" "github.com/chrislusf/seaweedfs/weed/replication/sink" "github.com/chrislusf/seaweedfs/weed/replication/source" + "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" "github.com/chrislusf/seaweedfs/weed/util" "os" "path/filepath" @@ -32,7 +33,7 @@ func (localsink *LocalSink) GetName() string { } func (localsink *LocalSink) isMultiPartEntry(key string) bool { - return strings.HasSuffix(key, ".part") && strings.Contains(key, "/.uploads/") + return strings.HasSuffix(key, ".part") && strings.Contains(key, "/"+s3_constants.MultipartUploadsFolder+"/") } func (localsink *LocalSink) initialize(dir string, isIncremental bool) error { diff --git a/weed/s3api/s3_constants/s3_actions.go b/weed/s3api/s3_constants/s3_actions.go index 0fbf134e3..721c57f71 100644 --- a/weed/s3api/s3_constants/s3_actions.go +++ b/weed/s3api/s3_constants/s3_actions.go @@ -8,4 +8,5 @@ const ( ACTION_LIST = "List" SeaweedStorageDestinationHeader = "x-seaweedfs-destination" + MultipartUploadsFolder = ".uploads" ) diff --git a/weed/s3api/s3api_bucket_handlers.go b/weed/s3api/s3api_bucket_handlers.go index f70e46b92..c057ec10c 100644 --- a/weed/s3api/s3api_bucket_handlers.go +++ b/weed/s3api/s3api_bucket_handlers.go @@ -150,12 +150,14 @@ func (s3a *S3ApiServer) DeleteBucketHandler(w http.ResponseWriter, r *http.Reque err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { if !s3a.option.AllowDeleteBucketNotEmpty { - entries, _, err := s3a.list(s3a.option.BucketsPath+"/"+bucket, "", "", false, 1) + entries, _, err := s3a.list(s3a.option.BucketsPath+"/"+bucket, "", "", false, 2) if err != nil { return fmt.Errorf("failed to list bucket %s: %v", bucket, err) } - if len(entries) > 0 { - return errors.New(s3err.GetAPIError(s3err.ErrBucketNotEmpty).Code) + for _, entry := range entries { + if entry.Name != s3_constants.MultipartUploadsFolder { + return errors.New(s3err.GetAPIError(s3err.ErrBucketNotEmpty).Code) + } } } diff --git a/weed/s3api/s3api_object_multipart_handlers.go b/weed/s3api/s3api_object_multipart_handlers.go index d2ff87832..feb289ef3 100644 --- a/weed/s3api/s3api_object_multipart_handlers.go +++ b/weed/s3api/s3api_object_multipart_handlers.go @@ -268,7 +268,7 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ } func (s3a *S3ApiServer) genUploadsFolder(bucket string) string { - return fmt.Sprintf("%s/%s/.uploads", s3a.option.BucketsPath, bucket) + return fmt.Sprintf("%s/%s/%s", s3a.option.BucketsPath, bucket, s3_constants.MultipartUploadsFolder) } // Generate uploadID hash string from object diff --git a/weed/s3api/s3api_objects_list_handlers.go b/weed/s3api/s3api_objects_list_handlers.go index 6b934bccd..975ba6201 100644 --- a/weed/s3api/s3api_objects_list_handlers.go +++ b/weed/s3api/s3api_objects_list_handlers.go @@ -309,7 +309,7 @@ func (s3a *S3ApiServer) doListFilerEntries(client filer_pb.SeaweedFilerClient, d nextMarker = dir + "/" + entry.Name if entry.IsDirectory { // println("ListEntries", dir, "dir:", entry.Name) - if entry.Name == ".uploads" { // FIXME no need to apply to all directories. this extra also affects maxKeys + if entry.Name == s3_constants.MultipartUploadsFolder { // FIXME no need to apply to all directories. this extra also affects maxKeys continue } if delimiter == "" { diff --git a/weed/shell/command_s3_clean_uploads.go b/weed/shell/command_s3_clean_uploads.go index a6dc8f574..198f94363 100644 --- a/weed/shell/command_s3_clean_uploads.go +++ b/weed/shell/command_s3_clean_uploads.go @@ -3,6 +3,7 @@ package shell import ( "flag" "fmt" + "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/util" "io" @@ -68,7 +69,7 @@ func (c *commandS3CleanUploads) Do(args []string, commandEnv *CommandEnv, writer } func (c *commandS3CleanUploads) cleanupUploads(commandEnv *CommandEnv, writer io.Writer, filerBucketsPath string, bucket string, timeAgo time.Duration, signingKey string) error { - uploadsDir := filerBucketsPath + "/" + bucket + "/.uploads" + uploadsDir := filerBucketsPath + "/" + bucket + "/" + s3_constants.MultipartUploadsFolder var staleUploads []string now := time.Now() err := filer_pb.List(commandEnv, uploadsDir, "", func(entry *filer_pb.Entry, isLast bool) error { |
