Compare commits

...
5 Commits
Author SHA1 Message Date
Chris Lu 369aa8a10a 1.76 2020-04-22 23:31:59 -07:00
Chris Lu 69eda558ef reduce the connections
fix https://github.com/chrislusf/seaweedfs/issues/1277

this avoids sending error to wdclients, and clients retry the connections
2020-04-22 20:43:34 -07:00
Chris Lu aebe39a803 avoid repeated grpc connection creation
fix https://github.com/chrislusf/seaweedfs/issues/1277
2020-04-22 18:26:24 -07:00
Chris Lu 5d0e1d8d74 also writes to local meta cache
before waiting for subscribed meta events
2020-04-22 15:40:47 -07:00
Chris Lu 1a34fd0b44 add mongodb 2020-04-21 22:15:47 -07:00
11 changed files with 53 additions and 23 deletions

No files matched your search

+3 -3
View File
@@ -90,7 +90,7 @@ There is only 40 bytes of disk storage overhead for each file's metadata. It is
SeaweedFS started by implementing [Facebook's Haystack design paper](http://www.usenix.org/event/osdi10/tech/full_papers/Beaver.pdf). Also, SeaweedFS implements erasure coding with ideas from [f4: Facebook’s Warm BLOB Storage System](https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-muralidhar.pdf)
On top of the object store, optional [Filer] can support directories and POSIX attributes. Filer is a separate linearly-scalable stateless server with customizable metadata stores, e.g., MySql, Postgres, Redis, Etcd, Cassandra, LevelDB, MemSql, TiDB, TiKV, CockroachDB, etc.
On top of the object store, optional [Filer] can support directories and POSIX attributes. Filer is a separate linearly-scalable stateless server with customizable metadata stores, e.g., MySql, Postgres, Mongodb, Redis, Etcd, Cassandra, LevelDB, MemSql, TiDB, TiKV, CockroachDB, etc.
[Back to TOC](#table-of-contents)
@@ -361,7 +361,7 @@ The architectures are mostly the same. SeaweedFS aims to store and read files fa
* SeaweedFS optimizes for small files, ensuring O(1) disk seek operation, and can also handle large files.
* SeaweedFS statically assigns a volume id for a file. Locating file content becomes just a lookup of the volume id, which can be easily cached.
* SeaweedFS Filer metadata store can be any well-known and proven data stores, e.g., Cassandra, Redis, Etcd, MySql, Postgres, MemSql, TiDB, CockroachDB, etc, and is easy to customized.
* SeaweedFS Filer metadata store can be any well-known and proven data stores, e.g., Cassandra, Mongodb, Redis, Etcd, MySql, Postgres, MemSql, TiDB, CockroachDB, etc, and is easy to customized.
* SeaweedFS Volume server also communicates directly with clients via HTTP, supporting range queries, direct uploads, etc.
| System | File Meta | File Content Read| POSIX | REST API | Optimized for small files |
@@ -402,7 +402,7 @@ Ceph uses CRUSH hashing to automatically manage the data placement. SeaweedFS pl
SeaweedFS is optimized for small files. Small files are stored as one continuous block of content, with at most 8 unused bytes between files. Small file access is O(1) disk read.
SeaweedFS Filer uses off-the-shelf stores, such as MySql, Postgres, Redis, Etcd, Cassandra, MemSql, TiDB, CockroachCB, to manage file directories. These stores are proven, scalable, and easier to manage.
SeaweedFS Filer uses off-the-shelf stores, such as MySql, Postgres, Mongodb, Redis, Etcd, Cassandra, MemSql, TiDB, CockroachCB, to manage file directories. These stores are proven, scalable, and easier to manage.
| SeaweedFS | comparable to Ceph | advantage |
| ------------- | ------------- | ---------------- |
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: v1
description: SeaweedFS
name: seaweedfs
version: 1.75
version: 1.76
+1 -1
View File
@@ -4,7 +4,7 @@ global:
registry: ""
repository: ""
imageName: chrislusf/seaweedfs
imageTag: "1.75"
imageTag: "1.76"
imagePullPolicy: IfNotPresent
imagePullSecrets: imagepullsecret
restartPolicy: Always
+23
View File
@@ -7,6 +7,7 @@ import (
"strings"
"time"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util"
@@ -137,6 +138,11 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
}
return fuse.EIO
}
if dir.wfs.option.AsyncMetaDataCaching {
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
}
return nil
}); err != nil {
return nil, nil, err
@@ -184,6 +190,10 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
return err
}
if dir.wfs.option.AsyncMetaDataCaching {
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
}
return nil
})
@@ -320,6 +330,10 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
return fuse.ENOENT
}
if dir.wfs.option.AsyncMetaDataCaching {
dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)
}
return nil
}
@@ -336,6 +350,11 @@ func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
glog.V(3).Infof("not found remove %s/%s: %v", dir.FullPath(), req.Name, err)
return fuse.ENOENT
}
if dir.wfs.option.AsyncMetaDataCaching {
dir.wfs.metaCache.DeleteEntry(context.Background(), t)
}
return nil
}
@@ -458,6 +477,10 @@ func (dir *Dir) saveEntry() error {
return fuse.EIO
}
if dir.wfs.option.AsyncMetaDataCaching {
dir.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
}
return nil
})
}
+6
View File
@@ -6,6 +6,7 @@ import (
"syscall"
"time"
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/fuse"
@@ -40,6 +41,11 @@ func (dir *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node,
glog.V(0).Infof("symlink %s/%s: %v", dir.FullPath(), req.NewName, err)
return fuse.EIO
}
if dir.wfs.option.AsyncMetaDataCaching {
dir.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
}
return nil
})
+4
View File
@@ -279,6 +279,10 @@ func (file *File) saveEntry() error {
return fuse.EIO
}
if file.wfs.option.AsyncMetaDataCaching {
file.wfs.metaCache.UpdateEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
}
return nil
})
}
+4
View File
@@ -209,6 +209,10 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
return fmt.Errorf("fh flush create %s: %v", fh.f.fullpath(), err)
}
if fh.f.wfs.option.AsyncMetaDataCaching {
fh.f.wfs.metaCache.InsertEntry(context.Background(), filer2.FromPbEntry(request.Directory, request.Entry))
}
fh.f.wfs.deleteFileChunks(garbages)
for i, chunk := range garbages {
glog.V(3).Infof("garbage %s chunks %d: %v [%d,%d)", fh.f.fullpath(), i, chunk.FileId, chunk.Offset, chunk.Offset+int64(chunk.Size))
+7 -4
View File
@@ -86,13 +86,15 @@ func WithCachedGrpcClient(fn func(*grpc.ClientConn) error, address string, opts
err := fn(existingConnection)
if err != nil {
grpcClientsLock.Lock()
delete(grpcClients, address)
// delete(grpcClients, address)
grpcClientsLock.Unlock()
existingConnection.Close()
// println("closing existing connection to", existingConnection.Target())
// existingConnection.Close()
}
return err
}
println(" dialing to", address, "...")
grpcConnection, err := GrpcDial(context.Background(), address, opts...)
if err != nil {
grpcClientsLock.Unlock()
@@ -105,9 +107,10 @@ func WithCachedGrpcClient(fn func(*grpc.ClientConn) error, address string, opts
err = fn(grpcConnection)
if err != nil {
grpcClientsLock.Lock()
delete(grpcClients, address)
// delete(grpcClients, address)
grpcClientsLock.Unlock()
grpcConnection.Close()
// println("closing created new connection to", grpcConnection.Target())
// grpcConnection.Close()
}
return err
-13
View File
@@ -11,7 +11,6 @@ import (
"google.golang.org/grpc/peer"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/storage/backend"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
@@ -191,18 +190,6 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
peerAddress := findClientAddress(stream.Context(), req.GrpcPort)
// only one shell can be connected at any time
if req.Name == pb.AdminShellClient {
if ms.currentAdminShellClient == "" {
ms.currentAdminShellClient = peerAddress
defer func() {
ms.currentAdminShellClient = ""
}()
} else {
return fmt.Errorf("only one concurrent shell allowed, but another shell is already connected from %s", peerAddress)
}
}
stopChan := make(chan bool)
clientName, messageChan := ms.addClient(req.Name, peerAddress)
+1 -1
View File
@@ -5,5 +5,5 @@ import (
)
var (
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 75)
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 76)
)
+3
View File
@@ -121,6 +121,9 @@ func (mc *MasterClient) tryConnectToMaster(master string) (nextHintedLeader stri
}
func (mc *MasterClient) WithClient(fn func(client master_pb.SeaweedClient) error) error {
for mc.currentMaster == "" {
time.Sleep(3 * time.Second)
}
return pb.WithMasterClient(mc.currentMaster, mc.grpcDialOption, func(client master_pb.SeaweedClient) error {
return fn(client)
})