Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

weed volume: add grpc operation to relicate a volume to local

Chris Lu95e0520182ee
diff --git a/weed/operation/sync_volume.go b/weed/operation/sync_volume.go
index c979254f43..6af2404c09 100644
--- a/weed/operation/sync_volume.go
+++ b/weed/operation/sync_volume.go
@@ -15,7 +15,7 @@ func GetVolumeSyncStatus(server string, grpcDialOption grpc.DialOption, vid uint
WithVolumeServerClient(server, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
resp, err = client.VolumeSyncStatus(context.Background(), &volume_server_pb.VolumeSyncStatusRequest{
- VolumdId: vid,
+ VolumeId: vid,
})
return nil
})
@@ -27,7 +27,7 @@ func GetVolumeIdxEntries(server string, grpcDialOption grpc.DialOption, vid uint
return WithVolumeServerClient(server, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
stream, err := client.VolumeSyncIndex(context.Background(), &volume_server_pb.VolumeSyncIndexRequest{
- VolumdId: vid,
+ VolumeId: vid,
})
if err != nil {
return err
diff --git a/weed/pb/volume_server.proto b/weed/pb/volume_server.proto
index 8ab67a1bf9..93db5b9813 100644
--- a/weed/pb/volume_server.proto
+++ b/weed/pb/volume_server.proto
@@ -36,7 +36,12 @@ service VolumeServer {
rpc VolumeDelete (VolumeDeleteRequest) returns (VolumeDeleteResponse) {
}
- // rpc VolumeUiPage (VolumeUiPageRequest) returns (VolumeUiPageResponse) {}
+ rpc ReplicateVolume (ReplicateVolumeRequest) returns (ReplicateVolumeResponse) {
+ }
+ rpc ReadVolumeFileStatus (ReadVolumeFileStatusRequest) returns (ReadVolumeFileStatusResponse) {
+ }
+ rpc CopyFile (CopyFileRequest) returns (stream CopyFileResponse) {
+ }
}
@@ -60,27 +65,27 @@ message Empty {
}
message VacuumVolumeCheckRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VacuumVolumeCheckResponse {
double garbage_ratio = 1;
}
message VacuumVolumeCompactRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
int64 preallocate = 2;
}
message VacuumVolumeCompactResponse {
}
message VacuumVolumeCommitRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VacuumVolumeCommitResponse {
}
message VacuumVolumeCleanupRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VacuumVolumeCleanupResponse {
}
@@ -92,7 +97,7 @@ message DeleteCollectionResponse {
}
message AssignVolumeRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
string collection = 2;
int64 preallocate = 3;
string replication = 4;
@@ -102,10 +107,10 @@ message AssignVolumeResponse {
}
message VolumeSyncStatusRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VolumeSyncStatusResponse {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
string collection = 2;
string replication = 4;
string ttl = 5;
@@ -115,14 +120,14 @@ message VolumeSyncStatusResponse {
}
message VolumeSyncIndexRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VolumeSyncIndexResponse {
bytes index_file_content = 1;
}
message VolumeSyncDataRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
uint32 revision = 2;
uint32 offset = 3;
uint32 size = 4;
@@ -133,26 +138,51 @@ message VolumeSyncDataResponse {
}
message VolumeMountRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VolumeMountResponse {
}
message VolumeUnmountRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VolumeUnmountResponse {
}
message VolumeDeleteRequest {
- uint32 volumd_id = 1;
+ uint32 volume_id = 1;
}
message VolumeDeleteResponse {
}
-message VolumeUiPageRequest {
+message ReplicateVolumeRequest {
+ uint32 volume_id = 1;
+ string collection = 2;
+ string replication = 3;
+ string ttl = 4;
+ string source_data_node = 5;
+}
+message ReplicateVolumeResponse {
+}
+
+message CopyFileRequest {
+ uint32 volume_id = 1;
+ bool is_idx_file = 2;
+ bool is_dat_file = 3;
+}
+message CopyFileResponse {
+ bytes file_content = 1;
+}
+
+message ReadVolumeFileStatusRequest {
+ uint32 volume_id = 1;
}
-message VolumeUiPageResponse {
+message ReadVolumeFileStatusResponse {
+ uint32 volume_id = 1;
+ uint64 idx_file_timestamp = 2;
+ uint64 idx_file_size = 3;
+ uint64 dat_file_timestamp = 4;
+ uint64 dat_file_size = 5;
}
message DiskStatus {
diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go
index fa700e2e53..d84a5b0990 100644
--- a/weed/pb/volume_server_pb/volume_server.pb.go
+++ b/weed/pb/volume_server_pb/volume_server.pb.go
@@ -37,8 +37,12 @@ It has these top-level messages:
VolumeUnmountResponse
VolumeDeleteRequest
VolumeDeleteResponse
- VolumeUiPageRequest
- VolumeUiPageResponse
+ ReplicateVolumeRequest
+ ReplicateVolumeResponse
+ CopyFileRequest
+ CopyFileResponse
+ ReadVolumeFileStatusRequest
+ ReadVolumeFileStatusResponse
DiskStatus
MemStatus
*/
@@ -145,7 +149,7 @@ func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
type VacuumVolumeCheckRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VacuumVolumeCheckRequest) Reset() { *m = VacuumVolumeCheckRequest{} }
@@ -153,9 +157,9 @@ func (m *VacuumVolumeCheckRequest) String() string { return proto.Com
func (*VacuumVolumeCheckRequest) ProtoMessage() {}
func (*VacuumVolumeCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
-func (m *VacuumVolumeCheckRequest) GetVolumdId() uint32 {
+func (m *VacuumVolumeCheckRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -177,7 +181,7 @@ func (m *VacuumVolumeCheckResponse) GetGarbageRatio() float64 {
}
type VacuumVolumeCompactRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
Preallocate int64 `protobuf:"varint,2,opt,name=preallocate" json:"preallocate,omitempty"`
}
@@ -186,9 +190,9 @@ func (m *VacuumVolumeCompactRequest) String() string { return proto.C
func (*VacuumVolumeCompactRequest) ProtoMessage() {}
func (*VacuumVolumeCompactRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
-func (m *VacuumVolumeCompactRequest) GetVolumdId() uint32 {
+func (m *VacuumVolumeCompactRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -209,7 +213,7 @@ func (*VacuumVolumeCompactResponse) ProtoMessage() {}
func (*VacuumVolumeCompactResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
type VacuumVolumeCommitRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VacuumVolumeCommitRequest) Reset() { *m = VacuumVolumeCommitRequest{} }
@@ -217,9 +221,9 @@ func (m *VacuumVolumeCommitRequest) String() string { return proto.Co
func (*VacuumVolumeCommitRequest) ProtoMessage() {}
func (*VacuumVolumeCommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
-func (m *VacuumVolumeCommitRequest) GetVolumdId() uint32 {
+func (m *VacuumVolumeCommitRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -233,7 +237,7 @@ func (*VacuumVolumeCommitResponse) ProtoMessage() {}
func (*VacuumVolumeCommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
type VacuumVolumeCleanupRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VacuumVolumeCleanupRequest) Reset() { *m = VacuumVolumeCleanupRequest{} }
@@ -241,9 +245,9 @@ func (m *VacuumVolumeCleanupRequest) String() string { return proto.C
func (*VacuumVolumeCleanupRequest) ProtoMessage() {}
func (*VacuumVolumeCleanupRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
-func (m *VacuumVolumeCleanupRequest) GetVolumdId() uint32 {
+func (m *VacuumVolumeCleanupRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -281,7 +285,7 @@ func (*DeleteCollectionResponse) ProtoMessage() {}
func (*DeleteCollectionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
type AssignVolumeRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ 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"`
Replication string `protobuf:"bytes,4,opt,name=replication" json:"replication,omitempty"`
@@ -293,9 +297,9 @@ func (m *AssignVolumeRequest) String() string { return proto.CompactT
func (*AssignVolumeRequest) ProtoMessage() {}
func (*AssignVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
-func (m *AssignVolumeRequest) GetVolumdId() uint32 {
+func (m *AssignVolumeRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -337,7 +341,7 @@ func (*AssignVolumeResponse) ProtoMessage() {}
func (*AssignVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
type VolumeSyncStatusRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VolumeSyncStatusRequest) Reset() { *m = VolumeSyncStatusRequest{} }
@@ -345,15 +349,15 @@ func (m *VolumeSyncStatusRequest) String() string { return proto.Comp
func (*VolumeSyncStatusRequest) ProtoMessage() {}
func (*VolumeSyncStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
-func (m *VolumeSyncStatusRequest) GetVolumdId() uint32 {
+func (m *VolumeSyncStatusRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
type VolumeSyncStatusResponse struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ 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"`
Replication string `protobuf:"bytes,4,opt,name=replication" json:"replication,omitempty"`
Ttl string `protobuf:"bytes,5,opt,name=ttl" json:"ttl,omitempty"`
@@ -367,9 +371,9 @@ func (m *VolumeSyncStatusResponse) String() string { return proto.Com
func (*VolumeSyncStatusResponse) ProtoMessage() {}
func (*VolumeSyncStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
-func (m *VolumeSyncStatusResponse) GetVolumdId() uint32 {
+func (m *VolumeSyncStatusResponse) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -417,7 +421,7 @@ func (m *VolumeSyncStatusResponse) GetIdxFileSize() uint64 {
}
type VolumeSyncIndexRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VolumeSyncIndexRequest) Reset() { *m = VolumeSyncIndexRequest{} }
@@ -425,9 +429,9 @@ func (m *VolumeSyncIndexRequest) String() string { return proto.Compa
func (*VolumeSyncIndexRequest) ProtoMessage() {}
func (*VolumeSyncIndexRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
-func (m *VolumeSyncIndexRequest) GetVolumdId() uint32 {
+func (m *VolumeSyncIndexRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -449,7 +453,7 @@ func (m *VolumeSyncIndexResponse) GetIndexFileContent() []byte {
}
type VolumeSyncDataRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
Revision uint32 `protobuf:"varint,2,opt,name=revision" json:"revision,omitempty"`
Offset uint32 `protobuf:"varint,3,opt,name=offset" json:"offset,omitempty"`
Size uint32 `protobuf:"varint,4,opt,name=size" json:"size,omitempty"`
@@ -461,9 +465,9 @@ func (m *VolumeSyncDataRequest) String() string { return proto.Compac
func (*VolumeSyncDataRequest) ProtoMessage() {}
func (*VolumeSyncDataRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
-func (m *VolumeSyncDataRequest) GetVolumdId() uint32 {
+func (m *VolumeSyncDataRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -513,7 +517,7 @@ func (m *VolumeSyncDataResponse) GetFileContent() []byte {
}
type VolumeMountRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VolumeMountRequest) Reset() { *m = VolumeMountRequest{} }
@@ -521,9 +525,9 @@ func (m *VolumeMountRequest) String() string { return proto.CompactTe
func (*VolumeMountRequest) ProtoMessage() {}
func (*VolumeMountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
-func (m *VolumeMountRequest) GetVolumdId() uint32 {
+func (m *VolumeMountRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -537,7 +541,7 @@ func (*VolumeMountResponse) ProtoMessage() {}
func (*VolumeMountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
type VolumeUnmountRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VolumeUnmountRequest) Reset() { *m = VolumeUnmountRequest{} }
@@ -545,9 +549,9 @@ func (m *VolumeUnmountRequest) String() string { return proto.Compact
func (*VolumeUnmountRequest) ProtoMessage() {}
func (*VolumeUnmountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
-func (m *VolumeUnmountRequest) GetVolumdId() uint32 {
+func (m *VolumeUnmountRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -561,7 +565,7 @@ func (*VolumeUnmountResponse) ProtoMessage() {}
func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
type VolumeDeleteRequest struct {
- VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
}
func (m *VolumeDeleteRequest) Reset() { *m = VolumeDeleteRequest{} }
@@ -569,9 +573,9 @@ func (m *VolumeDeleteRequest) String() string { return proto.CompactT
func (*VolumeDeleteRequest) ProtoMessage() {}
func (*VolumeDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
-func (m *VolumeDeleteRequest) GetVolumdId() uint32 {
+func (m *VolumeDeleteRequest) GetVolumeId() uint32 {
if m != nil {
- return m.VolumdId
+ return m.VolumeId
}
return 0
}
@@ -584,21 +588,173 @@ func (m *VolumeDeleteResponse) String() string { return proto.Compact
func (*VolumeDeleteResponse) ProtoMessage() {}
func (*VolumeDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
-type VolumeUiPageRequest struct {
+type ReplicateVolumeRequest 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"`
+ Replication string `protobuf:"bytes,3,opt,name=replication" json:"replication,omitempty"`
+ Ttl string `protobuf:"bytes,4,opt,name=ttl" json:"ttl,omitempty"`
+ SourceDataNode string `protobuf:"bytes,5,opt,name=source_data_node,json=sourceDataNode" json:"source_data_node,omitempty"`
}
-func (m *VolumeUiPageRequest) Reset() { *m = VolumeUiPageRequest{} }
-func (m *VolumeUiPageRequest) String() string { return proto.CompactTextString(m) }
-func (*VolumeUiPageRequest) ProtoMessage() {}
-func (*VolumeUiPageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
+func (m *ReplicateVolumeRequest) Reset() { *m = ReplicateVolumeRequest{} }
+func (m *ReplicateVolumeRequest) String() string { return proto.CompactTextString(m) }
+func (*ReplicateVolumeRequest) ProtoMessage() {}
+func (*ReplicateVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
-type VolumeUiPageResponse struct {
+func (m *ReplicateVolumeRequest) GetVolumeId() uint32 {
+ if m != nil {
+ return m.VolumeId
+ }
+ return 0
+}
+
+func (m *ReplicateVolumeRequest) GetCollection() string {
+ if m != nil {
+ return m.Collection
+ }
+ return ""
+}
+
+func (m *ReplicateVolumeRequest) GetReplication() string {
+ if m != nil {
+ return m.Replication
+ }
+ return ""
+}
+
+func (m *ReplicateVolumeRequest) GetTtl() string {
+ if m != nil {
+ return m.Ttl
+ }
+ return ""
+}
+
+func (m *ReplicateVolumeRequest) GetSourceDataNode() string {
+ if m != nil {
+ return m.SourceDataNode
+ }
+ return ""
+}
+
+type ReplicateVolumeResponse struct {
+}
+
+func (m *ReplicateVolumeResponse) Reset() { *m = ReplicateVolumeResponse{} }
+func (m *ReplicateVolumeResponse) String() string { return proto.CompactTextString(m) }
+func (*ReplicateVolumeResponse) ProtoMessage() {}
+func (*ReplicateVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
+
+type CopyFileRequest struct {
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
+ IsIdxFile bool `protobuf:"varint,2,opt,name=is_idx_file,json=isIdxFile" json:"is_idx_file,omitempty"`
+ IsDatFile bool `protobuf:"varint,3,opt,name=is_dat_file,json=isDatFile" json:"is_dat_file,omitempty"`
+}
+
+func (m *CopyFileRequest) Reset() { *m = CopyFileRequest{} }
+func (m *CopyFileRequest) String() string { return proto.CompactTextString(m) }
+func (*CopyFileRequest) ProtoMessage() {}
+func (*CopyFileRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
+
+func (m *CopyFileRequest) GetVolumeId() uint32 {
+ if m != nil {
+ return m.VolumeId
+ }
+ return 0
+}
+
+func (m *CopyFileRequest) GetIsIdxFile() bool {
+ if m != nil {
+ return m.IsIdxFile
+ }
+ return false
+}
+
+func (m *CopyFileRequest) GetIsDatFile() bool {
+ if m != nil {
+ return m.IsDatFile
+ }
+ return false
+}
+
+type CopyFileResponse struct {
+ FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"`
+}
+
+func (m *CopyFileResponse) Reset() { *m = CopyFileResponse{} }
+func (m *CopyFileResponse) String() string { return proto.CompactTextString(m) }
+func (*CopyFileResponse) ProtoMessage() {}
+func (*CopyFileResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
+
+func (m *CopyFileResponse) GetFileContent() []byte {
+ if m != nil {
+ return m.FileContent
+ }
+ return nil
+}
+
+type ReadVolumeFileStatusRequest struct {
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
+}
+
+func (m *ReadVolumeFileStatusRequest) Reset() { *m = ReadVolumeFileStatusRequest{} }
+func (m *ReadVolumeFileStatusRequest) String() string { return proto.CompactTextString(m) }
+func (*ReadVolumeFileStatusRequest) ProtoMessage() {}
+func (*ReadVolumeFileStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
+
+func (m *ReadVolumeFileStatusRequest) GetVolumeId() uint32 {
+ if m != nil {
+ return m.VolumeId
+ }
+ return 0
+}
+
+type ReadVolumeFileStatusResponse struct {
+ VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
+ IdxFileTimestamp uint64 `protobuf:"varint,2,opt,name=idx_file_timestamp,json=idxFileTimestamp" json:"idx_file_timestamp,omitempty"`
+ 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"`
+}
+
+func (m *ReadVolumeFileStatusResponse) Reset() { *m = ReadVolumeFileStatusResponse{} }
+func (m *ReadVolumeFileStatusResponse) String() string { return proto.CompactTextString(m) }
+func (*ReadVolumeFileStatusResponse) ProtoMessage() {}
+func (*ReadVolumeFileStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
+
+func (m *ReadVolumeFileStatusResponse) GetVolumeId() uint32 {
+ if m != nil {
+ return m.VolumeId
+ }
+ return 0
+}
+
+func (m *ReadVolumeFileStatusResponse) GetIdxFileTimestamp() uint64 {
+ if m != nil {
+ return m.IdxFileTimestamp
+ }
+ return 0
+}
+
+func (m *ReadVolumeFileStatusResponse) GetIdxFileSize() uint64 {
+ if m != nil {
+ return m.IdxFileSize
+ }
+ return 0
+}
+
+func (m *ReadVolumeFileStatusResponse) GetDatFileTimestamp() uint64 {
+ if m != nil {
+ return m.DatFileTimestamp
+ }
+ return 0
}
-func (m *VolumeUiPageResponse) Reset() { *m = VolumeUiPageResponse{} }
-func (m *VolumeUiPageResponse) String() string { return proto.CompactTextString(m) }
-func (*VolumeUiPageResponse) ProtoMessage() {}
-func (*VolumeUiPageResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
+func (m *ReadVolumeFileStatusResponse) GetDatFileSize() uint64 {
+ if m != nil {
+ return m.DatFileSize
+ }
+ return 0
+}
type DiskStatus struct {
Dir string `protobuf:"bytes,1,opt,name=dir" json:"dir,omitempty"`
@@ -610,7 +766,7 @@ type DiskStatus struct {
func (m *DiskStatus) Reset() { *m = DiskStatus{} }
func (m *DiskStatus) String() string { return proto.CompactTextString(m) }
func (*DiskStatus) ProtoMessage() {}
-func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
+func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
func (m *DiskStatus) GetDir() string {
if m != nil {
@@ -653,7 +809,7 @@ type MemStatus struct {
func (m *MemStatus) Reset() { *m = MemStatus{} }
func (m *MemStatus) String() string { return proto.CompactTextString(m) }
func (*MemStatus) ProtoMessage() {}
-func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
+func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
func (m *MemStatus) GetGoroutines() int32 {
if m != nil {
@@ -733,8 +889,12 @@ func init() {
proto.RegisterType((*VolumeUnmountResponse)(nil), "volume_server_pb.VolumeUnmountResponse")
proto.RegisterType((*VolumeDeleteRequest)(nil), "volume_server_pb.VolumeDeleteRequest")
proto.RegisterType((*VolumeDeleteResponse)(nil), "volume_server_pb.VolumeDeleteResponse")
- proto.RegisterType((*VolumeUiPageRequest)(nil), "volume_server_pb.VolumeUiPageRequest")
- proto.RegisterType((*VolumeUiPageResponse)(nil), "volume_server_pb.VolumeUiPageResponse")
+ proto.RegisterType((*ReplicateVolumeRequest)(nil), "volume_server_pb.ReplicateVolumeRequest")
+ proto.RegisterType((*ReplicateVolumeResponse)(nil), "volume_server_pb.ReplicateVolumeResponse")
+ proto.RegisterType((*CopyFileRequest)(nil), "volume_server_pb.CopyFileRequest")
+ proto.RegisterType((*CopyFileResponse)(nil), "volume_server_pb.CopyFileResponse")
+ proto.RegisterType((*ReadVolumeFileStatusRequest)(nil), "volume_server_pb.ReadVolumeFileStatusRequest")
+ proto.RegisterType((*ReadVolumeFileStatusResponse)(nil), "volume_server_pb.ReadVolumeFileStatusResponse")
proto.RegisterType((*DiskStatus)(nil), "volume_server_pb.DiskStatus")
proto.RegisterType((*MemStatus)(nil), "volume_server_pb.MemStatus")
}
@@ -764,6 +924,9 @@ type VolumeServerClient interface {
VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error)
VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error)
VolumeDelete(ctx context.Context, in *VolumeDeleteRequest, opts ...grpc.CallOption) (*VolumeDeleteResponse, error)
+ ReplicateVolume(ctx context.Context, in *ReplicateVolumeRequest, opts ...grpc.CallOption) (*ReplicateVolumeResponse, error)
+ ReadVolumeFileStatus(ctx context.Context, in *ReadVolumeFileStatusRequest, opts ...grpc.CallOption) (*ReadVolumeFileStatusResponse, error)
+ CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (VolumeServer_CopyFileClient, error)
}
type volumeServerClient struct {
@@ -937,6 +1100,56 @@ func (c *volumeServerClient) VolumeDelete(ctx context.Context, in *VolumeDeleteR
return out, nil
}
+func (c *volumeServerClient) ReplicateVolume(ctx context.Context, in *ReplicateVolumeRequest, opts ...grpc.CallOption) (*ReplicateVolumeResponse, error) {
+ out := new(ReplicateVolumeResponse)
+ err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/ReplicateVolume", in, out, c.cc, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *volumeServerClient) ReadVolumeFileStatus(ctx context.Context, in *ReadVolumeFileStatusRequest, opts ...grpc.CallOption) (*ReadVolumeFileStatusResponse, error) {
+ out := new(ReadVolumeFileStatusResponse)
+ err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/ReadVolumeFileStatus", in, out, c.cc, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *volumeServerClient) CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (VolumeServer_CopyFileClient, error) {
+ stream, err := grpc.NewClientStream(ctx, &_VolumeServer_serviceDesc.Streams[2], c.cc, "/volume_server_pb.VolumeServer/CopyFile", opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &volumeServerCopyFileClient{stream}
+ if err := x.ClientStream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type VolumeServer_CopyFileClient interface {
+ Recv() (*CopyFileResponse, error)
+ grpc.ClientStream
+}
+
+type volumeServerCopyFileClient struct {
+ grpc.ClientStream
+}
+
+func (x *volumeServerCopyFileClient) Recv() (*CopyFileResponse, error) {
+ m := new(CopyFileResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
// Server API for VolumeServer service
type VolumeServerServer interface {
@@ -954,6 +1167,9 @@ type VolumeServerServer interface {
VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error)
VolumeUnmount(context.Context, *VolumeUnmountRequest) (*VolumeUnmountResponse, error)
VolumeDelete(context.Context, *VolumeDeleteRequest) (*VolumeDeleteResponse, error)
+ ReplicateVolume(context.Context, *ReplicateVolumeRequest) (*ReplicateVolumeResponse, error)
+ ReadVolumeFileStatus(context.Context, *ReadVolumeFileStatusRequest) (*ReadVolumeFileStatusResponse, error)
+ CopyFile(*CopyFileRequest, VolumeServer_CopyFileServer) error
}
func RegisterVolumeServerServer(s *grpc.Server, srv VolumeServerServer) {
@@ -1200,6 +1416,63 @@ func _VolumeServer_VolumeDelete_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler)
}
+func _VolumeServer_ReplicateVolume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ReplicateVolumeRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(VolumeServerServer).ReplicateVolume(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/volume_server_pb.VolumeServer/ReplicateVolume",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(VolumeServerServer).ReplicateVolume(ctx, req.(*ReplicateVolumeRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _VolumeServer_ReadVolumeFileStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ReadVolumeFileStatusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(VolumeServerServer).ReadVolumeFileStatus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/volume_server_pb.VolumeServer/ReadVolumeFileStatus",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(VolumeServerServer).ReadVolumeFileStatus(ctx, req.(*ReadVolumeFileStatusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _VolumeServer_CopyFile_Handler(srv interface{}, stream grpc.ServerStream) error {
+ m := new(CopyFileRequest)
+ if err := stream.RecvMsg(m); err != nil {
+ return err
+ }
+ return srv.(VolumeServerServer).CopyFile(m, &volumeServerCopyFileServer{stream})
+}
+
+type VolumeServer_CopyFileServer interface {
+ Send(*CopyFileResponse) error
+ grpc.ServerStream
+}
+
+type volumeServerCopyFileServer struct {
+ grpc.ServerStream
+}
+
+func (x *volumeServerCopyFileServer) Send(m *CopyFileResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
var _VolumeServer_serviceDesc = grpc.ServiceDesc{
ServiceName: "volume_server_pb.VolumeServer",
HandlerType: (*VolumeServerServer)(nil),
@@ -1248,6 +1521,14 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
MethodName: "VolumeDelete",
Handler: _VolumeServer_VolumeDelete_Handler,
},
+ {
+ MethodName: "ReplicateVolume",
+ Handler: _VolumeServer_ReplicateVolume_Handler,
+ },
+ {
+ MethodName: "ReadVolumeFileStatus",
+ Handler: _VolumeServer_ReadVolumeFileStatus_Handler,
+ },
},
Streams: []grpc.StreamDesc{
{
@@ -1260,6 +1541,11 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
Handler: _VolumeServer_VolumeSyncData_Handler,
ServerStreams: true,
},
+ {
+ StreamName: "CopyFile",
+ Handler: _VolumeServer_CopyFile_Handler,
+ ServerStreams: true,
+ },
},
Metadata: "volume_server.proto",
}
@@ -1267,71 +1553,83 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 1044 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x72, 0xdb, 0x44,
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 0x19, 0x47, 0xaf, 0xa1, 0x93, 0x21, 0x25, 0x55, 0xc3, 0xa3,
+ 0x4c, 0x73, 0xaa, 0x86, 0x47, 0x15, 0xb3, 0x59, 0x40, 0x67, 0xd0, 0xcb, 0xd1, 0x14, 0xb4, 0x3b,
+ 0xcb, 0x32, 0x4f, 0x7e, 0xf4, 0x07, 0x73, 0xf5, 0xb2, 0x4d, 0x96, 0x65, 0x2f, 0x68, 0x66, 0x70,
+ 0xf9, 0x01, 0xb8, 0x3b, 0x4f, 0x2d, 0x75, 0x70, 0x01, 0xab, 0x05, 0x42, 0x51, 0x75, 0xee, 0xd5,
+ 0x44, 0xa9, 0xea, 0xdc, 0x67, 0xb1, 0x93, 0x05, 0xf4, 0x33, 0xac, 0x57, 0xbd, 0xdd, 0xe8, 0x71,
+ 0x15, 0xc8, 0x4c, 0x82, 0xa0, 0x1f, 0xd4, 0x55, 0x4f, 0x1d, 0xbf, 0x84, 0x76, 0x42, 0x54, 0xd0,
+ 0xfd, 0xb2, 0x75, 0x81, 0x34, 0xe9, 0xc6, 0x6d, 0x2a, 0xd3, 0xe6, 0x3a, 0x5b, 0x12, 0xff, 0xc2,
+ 0x3c, 0xf9, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x7d, 0x0d, 0xbb, 0x9c, 0x11, 0x00, 0x00,
}
diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go
index 429ca9b681..c924b7a625 100644
--- a/weed/server/volume_grpc_admin.go
+++ b/weed/server/volume_grpc_admin.go
@@ -29,7 +29,7 @@ func (vs *VolumeServer) AssignVolume(ctx context.Context, req *volume_server_pb.
resp := &volume_server_pb.AssignVolumeResponse{}
err := vs.store.AddVolume(
- storage.VolumeId(req.VolumdId),
+ storage.VolumeId(req.VolumeId),
req.Collection,
vs.needleMapKind,
req.Replication,
@@ -51,7 +51,7 @@ func (vs *VolumeServer) VolumeMount(ctx context.Context, req *volume_server_pb.V
resp := &volume_server_pb.VolumeMountResponse{}
- err := vs.store.MountVolume(storage.VolumeId(req.VolumdId))
+ err := vs.store.MountVolume(storage.VolumeId(req.VolumeId))
if err != nil {
glog.Errorf("volume mount %v: %v", req, err)
@@ -67,7 +67,7 @@ func (vs *VolumeServer) VolumeUnmount(ctx context.Context, req *volume_server_pb
resp := &volume_server_pb.VolumeUnmountResponse{}
- err := vs.store.UnmountVolume(storage.VolumeId(req.VolumdId))
+ err := vs.store.UnmountVolume(storage.VolumeId(req.VolumeId))
if err != nil {
glog.Errorf("volume unmount %v: %v", req, err)
@@ -83,7 +83,7 @@ func (vs *VolumeServer) VolumeDelete(ctx context.Context, req *volume_server_pb.
resp := &volume_server_pb.VolumeDeleteResponse{}
- err := vs.store.DeleteVolume(storage.VolumeId(req.VolumdId))
+ err := vs.store.DeleteVolume(storage.VolumeId(req.VolumeId))
if err != nil {
glog.Errorf("volume delete %v: %v", req, err)
diff --git a/weed/server/volume_grpc_replicate.go b/weed/server/volume_grpc_replicate.go
new file mode 100644
index 0000000000..20a85fd6fe
--- /dev/null
+++ b/weed/server/volume_grpc_replicate.go
@@ -0,0 +1,155 @@
+package weed_server
+
+import (
+ "context"
+ "fmt"
+ "github.com/chrislusf/seaweedfs/weed/operation"
+ "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
+ "github.com/chrislusf/seaweedfs/weed/storage"
+ "io"
+ "os"
+)
+
+func (vs *VolumeServer) ReplicateVolume(ctx context.Context, req *volume_server_pb.ReplicateVolumeRequest) (*volume_server_pb.ReplicateVolumeResponse, error) {
+
+ v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
+ if v != nil {
+ // unmount the volume
+ err := vs.store.UnmountVolume(storage.VolumeId(req.VolumeId))
+ if err != nil {
+ return nil, fmt.Errorf("failed to unmount volume %d: %v", req.VolumeId, err)
+ }
+ }
+
+ location := vs.store.FindFreeLocation()
+ if location == nil {
+ return nil, fmt.Errorf("no space left")
+ }
+
+ volumeFileName := storage.VolumeFileName(req.Collection, location.Directory, int(req.VolumeId))
+
+ // the master will not start compaction for read-only volumes, so it is safe to just copy files directly
+ // copy .dat and .idx files
+ // read .idx .dat file size and timestamp
+ // send .idx file
+ // send .dat file
+ // confirm size and timestamp
+
+ 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{})
+
+ 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")
+ if err != nil {
+ return fmt.Errorf("failed to copy volume %d idx file: %v", req.VolumeId, err)
+ }
+
+ copyFileClient, err = client.CopyFile(ctx, &volume_server_pb.CopyFileRequest{
+ 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")
+ if err != nil {
+ return fmt.Errorf("failed to copy volume %d dat file: %v", req.VolumeId, err)
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ // TODO: check the timestamp and size
+
+ // mount the volume
+ err = vs.store.MountVolume(storage.VolumeId(req.VolumeId))
+ if err != nil {
+ return nil, fmt.Errorf("failed to mount volume %d: %v", req.VolumeId, err)
+ }
+
+ return &volume_server_pb.ReplicateVolumeResponse{}, err
+
+}
+
+func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName string) error {
+ println("writing to ", fileName)
+ dst, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
+ if err != nil {
+ return nil
+ }
+ defer dst.Close()
+
+ for {
+ resp, receiveErr := client.Recv()
+ if receiveErr == io.EOF {
+ break
+ }
+ if receiveErr != nil {
+ return fmt.Errorf("receiving %s: %v", fileName, receiveErr)
+ }
+ dst.Write(resp.FileContent)
+ }
+ return nil
+}
+
+func (vs *VolumeServer) ReadVolumeFileStatus(ctx context.Context, req *volume_server_pb.ReadVolumeFileStatusRequest) (*volume_server_pb.ReadVolumeFileStatusResponse, error) {
+ resp := &volume_server_pb.ReadVolumeFileStatusResponse{}
+ return resp, nil
+}
+
+func (vs *VolumeServer) CopyFile(req *volume_server_pb.CopyFileRequest, stream volume_server_pb.VolumeServer_CopyFileServer) (error) {
+
+ v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
+ if v == nil {
+ return fmt.Errorf("not found volume id %d", req.VolumeId)
+ }
+
+ const BufferSize = 1024 * 16
+ var fileName = v.FileName()
+ if req.IsDatFile {
+ fileName += ".dat"
+ } else if req.IsIdxFile {
+ fileName += ".idx"
+ }
+ file, err := os.Open(fileName)
+ if err != nil {
+ return err
+ }
+ defer file.Close()
+
+ buffer := make([]byte, BufferSize)
+
+ for {
+ bytesread, err := file.Read(buffer)
+
+ if err != nil {
+ if err != io.EOF {
+ return err
+ }
+ break
+ }
+
+ stream.Send(&volume_server_pb.CopyFileResponse{
+ FileContent: buffer[:bytesread],
+ })
+
+ }
+
+ return nil
+}
diff --git a/weed/server/volume_grpc_sync.go b/weed/server/volume_grpc_sync.go
index 0114b38a42..9712586897 100644
--- a/weed/server/volume_grpc_sync.go
+++ b/weed/server/volume_grpc_sync.go
@@ -12,14 +12,14 @@ import (
func (vs *VolumeServer) VolumeSyncStatus(ctx context.Context, req *volume_server_pb.VolumeSyncStatusRequest) (*volume_server_pb.VolumeSyncStatusResponse, error) {
- v := vs.store.GetVolume(storage.VolumeId(req.VolumdId))
+ v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
if v == nil {
- return nil, fmt.Errorf("not found volume id %d", req.VolumdId)
+ return nil, fmt.Errorf("not found volume id %d", req.VolumeId)
}
resp := v.GetVolumeSyncStatus()
- glog.V(2).Infof("volume sync status %d", req.VolumdId)
+ glog.V(2).Infof("volume sync status %d", req.VolumeId)
return resp, nil
@@ -27,17 +27,17 @@ func (vs *VolumeServer) VolumeSyncStatus(ctx context.Context, req *volume_server
func (vs *VolumeServer) VolumeSyncIndex(req *volume_server_pb.VolumeSyncIndexRequest, stream volume_server_pb.VolumeServer_VolumeSyncIndexServer) error {
- v := vs.store.GetVolume(storage.VolumeId(req.VolumdId))
+ v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
if v == nil {
- return fmt.Errorf("not found volume id %d", req.VolumdId)
+ return fmt.Errorf("not found volume id %d", req.VolumeId)
}
content, err := v.IndexFileContent()
if err != nil {
- glog.Errorf("sync volume %d index: %v", req.VolumdId, err)
+ glog.Errorf("sync volume %d index: %v", req.VolumeId, err)
} else {
- glog.V(2).Infof("sync volume %d index", req.VolumdId)
+ glog.V(2).Infof("sync volume %d index", req.VolumeId)
}
const blockSizeLimit = 1024 * 1024 * 2
@@ -57,9 +57,9 @@ func (vs *VolumeServer) VolumeSyncIndex(req *volume_server_pb.VolumeSyncIndexReq
func (vs *VolumeServer) VolumeSyncData(req *volume_server_pb.VolumeSyncDataRequest, stream volume_server_pb.VolumeServer_VolumeSyncDataServer) error {
- v := vs.store.GetVolume(storage.VolumeId(req.VolumdId))
+ v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
if v == nil {
- return fmt.Errorf("not found volume id %d", req.VolumdId)
+ return fmt.Errorf("not found volume id %d", req.VolumeId)
}
if uint32(v.SuperBlock.CompactRevision) != req.Revision {
@@ -82,7 +82,7 @@ func (vs *VolumeServer) VolumeSyncData(req *volume_server_pb.VolumeSyncDataReque
}
if err != nil {
- glog.Errorf("sync volume %d data: %v", req.VolumdId, err)
+ glog.Errorf("sync volume %d data: %v", req.VolumeId, err)
}
const blockSizeLimit = 1024 * 1024 * 2
diff --git a/weed/server/volume_grpc_vacuum.go b/weed/server/volume_grpc_vacuum.go
index f0c87b582b..d31b8f8e71 100644
--- a/weed/server/volume_grpc_vacuum.go
+++ b/weed/server/volume_grpc_vacuum.go
@@ -12,12 +12,12 @@ func (vs *VolumeServer) VacuumVolumeCheck(ctx context.Context, req *volume_serve
resp := &volume_server_pb.VacuumVolumeCheckResponse{}
- garbageRatio, err := vs.store.CheckCompactVolume(storage.VolumeId(req.VolumdId))
+ garbageRatio, err := vs.store.CheckCompactVolume(storage.VolumeId(req.VolumeId))
resp.GarbageRatio = garbageRatio
if err != nil {
- glog.V(3).Infof("check volume %d: %v", req.VolumdId, err)
+ glog.V(3).Infof("check volume %d: %v", req.VolumeId, err)
}
return resp, err
@@ -28,12 +28,12 @@ func (vs *VolumeServer) VacuumVolumeCompact(ctx context.Context, req *volume_ser
resp := &volume_server_pb.VacuumVolumeCompactResponse{}
- err := vs.store.CompactVolume(storage.VolumeId(req.VolumdId), req.Preallocate)
+ err := vs.store.CompactVolume(storage.VolumeId(req.VolumeId), req.Preallocate)
if err != nil {
- glog.Errorf("compact volume %d: %v", req.VolumdId, err)
+ glog.Errorf("compact volume %d: %v", req.VolumeId, err)
} else {
- glog.V(1).Infof("compact volume %d", req.VolumdId)
+ glog.V(1).Infof("compact volume %d", req.VolumeId)
}
return resp, err
@@ -44,12 +44,12 @@ func (vs *VolumeServer) VacuumVolumeCommit(ctx context.Context, req *volume_serv
resp := &volume_server_pb.VacuumVolumeCommitResponse{}
- err := vs.store.CommitCompactVolume(storage.VolumeId(req.VolumdId))
+ err := vs.store.CommitCompactVolume(storage.VolumeId(req.VolumeId))
if err != nil {
- glog.Errorf("commit volume %d: %v", req.VolumdId, err)
+ glog.Errorf("commit volume %d: %v", req.VolumeId, err)
} else {
- glog.V(1).Infof("commit volume %d", req.VolumdId)
+ glog.V(1).Infof("commit volume %d", req.VolumeId)
}
return resp, err
@@ -60,12 +60,12 @@ func (vs *VolumeServer) VacuumVolumeCleanup(ctx context.Context, req *volume_ser
resp := &volume_server_pb.VacuumVolumeCleanupResponse{}
- err := vs.store.CommitCleanupVolume(storage.VolumeId(req.VolumdId))
+ err := vs.store.CommitCleanupVolume(storage.VolumeId(req.VolumeId))
if err != nil {
- glog.Errorf("cleanup volume %d: %v", req.VolumdId, err)
+ glog.Errorf("cleanup volume %d: %v", req.VolumeId, err)
} else {
- glog.V(1).Infof("cleanup volume %d", req.VolumdId)
+ glog.V(1).Infof("cleanup volume %d", req.VolumeId)
}
return resp, err
diff --git a/weed/shell/shell_liner.go b/weed/shell/shell_liner.go
index 096532fdf9..7d09661dcb 100644
--- a/weed/shell/shell_liner.go
+++ b/weed/shell/shell_liner.go
@@ -71,7 +71,7 @@ func RunShell(options ShellOptions) {
} else {
for _, c := range commands {
if c.Name() == cmd {
- if err := c.Do(args, commandEnv, os.Stderr); err != nil {
+ if err := c.Do(args, commandEnv, os.Stdout); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
}
}
diff --git a/weed/storage/store.go b/weed/storage/store.go
index 8d4d9c55e4..56e973738e 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -77,7 +77,7 @@ func (s *Store) findVolume(vid VolumeId) *Volume {
}
return nil
}
-func (s *Store) findFreeLocation() (ret *DiskLocation) {
+func (s *Store) FindFreeLocation() (ret *DiskLocation) {
max := 0
for _, location := range s.Locations {
currentFreeCount := location.MaxVolumeCount - location.VolumesLen()
@@ -92,7 +92,7 @@ func (s *Store) addVolume(vid VolumeId, collection string, needleMapKind NeedleM
if s.findVolume(vid) != nil {
return fmt.Errorf("Volume Id %d already exists!", vid)
}
- if location := s.findFreeLocation(); location != nil {
+ if location := s.FindFreeLocation(); location != nil {
glog.V(0).Infof("In dir %s adds volume:%v collection:%s replicaPlacement:%v ttl:%v",
location.Directory, vid, collection, replicaPlacement, ttl)
if volume, err := NewVolume(location.Directory, collection, vid, needleMapKind, replicaPlacement, ttl, preallocate); err == nil {
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 22acf16537..807fefa388 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -5,6 +5,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"os"
"path"
+ "strconv"
"sync"
"time"
@@ -42,14 +43,18 @@ func (v *Volume) String() string {
return fmt.Sprintf("Id:%v, dir:%s, Collection:%s, dataFile:%v, nm:%v, readOnly:%v", v.Id, v.dir, v.Collection, v.dataFile, v.nm, v.readOnly)
}
-func (v *Volume) FileName() (fileName string) {
- if v.Collection == "" {
- fileName = path.Join(v.dir, v.Id.String())
+func VolumeFileName(collection string, dir string, id int) (fileName string) {
+ idString := strconv.Itoa(id)
+ if collection == "" {
+ fileName = path.Join(dir, idString)
} else {
- fileName = path.Join(v.dir, v.Collection+"_"+v.Id.String())
+ fileName = path.Join(dir, collection+"_"+idString)
}
return
}
+func (v *Volume) FileName() (fileName string) {
+ return VolumeFileName(v.Collection, v.dir, int(v.Id))
+}
func (v *Volume) DataFile() *os.File {
return v.dataFile
}
diff --git a/weed/storage/volume_sync.go b/weed/storage/volume_sync.go
index 8d90a729d0..827e6685af 100644
--- a/weed/storage/volume_sync.go
+++ b/weed/storage/volume_sync.go
@@ -192,7 +192,7 @@ func (v *Volume) fetchNeedle(volumeServer string, grpcDialOption grpc.DialOption
return operation.WithVolumeServerClient(volumeServer, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
stream, err := client.VolumeSyncData(context.Background(), &volume_server_pb.VolumeSyncDataRequest{
- VolumdId: uint32(v.Id),
+ VolumeId: uint32(v.Id),
Revision: uint32(compactRevision),
Offset: uint32(needleValue.Offset),
Size: uint32(needleValue.Size),
diff --git a/weed/topology/allocate_volume.go b/weed/topology/allocate_volume.go
index 66b1b3af51..1360988b32 100644
--- a/weed/topology/allocate_volume.go
+++ b/weed/topology/allocate_volume.go
@@ -17,7 +17,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{
- VolumdId: uint32(vid),
+ VolumeId: uint32(vid),
Collection: option.Collection,
Replication: option.ReplicaPlacement.String(),
Ttl: option.Ttl.String(),
diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.go
index 840821efa5..ea65b2ff91 100644
--- a/weed/topology/topology_vacuum.go
+++ b/weed/topology/topology_vacuum.go
@@ -17,7 +17,7 @@ func batchVacuumVolumeCheck(grpcDialOption grpc.DialOption, vl *VolumeLayout, vi
go func(index int, url string, vid storage.VolumeId) {
err := operation.WithVolumeServerClient(url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
resp, err := volumeServerClient.VacuumVolumeCheck(context.Background(), &volume_server_pb.VacuumVolumeCheckRequest{
- VolumdId: uint32(vid),
+ VolumeId: uint32(vid),
})
if err != nil {
ch <- false
@@ -52,7 +52,7 @@ func batchVacuumVolumeCompact(grpcDialOption grpc.DialOption, vl *VolumeLayout,
glog.V(0).Infoln(index, "Start vacuuming", vid, "on", url)
err := operation.WithVolumeServerClient(url, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
_, err := volumeServerClient.VacuumVolumeCompact(context.Background(), &volume_server_pb.VacuumVolumeCompactRequest{
- VolumdId: uint32(vid),
+ VolumeId: uint32(vid),
})
return err
})
@@ -83,7 +83,7 @@ func batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *VolumeLayout, v
glog.V(0).Infoln("Start Committing vacuum", vid, "on", dn.Url())
err := operation.WithVolumeServerClient(dn.Url(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
_, err := volumeServerClient.VacuumVolumeCommit(context.Background(), &volume_server_pb.VacuumVolumeCommitRequest{
- VolumdId: uint32(vid),
+ VolumeId: uint32(vid),
})
return err
})
@@ -104,7 +104,7 @@ func batchVacuumVolumeCleanup(grpcDialOption grpc.DialOption, vl *VolumeLayout,
glog.V(0).Infoln("Start cleaning up", vid, "on", dn.Url())
err := operation.WithVolumeServerClient(dn.Url(), grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
_, err := volumeServerClient.VacuumVolumeCleanup(context.Background(), &volume_server_pb.VacuumVolumeCleanupRequest{
- VolumdId: uint32(vid),
+ VolumeId: uint32(vid),
})
return err
})