mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-29 15:47:04 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59a9e15733 | ||
|
|
66c609d434 | ||
|
|
e11e127d91 | ||
|
|
db1360c36a | ||
|
|
361912224d | ||
|
|
0e33272f56 | ||
|
|
cb2061f86a | ||
|
|
c0d6cc0067 | ||
|
|
c3fa50d3b3 | ||
|
|
2f76681d62 | ||
|
|
f2031884f0 | ||
|
|
4df10e50b3 | ||
|
|
c1a0403da2 | ||
|
|
7d8ce080bd | ||
|
|
3895c86812 | ||
|
|
3555628ad5 | ||
|
|
8a5ce16e96 | ||
|
|
9924fa3b1a | ||
|
|
35aba35c07 | ||
|
|
a55e708d36 |
No files matched your search
@@ -52,7 +52,7 @@ Your support will be really appreciated by me and other supporters!
|
||||
- [SeaweedFS on Slack](https://join.slack.com/t/seaweedfs/shared_invite/enQtMzI4MTMwMjU2MzA3LTc4MmVlYmFlNjBmZTgzZmJlYmI1MDE1YzkyNWYyZjkwZDFiM2RlMDdjNjVlNjdjYzc4NGFhZGIyYzEyMzJkYTA)
|
||||
- [SeaweedFS Mailing List](https://groups.google.com/d/forum/seaweedfs)
|
||||
- [Wiki Documentation](https://github.com/chrislusf/seaweedfs/wiki)
|
||||
|
||||
- [SeaweedFS Introduction Slides](https://www.slideshare.net/chrislusf/seaweedfs-introduction)
|
||||
|
||||
## Introduction
|
||||
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
FROM frolvlad/alpine-glibc
|
||||
|
||||
# Supercronic install settings
|
||||
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.8/supercronic-linux-amd64 \
|
||||
SUPERCRONIC=supercronic-linux-amd64 \
|
||||
SUPERCRONIC_SHA1SUM=be43e64c45acd6ec4fce5831e03759c89676a0ea
|
||||
|
||||
# Install SeaweedFS and Supercronic ( for cron job mode )
|
||||
# Tried to use curl only (curl -o /tmp/linux_amd64.tar.gz ...), however it turned out that the following tar command failed with "gzip: stdin: not in gzip format"
|
||||
RUN apk add --no-cache --virtual build-dependencies --update wget curl ca-certificates && \
|
||||
wget -P /tmp https://github.com/$(curl -s -L https://github.com/chrislusf/seaweedfs/releases/latest | egrep -o 'chrislusf/seaweedfs/releases/download/.*/linux_amd64.tar.gz') && \
|
||||
tar -C /usr/bin/ -xzvf /tmp/linux_amd64.tar.gz && \
|
||||
curl -fsSLO "$SUPERCRONIC_URL" && \
|
||||
echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - && \
|
||||
chmod +x "$SUPERCRONIC" && \
|
||||
mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" && \
|
||||
ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic && \
|
||||
apk del build-dependencies && \
|
||||
rm -rf /tmp/*
|
||||
|
||||
|
||||
@@ -44,6 +44,14 @@ case "$1" in
|
||||
exec /usr/bin/weed $@ $ARGS
|
||||
;;
|
||||
|
||||
'cronjob')
|
||||
MASTER=${WEED_MASTER-localhost:9333}
|
||||
CRON_SCHEDULE=${CRON_SCHEDULE-*/5 * * * * *}
|
||||
echo "$CRON_SCHEDULE" 'echo "volume.fix.replication" | weed shell -master='$MASTER > /crontab
|
||||
echo "Running Crontab:"
|
||||
cat /crontab
|
||||
exec supercronic /crontab
|
||||
;;
|
||||
*)
|
||||
exec /usr/bin/weed $@
|
||||
;;
|
||||
|
||||
@@ -26,6 +26,16 @@ services:
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
cronjob:
|
||||
image: chrislusf/seaweedfs # use a remote image
|
||||
command: 'cronjob'
|
||||
environment:
|
||||
# Run re-replication every 2 minutes
|
||||
CRON_SCHEDULE: '*/2 * * * * *' # Default: '*/5 * * * * *'
|
||||
WEED_MASTER: master:9333 # Default: localhost:9333
|
||||
depends_on:
|
||||
- master
|
||||
- volume
|
||||
s3:
|
||||
image: chrislusf/seaweedfs # use a remote image
|
||||
ports:
|
||||
|
||||
@@ -33,16 +33,16 @@ var cmdBackup = &Command{
|
||||
UsageLine: "backup -dir=. -volumeId=234 -server=localhost:9333",
|
||||
Short: "incrementally backup a volume to local folder",
|
||||
Long: `Incrementally backup volume data.
|
||||
|
||||
|
||||
It is expected that you use this inside a script, to loop through
|
||||
all possible volume ids that needs to be backup to local folder.
|
||||
|
||||
|
||||
The volume id does not need to exist locally or even remotely.
|
||||
This will help to backup future new volumes.
|
||||
|
||||
|
||||
Usually backing up is just copying the .dat (and .idx) files.
|
||||
But it's tricky to incrementally copy the differences.
|
||||
|
||||
|
||||
The complexity comes when there are multiple addition, deletion and compaction.
|
||||
This tool will handle them correctly and efficiently, avoiding unnecessary data transportation.
|
||||
`,
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -43,6 +44,8 @@ func runMount(cmd *Command, args []string) bool {
|
||||
mountMode = os.ModeDir | fileInfo.Mode()
|
||||
}
|
||||
|
||||
mountName := path.Base(*mountOptions.dir)
|
||||
|
||||
// detect current user
|
||||
uid, gid := uint32(0), uint32(0)
|
||||
if u, err := user.Current(); err == nil {
|
||||
@@ -57,7 +60,7 @@ func runMount(cmd *Command, args []string) bool {
|
||||
util.SetupProfiling(*mountCpuProfile, *mountMemProfile)
|
||||
|
||||
options := []fuse.MountOption{
|
||||
fuse.VolumeName("SeaweedFS"),
|
||||
fuse.VolumeName(mountName),
|
||||
fuse.FSName("SeaweedFS"),
|
||||
fuse.Subtype("SeaweedFS"),
|
||||
fuse.NoAppleDouble(),
|
||||
|
||||
@@ -90,7 +90,7 @@ func init() {
|
||||
|
||||
serverOptions.v.port = cmdServer.Flag.Int("volume.port", 8080, "volume server http listen port")
|
||||
serverOptions.v.publicPort = cmdServer.Flag.Int("volume.port.public", 0, "volume server public port")
|
||||
serverOptions.v.indexType = cmdServer.Flag.String("volume.index", "memory", "Choose [memory|leveldb|boltdb|btree] mode for memory~performance balance.")
|
||||
serverOptions.v.indexType = cmdServer.Flag.String("volume.index", "memory", "Choose [memory|leveldb|leveldbMedium|leveldbLarge] mode for memory~performance balance.")
|
||||
serverOptions.v.fixJpgOrientation = cmdServer.Flag.Bool("volume.images.fix.orientation", false, "Adjust jpg orientation when uploading.")
|
||||
serverOptions.v.readRedirect = cmdServer.Flag.Bool("volume.read.redirect", true, "Redirect moved or non-local volumes.")
|
||||
serverOptions.v.publicUrl = cmdServer.Flag.String("volume.publicUrl", "", "publicly accessible address")
|
||||
|
||||
@@ -58,7 +58,7 @@ func init() {
|
||||
v.maxCpu = cmdVolume.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
|
||||
v.dataCenter = cmdVolume.Flag.String("dataCenter", "", "current volume server's data center name")
|
||||
v.rack = cmdVolume.Flag.String("rack", "", "current volume server's rack name")
|
||||
v.indexType = cmdVolume.Flag.String("index", "memory", "Choose [memory|leveldb|boltdb|btree] mode for memory~performance balance.")
|
||||
v.indexType = cmdVolume.Flag.String("index", "memory", "Choose [memory|leveldb|leveldbMedium|leveldbLarge] mode for memory~performance balance.")
|
||||
v.fixJpgOrientation = cmdVolume.Flag.Bool("images.fix.orientation", false, "Adjust jpg orientation when uploading.")
|
||||
v.readRedirect = cmdVolume.Flag.Bool("read.redirect", true, "Redirect moved or non-local volumes.")
|
||||
v.cpuProfile = cmdVolume.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||
@@ -142,10 +142,10 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
|
||||
switch *v.indexType {
|
||||
case "leveldb":
|
||||
volumeNeedleMapKind = storage.NeedleMapLevelDb
|
||||
case "boltdb":
|
||||
volumeNeedleMapKind = storage.NeedleMapBoltDb
|
||||
case "btree":
|
||||
volumeNeedleMapKind = storage.NeedleMapBtree
|
||||
case "leveldbMedium":
|
||||
volumeNeedleMapKind = storage.NeedleMapLevelDbMedium
|
||||
case "leveldbLarge":
|
||||
volumeNeedleMapKind = storage.NeedleMapLevelDbLarge
|
||||
}
|
||||
|
||||
masters := *v.masters
|
||||
|
||||
+2
-1
@@ -17,13 +17,13 @@ import:
|
||||
- service/s3
|
||||
- service/s3/s3iface
|
||||
- service/sqs
|
||||
- package: github.com/boltdb/bolt
|
||||
- package: github.com/chrislusf/raft
|
||||
subpackages:
|
||||
- protobuf
|
||||
- package: github.com/dgrijalva/jwt-go
|
||||
- package: github.com/disintegration/imaging
|
||||
- package: github.com/dustin/go-humanize
|
||||
- package: github.com/gabriel-vasile/mimetype
|
||||
- package: github.com/go-redis/redis
|
||||
- package: github.com/go-sql-driver/mysql
|
||||
- package: github.com/gocql/gocql
|
||||
@@ -53,6 +53,7 @@ import:
|
||||
- package: github.com/syndtr/goleveldb
|
||||
subpackages:
|
||||
- leveldb
|
||||
- leveldb/opt
|
||||
- leveldb/util
|
||||
- package: github.com/willf/bloom
|
||||
- package: gocloud.dev
|
||||
|
||||
@@ -19,7 +19,7 @@ service VolumeServer {
|
||||
|
||||
rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
|
||||
}
|
||||
rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
|
||||
rpc AllocateVolume (AllocateVolumeRequest) returns (AllocateVolumeResponse) {
|
||||
}
|
||||
|
||||
rpc VolumeSyncStatus (VolumeSyncStatusRequest) returns (VolumeSyncStatusResponse) {
|
||||
@@ -94,14 +94,14 @@ message DeleteCollectionRequest {
|
||||
message DeleteCollectionResponse {
|
||||
}
|
||||
|
||||
message AssignVolumeRequest {
|
||||
message AllocateVolumeRequest {
|
||||
uint32 volume_id = 1;
|
||||
string collection = 2;
|
||||
int64 preallocate = 3;
|
||||
string replication = 4;
|
||||
string ttl = 5;
|
||||
}
|
||||
message AssignVolumeResponse {
|
||||
message AllocateVolumeResponse {
|
||||
}
|
||||
|
||||
message VolumeSyncStatusRequest {
|
||||
@@ -171,6 +171,7 @@ message ReadVolumeFileStatusResponse {
|
||||
uint64 idx_file_size = 3;
|
||||
uint64 dat_file_timestamp = 4;
|
||||
uint64 dat_file_size = 5;
|
||||
uint64 file_count = 6;
|
||||
}
|
||||
|
||||
message DiskStatus {
|
||||
|
||||
@@ -23,8 +23,8 @@ It has these top-level messages:
|
||||
VacuumVolumeCleanupResponse
|
||||
DeleteCollectionRequest
|
||||
DeleteCollectionResponse
|
||||
AssignVolumeRequest
|
||||
AssignVolumeResponse
|
||||
AllocateVolumeRequest
|
||||
AllocateVolumeResponse
|
||||
VolumeSyncStatusRequest
|
||||
VolumeSyncStatusResponse
|
||||
VolumeFollowRequest
|
||||
@@ -282,7 +282,7 @@ func (m *DeleteCollectionResponse) String() string { return proto.Com
|
||||
func (*DeleteCollectionResponse) ProtoMessage() {}
|
||||
func (*DeleteCollectionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
|
||||
|
||||
type AssignVolumeRequest struct {
|
||||
type AllocateVolumeRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
|
||||
Preallocate int64 `protobuf:"varint,3,opt,name=preallocate" json:"preallocate,omitempty"`
|
||||
@@ -290,53 +290,53 @@ type AssignVolumeRequest struct {
|
||||
Ttl string `protobuf:"bytes,5,opt,name=ttl" json:"ttl,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AssignVolumeRequest) Reset() { *m = AssignVolumeRequest{} }
|
||||
func (m *AssignVolumeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*AssignVolumeRequest) ProtoMessage() {}
|
||||
func (*AssignVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
|
||||
func (m *AllocateVolumeRequest) Reset() { *m = AllocateVolumeRequest{} }
|
||||
func (m *AllocateVolumeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*AllocateVolumeRequest) ProtoMessage() {}
|
||||
func (*AllocateVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
|
||||
|
||||
func (m *AssignVolumeRequest) GetVolumeId() uint32 {
|
||||
func (m *AllocateVolumeRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
return m.VolumeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *AssignVolumeRequest) GetCollection() string {
|
||||
func (m *AllocateVolumeRequest) GetCollection() string {
|
||||
if m != nil {
|
||||
return m.Collection
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AssignVolumeRequest) GetPreallocate() int64 {
|
||||
func (m *AllocateVolumeRequest) GetPreallocate() int64 {
|
||||
if m != nil {
|
||||
return m.Preallocate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *AssignVolumeRequest) GetReplication() string {
|
||||
func (m *AllocateVolumeRequest) GetReplication() string {
|
||||
if m != nil {
|
||||
return m.Replication
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AssignVolumeRequest) GetTtl() string {
|
||||
func (m *AllocateVolumeRequest) GetTtl() string {
|
||||
if m != nil {
|
||||
return m.Ttl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AssignVolumeResponse struct {
|
||||
type AllocateVolumeResponse struct {
|
||||
}
|
||||
|
||||
func (m *AssignVolumeResponse) Reset() { *m = AssignVolumeResponse{} }
|
||||
func (m *AssignVolumeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*AssignVolumeResponse) ProtoMessage() {}
|
||||
func (*AssignVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
|
||||
func (m *AllocateVolumeResponse) Reset() { *m = AllocateVolumeResponse{} }
|
||||
func (m *AllocateVolumeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*AllocateVolumeResponse) ProtoMessage() {}
|
||||
func (*AllocateVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
|
||||
|
||||
type VolumeSyncStatusRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
@@ -656,6 +656,7 @@ type ReadVolumeFileStatusResponse struct {
|
||||
IdxFileSize uint64 `protobuf:"varint,3,opt,name=idx_file_size,json=idxFileSize" json:"idx_file_size,omitempty"`
|
||||
DatFileTimestamp uint64 `protobuf:"varint,4,opt,name=dat_file_timestamp,json=datFileTimestamp" json:"dat_file_timestamp,omitempty"`
|
||||
DatFileSize uint64 `protobuf:"varint,5,opt,name=dat_file_size,json=datFileSize" json:"dat_file_size,omitempty"`
|
||||
FileCount uint64 `protobuf:"varint,6,opt,name=file_count,json=fileCount" json:"file_count,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ReadVolumeFileStatusResponse) Reset() { *m = ReadVolumeFileStatusResponse{} }
|
||||
@@ -698,6 +699,13 @@ func (m *ReadVolumeFileStatusResponse) GetDatFileSize() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ReadVolumeFileStatusResponse) GetFileCount() uint64 {
|
||||
if m != nil {
|
||||
return m.FileCount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DiskStatus struct {
|
||||
Dir string `protobuf:"bytes,1,opt,name=dir" json:"dir,omitempty"`
|
||||
All uint64 `protobuf:"varint,2,opt,name=all" json:"all,omitempty"`
|
||||
@@ -817,8 +825,8 @@ func init() {
|
||||
proto.RegisterType((*VacuumVolumeCleanupResponse)(nil), "volume_server_pb.VacuumVolumeCleanupResponse")
|
||||
proto.RegisterType((*DeleteCollectionRequest)(nil), "volume_server_pb.DeleteCollectionRequest")
|
||||
proto.RegisterType((*DeleteCollectionResponse)(nil), "volume_server_pb.DeleteCollectionResponse")
|
||||
proto.RegisterType((*AssignVolumeRequest)(nil), "volume_server_pb.AssignVolumeRequest")
|
||||
proto.RegisterType((*AssignVolumeResponse)(nil), "volume_server_pb.AssignVolumeResponse")
|
||||
proto.RegisterType((*AllocateVolumeRequest)(nil), "volume_server_pb.AllocateVolumeRequest")
|
||||
proto.RegisterType((*AllocateVolumeResponse)(nil), "volume_server_pb.AllocateVolumeResponse")
|
||||
proto.RegisterType((*VolumeSyncStatusRequest)(nil), "volume_server_pb.VolumeSyncStatusRequest")
|
||||
proto.RegisterType((*VolumeSyncStatusResponse)(nil), "volume_server_pb.VolumeSyncStatusResponse")
|
||||
proto.RegisterType((*VolumeFollowRequest)(nil), "volume_server_pb.VolumeFollowRequest")
|
||||
@@ -857,7 +865,7 @@ type VolumeServerClient interface {
|
||||
VacuumVolumeCommit(ctx context.Context, in *VacuumVolumeCommitRequest, opts ...grpc.CallOption) (*VacuumVolumeCommitResponse, error)
|
||||
VacuumVolumeCleanup(ctx context.Context, in *VacuumVolumeCleanupRequest, opts ...grpc.CallOption) (*VacuumVolumeCleanupResponse, error)
|
||||
DeleteCollection(ctx context.Context, in *DeleteCollectionRequest, opts ...grpc.CallOption) (*DeleteCollectionResponse, error)
|
||||
AssignVolume(ctx context.Context, in *AssignVolumeRequest, opts ...grpc.CallOption) (*AssignVolumeResponse, error)
|
||||
AllocateVolume(ctx context.Context, in *AllocateVolumeRequest, opts ...grpc.CallOption) (*AllocateVolumeResponse, error)
|
||||
VolumeSyncStatus(ctx context.Context, in *VolumeSyncStatusRequest, opts ...grpc.CallOption) (*VolumeSyncStatusResponse, error)
|
||||
VolumeFollow(ctx context.Context, in *VolumeFollowRequest, opts ...grpc.CallOption) (VolumeServer_VolumeFollowClient, error)
|
||||
VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error)
|
||||
@@ -930,9 +938,9 @@ func (c *volumeServerClient) DeleteCollection(ctx context.Context, in *DeleteCol
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *volumeServerClient) AssignVolume(ctx context.Context, in *AssignVolumeRequest, opts ...grpc.CallOption) (*AssignVolumeResponse, error) {
|
||||
out := new(AssignVolumeResponse)
|
||||
err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/AssignVolume", in, out, c.cc, opts...)
|
||||
func (c *volumeServerClient) AllocateVolume(ctx context.Context, in *AllocateVolumeRequest, opts ...grpc.CallOption) (*AllocateVolumeResponse, error) {
|
||||
out := new(AllocateVolumeResponse)
|
||||
err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/AllocateVolume", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1067,7 +1075,7 @@ type VolumeServerServer interface {
|
||||
VacuumVolumeCommit(context.Context, *VacuumVolumeCommitRequest) (*VacuumVolumeCommitResponse, error)
|
||||
VacuumVolumeCleanup(context.Context, *VacuumVolumeCleanupRequest) (*VacuumVolumeCleanupResponse, error)
|
||||
DeleteCollection(context.Context, *DeleteCollectionRequest) (*DeleteCollectionResponse, error)
|
||||
AssignVolume(context.Context, *AssignVolumeRequest) (*AssignVolumeResponse, error)
|
||||
AllocateVolume(context.Context, *AllocateVolumeRequest) (*AllocateVolumeResponse, error)
|
||||
VolumeSyncStatus(context.Context, *VolumeSyncStatusRequest) (*VolumeSyncStatusResponse, error)
|
||||
VolumeFollow(*VolumeFollowRequest, VolumeServer_VolumeFollowServer) error
|
||||
VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error)
|
||||
@@ -1190,20 +1198,20 @@ func _VolumeServer_DeleteCollection_Handler(srv interface{}, ctx context.Context
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _VolumeServer_AssignVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AssignVolumeRequest)
|
||||
func _VolumeServer_AllocateVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AllocateVolumeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(VolumeServerServer).AssignVolume(ctx, in)
|
||||
return srv.(VolumeServerServer).AllocateVolume(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/volume_server_pb.VolumeServer/AssignVolume",
|
||||
FullMethod: "/volume_server_pb.VolumeServer/AllocateVolume",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(VolumeServerServer).AssignVolume(ctx, req.(*AssignVolumeRequest))
|
||||
return srv.(VolumeServerServer).AllocateVolume(ctx, req.(*AllocateVolumeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -1387,8 +1395,8 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
|
||||
Handler: _VolumeServer_DeleteCollection_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AssignVolume",
|
||||
Handler: _VolumeServer_AssignVolume_Handler,
|
||||
MethodName: "AllocateVolume",
|
||||
Handler: _VolumeServer_AllocateVolume_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "VolumeSyncStatus",
|
||||
@@ -1434,78 +1442,78 @@ func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 1169 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6f, 0xdc, 0x44,
|
||||
0x10, 0x8f, 0x7b, 0x77, 0xf9, 0x98, 0xbb, 0xd0, 0x63, 0x93, 0x26, 0x57, 0xb7, 0x84, 0xeb, 0x42,
|
||||
0xcb, 0xa5, 0x4d, 0x03, 0xa4, 0x02, 0x5a, 0x9e, 0x80, 0x84, 0x8a, 0x3c, 0x94, 0x4a, 0x0e, 0xad,
|
||||
0x90, 0x40, 0xb2, 0x36, 0xf6, 0x26, 0xb1, 0xe2, 0xf3, 0xba, 0xde, 0x75, 0xda, 0xf0, 0xef, 0xf0,
|
||||
0xc2, 0x3b, 0x12, 0xff, 0x0e, 0x7f, 0x08, 0x2f, 0x68, 0x3f, 0xec, 0xf8, 0xeb, 0x7a, 0xe6, 0xe3,
|
||||
0x6d, 0x3d, 0x3b, 0xf3, 0x9b, 0x99, 0xdd, 0x99, 0xd9, 0x9f, 0x0c, 0x6b, 0x17, 0x2c, 0x4c, 0xa7,
|
||||
0xd4, 0xe5, 0x34, 0xb9, 0xa0, 0xc9, 0x6e, 0x9c, 0x30, 0xc1, 0xd0, 0xb0, 0x24, 0x74, 0xe3, 0x63,
|
||||
0xfc, 0x31, 0xa0, 0x6f, 0x88, 0xf0, 0xce, 0x0e, 0x68, 0x48, 0x05, 0x75, 0xe8, 0xab, 0x94, 0x72,
|
||||
0x81, 0x6e, 0xc2, 0xf2, 0x49, 0x10, 0x52, 0x37, 0xf0, 0xf9, 0xc8, 0x1a, 0x77, 0x26, 0x2b, 0xce,
|
||||
0x92, 0xfc, 0x3e, 0xf4, 0x39, 0x7e, 0x0e, 0x6b, 0x25, 0x03, 0x1e, 0xb3, 0x88, 0x53, 0xf4, 0x18,
|
||||
0x96, 0x12, 0xca, 0xd3, 0x50, 0x68, 0x83, 0xfe, 0xde, 0xd6, 0x6e, 0xd5, 0xd7, 0x6e, 0x6e, 0x92,
|
||||
0x86, 0xc2, 0xc9, 0xd4, 0x71, 0x00, 0x83, 0xe2, 0x06, 0xda, 0x84, 0x25, 0xe3, 0x7b, 0x64, 0x8d,
|
||||
0xad, 0xc9, 0x8a, 0xb3, 0xa8, 0x5d, 0xa3, 0x0d, 0x58, 0xe4, 0x82, 0x88, 0x94, 0x8f, 0xae, 0x8d,
|
||||
0xad, 0x49, 0xcf, 0x31, 0x5f, 0x68, 0x1d, 0x7a, 0x34, 0x49, 0x58, 0x32, 0xea, 0x28, 0x75, 0xfd,
|
||||
0x81, 0x10, 0x74, 0x79,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0, 0x34, 0xd2, 0x6e, 0x5b, 0x1d, 0x7f, 0xd9, 0xe1, 0xb5, 0xaa, 0xc3, 0xea, 0xf5,
|
||||
0x74, 0x6a, 0xd7, 0x23, 0x35, 0x12, 0x1a, 0x87, 0x81, 0x47, 0x14, 0x44, 0x57, 0x41, 0x14, 0x45,
|
||||
0x68, 0x08, 0x1d, 0x21, 0xc2, 0x51, 0x4f, 0xed, 0xc8, 0x25, 0xde, 0x80, 0xf5, 0x72, 0xa4, 0x26,
|
||||
0x85, 0xcf, 0x61, 0x53, 0x4b, 0x8e, 0x2e, 0x23, 0xef, 0x48, 0x75, 0x42, 0xab, 0x03, 0xff, 0xcb,
|
||||
0x82, 0x51, 0xdd, 0xd0, 0x54, 0xf0, 0x7f, 0xcd, 0xff, 0x9f, 0x66, 0x87, 0xde, 0x87, 0xbe, 0x20,
|
||||
0x41, 0xe8, 0xb2, 0x93, 0x13, 0x4e, 0xc5, 0x68, 0x71, 0x6c, 0x4d, 0xba, 0x0e, 0x48, 0xd1, 0x73,
|
||||
0x25, 0x41, 0xdb, 0x30, 0xf4, 0x74, 0x15, 0xbb, 0x09, 0xbd, 0x08, 0xb8, 0x44, 0x5e, 0x52, 0x81,
|
||||
0x5d, 0xf7, 0xb2, 0xea, 0xd6, 0x62, 0x84, 0x61, 0x35, 0xf0, 0xdf, 0xb8, 0x6a, 0x78, 0xa8, 0xd6,
|
||||
0x5f, 0x56, 0x68, 0xfd, 0xc0, 0x7f, 0xf3, 0x34, 0x08, 0xe9, 0x91, 0x9c, 0x00, 0xdf, 0xc1, 0x9a,
|
||||
0x4e, 0xfe, 0x29, 0x0b, 0x43, 0xf6, 0xba, 0xd5, 0xbd, 0xaf, 0x43, 0x8f, 0x07, 0x91, 0xa7, 0x1b,
|
||||
0xae, 0xeb, 0xe8, 0x0f, 0xfc, 0x04, 0xd6, 0xcb, 0x48, 0xe6, 0x08, 0xef, 0xc0, 0x40, 0x45, 0xe0,
|
||||
0xb1, 0x48, 0xd0,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||
0xc5, 0xc5, 0xec, 0x07, 0xad, 0x74, 0x73, 0x7f, 0x02, 0xd6, 0x1a, 0xe8, 0x0f, 0xda, 0x99, 0x83,
|
||||
0x52, 0xa2, 0x60, 0xf6, 0xc3, 0x96, 0xda, 0xb9, 0xd7, 0x57, 0x80, 0xea, 0xdc, 0x08, 0x3d, 0x98,
|
||||
0x0b, 0x73, 0xc5, 0xbd, 0xec, 0x9d, 0x76, 0xca, 0x33, 0x13, 0xd5, 0xac, 0x69, 0x6e, 0xa2, 0x25,
|
||||
0x5e, 0x36, 0x37, 0xd1, 0x0a, 0x15, 0x5b, 0x40, 0xe7, 0x30, 0xac, 0x32, 0x2a, 0xb4, 0x3d, 0x8b,
|
||||
0xe6, 0xd7, 0x08, 0x9b, 0x7d, 0xbf, 0x8d, 0x6a, 0xee, 0xcc, 0x85, 0x41, 0x91, 0xf7, 0xa0, 0x86,
|
||||
0xa2, 0x6b, 0x60, 0x70, 0xf6, 0xbd, 0x79, 0x6a, 0xc5, 0x6c, 0xaa, 0x3c, 0xa8, 0x29, 0x9b, 0x19,
|
||||
0x24, 0xab, 0x29, 0x9b, 0x59, 0xb4, 0x0a, 0x2f, 0x20, 0x92, 0xf5, 0x9d, 0x66, 0x0b, 0x4d, 0xd9,
|
||||
0x34, 0xf0, 0x92, 0xa6, 0x6c, 0x9a, 0x48, 0x07, 0x5e, 0xf8, 0xc4, 0x92, 0xad, 0x5c, 0xa0, 0x08,
|
||||
0x4d, 0xad, 0x5c, 0x27, 0x1d, 0xf6, 0xdd, 0x39, 0x5a, 0x79, 0x02, 0xc7, 0xb0, 0x5a, 0x22, 0x0d,
|
||||
0x68, 0x66, 0x68, 0x65, 0x2a, 0x62, 0x7f, 0x34, 0x57, 0xaf, 0x78, 0xe5, 0x45, 0x2e, 0x31, 0xfb,
|
||||
0x90, 0xca, 0xe3, 0xe8, 0xde, 0x3c, 0xb5, 0xdc, 0xc1, 0x19, 0x5c, 0xaf, 0x3c, 0xef, 0x68, 0x52,
|
||||
0x37, 0x6e, 0xa6, 0x2d, 0xf6, 0x76, 0x0b, 0xcd, 0xdc, 0xd3, 0x6b, 0x58, 0x6f, 0x7a, 0x49, 0xd1,
|
||||
0xc3, 0x26, 0x90, 0x99, 0xcf, 0xb5, 0xbd, 0xdb, 0x56, 0x3d, 0x77, 0xfc, 0x02, 0x96, 0x33, 0xda,
|
||||
0x80, 0xee, 0xd4, 0xad, 0x2b, 0x14, 0xc6, 0xc6, 0x6f, 0x53, 0xb9, 0x2a, 0xae, 0xe3, 0x45, 0xf5,
|
||||
0xff, 0xe0, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x13, 0x86, 0xf1, 0x0f, 0x56, 0x10, 0x00,
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0x4b, 0x73, 0xdc, 0x44,
|
||||
0x10, 0xb6, 0xb2, 0xbb, 0x7e, 0xf4, 0xae, 0xe3, 0x65, 0xfc, 0x92, 0xe5, 0x60, 0x36, 0x03, 0x4e,
|
||||
0xd6, 0x89, 0x63, 0xc0, 0x29, 0x20, 0xe1, 0x04, 0xd8, 0xa4, 0xf0, 0x21, 0xa4, 0x4a, 0x26, 0x29,
|
||||
0xaa, 0xa0, 0x4a, 0x35, 0x96, 0x66, 0x6d, 0x95, 0xb5, 0x1a, 0x45, 0x1a, 0x39, 0x31, 0x7f, 0x87,
|
||||
0x1b, 0x57, 0xae, 0xfc, 0x17, 0x7e, 0x08, 0x17, 0x6a, 0x1e, 0x92, 0x57, 0x8f, 0xcd, 0x8a, 0xc7,
|
||||
0x6d, 0xd4, 0xd3, 0xfd, 0x75, 0xf7, 0x4c, 0x77, 0xcf, 0x57, 0x82, 0xd5, 0x2b, 0x16, 0xa4, 0x63,
|
||||
0xea, 0x24, 0x34, 0xbe, 0xa2, 0xf1, 0x41, 0x14, 0x33, 0xce, 0x50, 0xbf, 0x20, 0x74, 0xa2, 0x33,
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, 0xfe, 0x97, 0x01, 0x66,
|
||||
0xd5, 0x50, 0x57, 0xf1, 0x7f, 0x3d, 0x81, 0x7f, 0x9a, 0x1f, 0xfa, 0x00, 0xba, 0x9c, 0xf8, 0x81,
|
||||
0xc3, 0x46, 0xa3, 0x84, 0x72, 0x73, 0x7e, 0x60, 0x0c, 0xdb, 0x36, 0x08, 0xd1, 0x0b, 0x29, 0x41,
|
||||
0x7b, 0xd0, 0x77, 0x55, 0x25, 0x3b, 0x31, 0xbd, 0xf2, 0x13, 0x81, 0xbc, 0x20, 0x03, 0x5b, 0x71,
|
||||
0xb3, 0x0a, 0x57, 0x62, 0x84, 0x61, 0xd9, 0xf7, 0xde, 0x3a, 0x72, 0x80, 0xc8, 0xf6, 0x5f, 0x94,
|
||||
0x68, 0x5d, 0xdf, 0x7b, 0xfb, 0xcc, 0x0f, 0xe8, 0xa9, 0x98, 0x02, 0xdf, 0xc1, 0xaa, 0x4a, 0xfe,
|
||||
0x19, 0x0b, 0x02, 0xf6, 0xa6, 0xd1, 0xcd, 0xaf, 0x41, 0x27, 0xf1, 0x43, 0x57, 0x35, 0x5d, 0xdb,
|
||||
0x56, 0x1f, 0xf8, 0x29, 0xac, 0x15, 0x91, 0xf4, 0x11, 0xde, 0x85, 0x9e, 0x8c, 0xc0, 0x65, 0x21,
|
||||
0xa7, 0x21, 0x97, 0x68, 0x3d, 0xbb, 0x2b, 0x64, 0x47, 0x4a, 0x84, 0x3f, 0x05, 0xa4, 0x4c, 0x9f,
|
||||
0xb3, 0x34, 0x6c, 0xd6, 0x83, 0xeb, 0x59, 0xdc, 0xda, 0x44, 0x17, 0xc1, 0xe3, 0x2c, 0x88, 0x97,
|
||||
0xe1, 0xb8, 0x31, 0xd6, 0x26, 0xac, 0x97, 0x8c, 0x34, 0xda, 0x61, 0xe6, 0xa4, 0xf8, 0x20, 0xbc,
|
||||
0x13, 0x6c, 0x23, 0x8b, 0xa0, 0xf8, 0x26, 0xe0, 0xdf, 0x0d, 0xd8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7c, 0x88, 0xa5, 0x90, 0x90, 0x20, 0xd0, 0x41,
|
||||
0x8b, 0xa5, 0xa0, 0x12, 0x69, 0x42, 0x3d, 0x1d, 0x9e, 0x5c, 0x0b, 0xd9, 0x28, 0xa6, 0x54, 0x47,
|
||||
0x22, 0xd7, 0xf8, 0x57, 0x03, 0x96, 0x9e, 0xd3, 0xb1, 0x46, 0xde, 0x01, 0x38, 0x67, 0x31, 0x4b,
|
||||
0xb9, 0x1f, 0xd2, 0x44, 0x3a, 0xe8, 0xd8, 0x13, 0x92, 0x7f, 0xef, 0x47, 0x52, 0x1b, 0x1a, 0x8c,
|
||||
0x74, 0x72, 0x72, 0x2d, 0x64, 0x17, 0x94, 0x44, 0x7a, 0x7a, 0xca, 0xb5, 0x1c, 0x5a, 0x9c, 0xb8,
|
||||
0x97, 0x72, 0x58, 0x8a, 0xa1, 0x25, 0x3e, 0x0e, 0xff, 0xe8, 0x41, 0x4f, 0x0f, 0x7f, 0xc9, 0xcc,
|
||||
0xd0, 0xcf, 0xd0, 0x9d, 0x60, 0x74, 0xe8, 0xa3, 0x2a, 0x71, 0xab, 0x32, 0x44, 0x6b, 0x77, 0x86,
|
||||
0x96, 0xee, 0x98, 0x39, 0x14, 0xc2, 0x7b, 0x15, 0xc6, 0x84, 0x1e, 0x54, 0xad, 0xa7, 0xf1, 0x31,
|
||||
0xeb, 0x61, 0x23, 0xdd, 0xdc, 0x1f, 0x87, 0xd5, 0x1a, 0x0a, 0x84, 0xf6, 0x67, 0xa0, 0x14, 0x68,
|
||||
0x98, 0xf5, 0xa8, 0xa1, 0x76, 0xee, 0xf5, 0x35, 0xa0, 0x2a, 0x3f, 0x42, 0x0f, 0x67, 0xc2, 0xdc,
|
||||
0xf0, 0x2f, 0x6b, 0xbf, 0x99, 0xf2, 0xd4, 0x44, 0x15, 0x73, 0x9a, 0x99, 0x68, 0x81, 0x9b, 0xcd,
|
||||
0x4c, 0xb4, 0x44, 0xc7, 0xe6, 0xd0, 0x25, 0x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 0x00, 0x00, 0xff, 0xff, 0x6a, 0xdf, 0xd7, 0x82, 0x60, 0x10, 0x00,
|
||||
0x00,
|
||||
}
|
||||
@@ -24,9 +24,9 @@ func (vs *VolumeServer) DeleteCollection(ctx context.Context, req *volume_server
|
||||
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) AssignVolume(ctx context.Context, req *volume_server_pb.AssignVolumeRequest) (*volume_server_pb.AssignVolumeResponse, error) {
|
||||
func (vs *VolumeServer) AllocateVolume(ctx context.Context, req *volume_server_pb.AllocateVolumeRequest) (*volume_server_pb.AllocateVolumeResponse, error) {
|
||||
|
||||
resp := &volume_server_pb.AssignVolumeResponse{}
|
||||
resp := &volume_server_pb.AllocateVolumeResponse{}
|
||||
|
||||
err := vs.store.AddVolume(
|
||||
storage.VolumeId(req.VolumeId),
|
||||
|
||||
@@ -3,6 +3,7 @@ package weed_server
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage"
|
||||
@@ -34,22 +35,28 @@ func (vs *VolumeServer) ReplicateVolume(ctx context.Context, req *volume_server_
|
||||
// send .idx file
|
||||
// send .dat file
|
||||
// confirm size and timestamp
|
||||
|
||||
var volFileInfoResp *volume_server_pb.ReadVolumeFileStatusResponse
|
||||
datFileName := volumeFileName + ".dat"
|
||||
idxFileName := volumeFileName + ".idx"
|
||||
err := operation.WithVolumeServerClient(req.SourceDataNode, vs.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
|
||||
|
||||
// TODO read file sizes before copying
|
||||
client.ReadVolumeFileStatus(ctx, &volume_server_pb.ReadVolumeFileStatusRequest{})
|
||||
var err error
|
||||
volFileInfoResp, err = client.ReadVolumeFileStatus(ctx,
|
||||
&volume_server_pb.ReadVolumeFileStatusRequest{
|
||||
VolumeId: req.VolumeId,
|
||||
})
|
||||
if nil != err {
|
||||
return fmt.Errorf("read volume file status failed, %v", err)
|
||||
}
|
||||
|
||||
copyFileClient, err := client.CopyFile(ctx, &volume_server_pb.CopyFileRequest{
|
||||
VolumeId: req.VolumeId,
|
||||
IsIdxFile: true,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to start copying volume %d idx file: %v", req.VolumeId, err)
|
||||
}
|
||||
|
||||
err = writeToFile(copyFileClient, volumeFileName+".idx")
|
||||
err = writeToFile(copyFileClient, idxFileName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to copy volume %d idx file: %v", req.VolumeId, err)
|
||||
}
|
||||
@@ -58,24 +65,26 @@ func (vs *VolumeServer) ReplicateVolume(ctx context.Context, req *volume_server_
|
||||
VolumeId: req.VolumeId,
|
||||
IsDatFile: true,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to start copying volume %d dat file: %v", req.VolumeId, err)
|
||||
}
|
||||
|
||||
err = writeToFile(copyFileClient, volumeFileName+".dat")
|
||||
err = writeToFile(copyFileClient, datFileName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to copy volume %d dat file: %v", req.VolumeId, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
os.Remove(idxFileName)
|
||||
os.Remove(datFileName)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: check the timestamp and size
|
||||
if err = checkCopyFiles(volFileInfoResp, idxFileName, datFileName); err != nil { // added by panyc16
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// mount the volume
|
||||
err = vs.store.MountVolume(storage.VolumeId(req.VolumeId))
|
||||
@@ -84,11 +93,35 @@ func (vs *VolumeServer) ReplicateVolume(ctx context.Context, req *volume_server_
|
||||
}
|
||||
|
||||
return &volume_server_pb.ReplicateVolumeResponse{}, err
|
||||
}
|
||||
|
||||
/**
|
||||
only check the the differ of the file size
|
||||
todo: maybe should check the received count and deleted count of the volume
|
||||
*/
|
||||
func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponse, idxFileName, datFileName string) error {
|
||||
stat, err := os.Stat(idxFileName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get idx file info failed, %v", err)
|
||||
}
|
||||
if originFileInf.IdxFileSize != uint64(stat.Size()) {
|
||||
return fmt.Errorf("the idx file size [%v] is not same as origin file size [%v]",
|
||||
stat.Size(), originFileInf.IdxFileSize)
|
||||
}
|
||||
|
||||
stat, err = os.Stat(datFileName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get dat file info failed, %v", err)
|
||||
}
|
||||
if originFileInf.DatFileSize != uint64(stat.Size()) {
|
||||
return fmt.Errorf("the dat file size [%v] is not same as origin file size [%v]",
|
||||
stat.Size(), originFileInf.DatFileSize)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName string) error {
|
||||
println("writing to ", fileName)
|
||||
glog.V(4).Infof("writing to %s", fileName)
|
||||
dst, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -110,6 +143,17 @@ func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName s
|
||||
|
||||
func (vs *VolumeServer) ReadVolumeFileStatus(ctx context.Context, req *volume_server_pb.ReadVolumeFileStatusRequest) (*volume_server_pb.ReadVolumeFileStatusResponse, error) {
|
||||
resp := &volume_server_pb.ReadVolumeFileStatusResponse{}
|
||||
v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
|
||||
if v == nil {
|
||||
return nil, fmt.Errorf("not found volume id %d", req.VolumeId)
|
||||
}
|
||||
|
||||
resp.VolumeId = req.VolumeId
|
||||
resp.DatFileSize = v.DataFileSize()
|
||||
resp.IdxFileSize = v.IndexFileSize()
|
||||
resp.DatFileTimestamp = v.LastModifiedTime()
|
||||
resp.IdxFileTimestamp = v.LastModifiedTime()
|
||||
resp.FileCount = v.FileCount()
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ import (
|
||||
type NeedleMapType int
|
||||
|
||||
const (
|
||||
NeedleMapInMemory NeedleMapType = iota
|
||||
NeedleMapLevelDb
|
||||
NeedleMapBoltDb
|
||||
NeedleMapBtree
|
||||
NeedleMapInMemory NeedleMapType = iota
|
||||
NeedleMapLevelDb // small memory footprint, 4MB total, 1 write buffer, 3 block buffer
|
||||
NeedleMapLevelDbMedium // medium memory footprint, 8MB total, 3 write buffer, 5 block buffer
|
||||
NeedleMapLevelDbLarge // large memory footprint, 12MB total, 4write buffer, 8 block buffer
|
||||
)
|
||||
|
||||
type NeedleMapper interface {
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
|
||||
"errors"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
type BoltDbNeedleMap struct {
|
||||
dbFileName string
|
||||
db *bolt.DB
|
||||
baseNeedleMapper
|
||||
}
|
||||
|
||||
var boltdbBucket = []byte("weed")
|
||||
|
||||
var NotFound = errors.New("not found")
|
||||
|
||||
func NewBoltDbNeedleMap(dbFileName string, indexFile *os.File) (m *BoltDbNeedleMap, err error) {
|
||||
m = &BoltDbNeedleMap{dbFileName: dbFileName}
|
||||
m.indexFile = indexFile
|
||||
if !isBoltDbFresh(dbFileName, indexFile) {
|
||||
glog.V(0).Infof("Start to Generate %s from %s", dbFileName, indexFile.Name())
|
||||
generateBoltDbFile(dbFileName, indexFile)
|
||||
glog.V(0).Infof("Finished Generating %s from %s", dbFileName, indexFile.Name())
|
||||
}
|
||||
glog.V(1).Infof("Opening %s...", dbFileName)
|
||||
if m.db, err = bolt.Open(dbFileName, 0644, nil); err != nil {
|
||||
return
|
||||
}
|
||||
glog.V(1).Infof("Loading %s...", indexFile.Name())
|
||||
mm, indexLoadError := newNeedleMapMetricFromIndexFile(indexFile)
|
||||
if indexLoadError != nil {
|
||||
return nil, indexLoadError
|
||||
}
|
||||
m.mapMetric = *mm
|
||||
return
|
||||
}
|
||||
|
||||
func isBoltDbFresh(dbFileName string, indexFile *os.File) bool {
|
||||
// normally we always write to index file first
|
||||
dbLogFile, err := os.Open(dbFileName)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer dbLogFile.Close()
|
||||
dbStat, dbStatErr := dbLogFile.Stat()
|
||||
indexStat, indexStatErr := indexFile.Stat()
|
||||
if dbStatErr != nil || indexStatErr != nil {
|
||||
glog.V(0).Infof("Can not stat file: %v and %v", dbStatErr, indexStatErr)
|
||||
return false
|
||||
}
|
||||
|
||||
return dbStat.ModTime().After(indexStat.ModTime())
|
||||
}
|
||||
|
||||
func generateBoltDbFile(dbFileName string, indexFile *os.File) error {
|
||||
db, err := bolt.Open(dbFileName, 0644, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer db.Close()
|
||||
return WalkIndexFile(indexFile, func(key NeedleId, offset Offset, size uint32) error {
|
||||
if !offset.IsZero() && size != TombstoneFileSize {
|
||||
boltDbWrite(db, key, offset, size)
|
||||
} else {
|
||||
boltDbDelete(db, key)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (m *BoltDbNeedleMap) Get(key NeedleId) (element *needle.NeedleValue, ok bool) {
|
||||
var offset Offset
|
||||
var size uint32
|
||||
bytes := make([]byte, NeedleIdSize)
|
||||
NeedleIdToBytes(bytes, key)
|
||||
err := m.db.View(func(tx *bolt.Tx) error {
|
||||
bucket := tx.Bucket(boltdbBucket)
|
||||
if bucket == nil {
|
||||
return fmt.Errorf("Bucket %q not found!", boltdbBucket)
|
||||
}
|
||||
|
||||
data := bucket.Get(bytes)
|
||||
|
||||
if len(data) == 0 {
|
||||
return NotFound
|
||||
}
|
||||
|
||||
if len(data) != OffsetSize+SizeSize {
|
||||
glog.V(0).Infof("key:%v has wrong data length: %d", key, len(data))
|
||||
return fmt.Errorf("key:%v has wrong data length: %d", key, len(data))
|
||||
}
|
||||
|
||||
offset = BytesToOffset(data[0:OffsetSize])
|
||||
size = util.BytesToUint32(data[OffsetSize : OffsetSize+SizeSize])
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, false
|
||||
}
|
||||
return &needle.NeedleValue{Key: key, Offset: offset, Size: size}, true
|
||||
}
|
||||
|
||||
func (m *BoltDbNeedleMap) Put(key NeedleId, offset Offset, size uint32) error {
|
||||
var oldSize uint32
|
||||
if oldNeedle, ok := m.Get(key); ok {
|
||||
oldSize = oldNeedle.Size
|
||||
}
|
||||
m.logPut(key, oldSize, size)
|
||||
// write to index file first
|
||||
if err := m.appendToIndexFile(key, offset, size); err != nil {
|
||||
return fmt.Errorf("cannot write to indexfile %s: %v", m.indexFile.Name(), err)
|
||||
}
|
||||
return boltDbWrite(m.db, key, offset, size)
|
||||
}
|
||||
|
||||
func boltDbWrite(db *bolt.DB,
|
||||
key NeedleId, offset Offset, size uint32) error {
|
||||
|
||||
bytes := make([]byte, NeedleIdSize+OffsetSize+SizeSize)
|
||||
NeedleIdToBytes(bytes[0:NeedleIdSize], key)
|
||||
OffsetToBytes(bytes[NeedleIdSize:NeedleIdSize+OffsetSize], offset)
|
||||
util.Uint32toBytes(bytes[NeedleIdSize+OffsetSize:NeedleIdSize+OffsetSize+SizeSize], size)
|
||||
|
||||
return db.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(boltdbBucket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = bucket.Put(bytes[0:NeedleIdSize], bytes[NeedleIdSize:NeedleIdSize+OffsetSize+SizeSize])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
func boltDbDelete(db *bolt.DB, key NeedleId) error {
|
||||
bytes := make([]byte, NeedleIdSize)
|
||||
NeedleIdToBytes(bytes, key)
|
||||
return db.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists(boltdbBucket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = bucket.Delete(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (m *BoltDbNeedleMap) Delete(key NeedleId, offset Offset) error {
|
||||
if oldNeedle, ok := m.Get(key); ok {
|
||||
m.logDelete(oldNeedle.Size)
|
||||
}
|
||||
// write to index file first
|
||||
if err := m.appendToIndexFile(key, offset, TombstoneFileSize); err != nil {
|
||||
return err
|
||||
}
|
||||
return boltDbDelete(m.db, key)
|
||||
}
|
||||
|
||||
func (m *BoltDbNeedleMap) Close() {
|
||||
m.indexFile.Close()
|
||||
m.db.Close()
|
||||
}
|
||||
|
||||
func (m *BoltDbNeedleMap) Destroy() error {
|
||||
m.Close()
|
||||
os.Remove(m.indexFile.Name())
|
||||
return os.Remove(m.dbFileName)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -18,7 +19,7 @@ type LevelDbNeedleMap struct {
|
||||
baseNeedleMapper
|
||||
}
|
||||
|
||||
func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File) (m *LevelDbNeedleMap, err error) {
|
||||
func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File, opts *opt.Options) (m *LevelDbNeedleMap, err error) {
|
||||
m = &LevelDbNeedleMap{dbFileName: dbFileName}
|
||||
m.indexFile = indexFile
|
||||
if !isLevelDbFresh(dbFileName, indexFile) {
|
||||
@@ -27,7 +28,8 @@ func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File) (m *LevelDbNeedl
|
||||
glog.V(0).Infof("Finished Generating %s from %s", dbFileName, indexFile.Name())
|
||||
}
|
||||
glog.V(1).Infof("Opening %s...", dbFileName)
|
||||
if m.db, err = leveldb.OpenFile(dbFileName, nil); err != nil {
|
||||
|
||||
if m.db, err = leveldb.OpenFile(dbFileName, opts); err != nil {
|
||||
return
|
||||
}
|
||||
glog.V(1).Infof("Loading %s...", indexFile.Name())
|
||||
|
||||
@@ -79,6 +79,25 @@ func (v *Volume) Size() int64 {
|
||||
return 0 // -1 causes integer overflow and the volume to become unwritable.
|
||||
}
|
||||
|
||||
func (v *Volume)IndexFileSize() uint64 {
|
||||
return v.nm.IndexFileSize()
|
||||
}
|
||||
|
||||
func (v *Volume)DataFileSize() uint64 {
|
||||
return uint64(v.Size())
|
||||
}
|
||||
|
||||
/**
|
||||
unix time in seconds
|
||||
*/
|
||||
func (v *Volume)LastModifiedTime() uint64 {
|
||||
return v.lastModifiedTime
|
||||
}
|
||||
|
||||
func (v *Volume)FileCount() uint64 {
|
||||
return uint64(v.nm.FileCount())
|
||||
}
|
||||
|
||||
// Close cleanly shuts down this volume
|
||||
func (v *Volume) Close() {
|
||||
v.dataFileAccessLock.Lock()
|
||||
|
||||
@@ -2,6 +2,7 @@ package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -82,18 +83,30 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
||||
}
|
||||
case NeedleMapLevelDb:
|
||||
glog.V(0).Infoln("loading leveldb", fileName+".ldb")
|
||||
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile); e != nil {
|
||||
opts := &opt.Options{
|
||||
BlockCacheCapacity: 2 * 1024 * 1024, // default value is 8MiB
|
||||
WriteBuffer: 1 * 1024 * 1024, // default value is 4MiB
|
||||
}
|
||||
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil {
|
||||
glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e)
|
||||
}
|
||||
case NeedleMapBoltDb:
|
||||
glog.V(0).Infoln("loading boltdb", fileName+".bdb")
|
||||
if v.nm, e = NewBoltDbNeedleMap(fileName+".bdb", indexFile); e != nil {
|
||||
glog.V(0).Infof("loading boltdb %s error: %v", fileName+".bdb", e)
|
||||
case NeedleMapLevelDbMedium:
|
||||
glog.V(0).Infoln("loading leveldb medium", fileName+".ldb")
|
||||
opts := &opt.Options{
|
||||
BlockCacheCapacity: 4 * 1024 * 1024, // default value is 8MiB
|
||||
WriteBuffer: 2 * 1024 * 1024, // default value is 4MiB
|
||||
}
|
||||
case NeedleMapBtree:
|
||||
glog.V(0).Infoln("loading index", fileName+".idx", "to btree readonly", v.readOnly)
|
||||
if v.nm, e = LoadBtreeNeedleMap(indexFile); e != nil {
|
||||
glog.V(0).Infof("loading index %s to btree error: %v", fileName+".idx", e)
|
||||
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil {
|
||||
glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e)
|
||||
}
|
||||
case NeedleMapLevelDbLarge:
|
||||
glog.V(0).Infoln("loading leveldb large", fileName+".ldb")
|
||||
opts := &opt.Options{
|
||||
BlockCacheCapacity: 8 * 1024 * 1024, // default value is 8MiB
|
||||
WriteBuffer: 4 * 1024 * 1024, // default value is 4MiB
|
||||
}
|
||||
if v.nm, e = NewLevelDbNeedleMap(fileName+".ldb", indexFile, opts); e != nil {
|
||||
glog.V(0).Infof("loading leveldb %s error: %v", fileName+".ldb", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func AllocateVolume(dn *DataNode, grpcDialOption grpc.DialOption, vid storage.Vo
|
||||
|
||||
return operation.WithVolumeServerClient(dn.Url(), grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
|
||||
|
||||
_, deleteErr := client.AssignVolume(context.Background(), &volume_server_pb.AssignVolumeRequest{
|
||||
_, deleteErr := client.AllocateVolume(context.Background(), &volume_server_pb.AllocateVolumeRequest{
|
||||
VolumeId: uint32(vid),
|
||||
Collection: option.Collection,
|
||||
Replication: option.ReplicaPlacement.String(),
|
||||
|
||||
@@ -5,5 +5,5 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 29)
|
||||
VERSION = fmt.Sprintf("%s %d.%d", sizeLimit, 1, 30)
|
||||
)
|
||||
@@ -19,7 +19,7 @@ var (
|
||||
grpcClientsLock sync.Mutex
|
||||
)
|
||||
|
||||
func init(){
|
||||
func init() {
|
||||
http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 100
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ func WithCachedGrpcClient(ctx context.Context, fn func(*grpc.ClientConn) error,
|
||||
grpcClientsLock.Lock()
|
||||
delete(grpcClients, address)
|
||||
grpcClientsLock.Unlock()
|
||||
grpcConnection.Close()
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user