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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
volume tailing chunks large files
Chris Lufa176fe80f77
diff --git a/unmaintained/volume_tailer/volume_tailer.go b/unmaintained/volume_tailer/volume_tailer.goindex 22c3ebab4e..8a662ef5e3 100644--- a/unmaintained/volume_tailer/volume_tailer.go+++ b/unmaintained/volume_tailer/volume_tailer.go@@ -10,6 +10,7 @@ import (weed_server "github.com/chrislusf/seaweedfs/weed/server""github.com/chrislusf/seaweedfs/weed/storage""github.com/spf13/viper"+ "golang.org/x/tools/godoc/util""io""log"@@ -19,6 +20,7 @@ var (master = flag.String("master", "localhost:9333", "master server host and port")volumeId = flag.Int("volumeId", -1, "a volume id")timeoutSeconds = flag.Int("timeoutSeconds", 0, "disconnect if no activity after these seconds")+ showTextFile = flag.Bool("showTextFile", false, "display textual file content"))func main() {@@ -59,7 +61,51 @@ func main() {}}- println("header:", len(resp.NeedleHeader), "body:", len(resp.NeedleBody))+ needleHeader := resp.NeedleHeader+ needleBody := resp.NeedleBody++ if len(needleHeader) == 0 {+ continue+ }++ for !resp.IsLastChunk {+ resp, recvErr = stream.Recv()+ if recvErr != nil {+ if recvErr == io.EOF {+ break+ } else {+ return recvErr+ }+ }+ needleBody = append(needleBody, resp.NeedleBody...)+ }++ n := new(storage.Needle)+ n.ParseNeedleHeader(needleHeader)+ n.ReadNeedleBodyBytes(needleBody, storage.CurrentVersion)++ if n.Size == 0 {+ println("-", n.String())+ continue+ } else {+ println("+", n.String())+ }++ if *showTextFile {++ data := n.Data+ if n.IsGzipped() {+ if data, err = operation.UnGzipData(data); err != nil {+ continue+ }+ }+ if util.IsText(data) {+ println(string(data))+ }++ println("-", n.String(), "compressed", n.IsGzipped(), "original size", len(data))+ }+}return nil@@ -70,5 +116,4 @@ func main() {log.Printf("Error VolumeTail volume %d: %v", vid, err)}-}diff --git a/weed/pb/volume_server.proto b/weed/pb/volume_server.protoindex 949eeb49ad..70f391959f 100644--- a/weed/pb/volume_server.proto+++ b/weed/pb/volume_server.proto@@ -174,6 +174,7 @@ message VolumeTailRequest {message VolumeTailResponse {bytes needle_header = 1;bytes needle_body = 2;+ bool is_last_chunk = 3;}message ReadVolumeFileStatusRequest {diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.goindex bb7711865b..4df6db2725 100644--- a/weed/pb/volume_server_pb/volume_server.pb.go+++ b/weed/pb/volume_server_pb/volume_server.pb.go@@ -671,6 +671,7 @@ func (m *VolumeTailRequest) GetDrainingSeconds() uint32 {type VolumeTailResponse struct {NeedleHeader []byte `protobuf:"bytes,1,opt,name=needle_header,json=needleHeader,proto3" json:"needle_header,omitempty"`NeedleBody []byte `protobuf:"bytes,2,opt,name=needle_body,json=needleBody,proto3" json:"needle_body,omitempty"`+ IsLastChunk bool `protobuf:"varint,3,opt,name=is_last_chunk,json=isLastChunk" json:"is_last_chunk,omitempty"`}func (m *VolumeTailResponse) Reset() { *m = VolumeTailResponse{} }@@ -692,6 +693,13 @@ func (m *VolumeTailResponse) GetNeedleBody() []byte {return nil}+func (m *VolumeTailResponse) GetIsLastChunk() bool {+ if m != nil {+ return m.IsLastChunk+ }+ return false+}+type ReadVolumeFileStatusRequest struct {VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`}@@ -1563,86 +1571,87 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }var fileDescriptor0 = []byte{- // 1282 bytes of a gzipped FileDescriptorProto- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x58, 0xdd, 0x73, 0xdb, 0x44,- 0x10, 0x8f,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 0x58, 0x96, 0x53, 0x05, 0xd3, 0x2c, 0xcb,- 0xa9, 0x8a, 0x5b, 0xe2, 0x05, 0xf4, 0x7b, 0xcc, 0x30, 0x72, 0x24, 0x09, 0x6d, 0x56, 0xc1, 0x94,- 0xb3, 0x34, 0xfd, 0x49, 0x6d, 0xfd, 0xd8, 0xf7, 0xa7, 0x1a, 0xbf, 0xeb, 0x29, 0xae, 0x54, 0x76,- 0xd7, 0x8b, 0xec, 0xab, 0xec, 0xae, 0x97, 0x11, 0xae, 0x05, 0x74, 0x08, 0x83, 0x0c, 0x7b, 0x42,- 0xf7, 0xab, 0x2c, 0xb3, 0x9c, 0x4c, 0x7f, 0x30, 0x57, 0x2f, 0xf1, 0x61, 0xc6, 0xd3, 0x4b, 0x8d,- 0xab, 0xca, 0xe0, 0xb2, 0xf3, 0xea, 0xfe, 0x3c, 0xb5, 0xc4, 0xc1, 0x4f, 0x00, 0x17, 0x64, 0x07,- 0xdd, 0xad, 0xb2, 0x4b, 0x1f, 0xc5, 0xbd, 0xcb, 0x95, 0x12, 0xe8, 0x5f, 0x61, 0xb9, 0xec, 0xe9,- 0x45, 0x25, 0xb7, 0xf0, 0x92, 0xf7, 0x5d, 0xdf, 0xac, 0xab, 0x9e, 0x38, 0x7e, 0x0d, 0x9d, 0x98,- 0x3a, 0xa1, 0x3b, 0x45, 0xeb, 0x1c, 0x8d, 0xd3, 0xf1, 0x65, 0x2a, 0xa9, 0x6e, 0x7a, 0x13, 0x97,- 0x8a, 0x73, 0x9c, 0xea, 0x52, 0xa5, 0x88, 0x57, 0x75, 0xa9, 0xd2, 0x34, 0x89, 0x83, 0x1f, 0x2e,- 0x8a, 0x7f, 0x6c, 0x9e, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0x07, 0xe0, 0xca, 0x7c, 0xc8, 0x11,- 0x00, 0x00,+ // 1305 bytes of a gzipped FileDescriptorProto+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02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, 0x3c, 0xa8, 0xb9, 0x54, 0x39, 0x72, 0xd6, 0x5c,+ 0xaa, 0x3c, 0x95, 0x92, 0xe0, 0x7b, 0x4b, 0xea, 0x5f, 0x9d, 0x47, 0xff, 0x06, 0x00, 0x00, 0xff,+ 0xff, 0x71, 0xd9, 0xf3, 0x7e, 0xec, 0x11, 0x00, 0x00,}diff --git a/weed/server/volume_grpc_stream_follow.go b/weed/server/volume_grpc_tail.gosimilarity index 77%rename from weed/server/volume_grpc_stream_follow.gorename to weed/server/volume_grpc_tail.goindex 52a9c14736..da248498fb 100644--- a/weed/server/volume_grpc_stream_follow.go+++ b/weed/server/volume_grpc_tail.go@@ -30,6 +30,7 @@ func (vs *VolumeServer) VolumeTail(req *volume_server_pb.VolumeTailRequest, stretime.Sleep(2 * time.Second)if req.DrainingSeconds == 0 {+ lastTimestampNs = lastProcessedTimestampNscontinue}if lastProcessedTimestampNs == lastTimestampNs {@@ -59,18 +60,31 @@ func sendNeedlesSince(stream volume_server_pb.VolumeServer_VolumeTailServer, v *if isLastOne {// need to heart beat to the client to ensure the connection health- sendErr := stream.Send(&volume_server_pb.VolumeTailResponse{})+ sendErr := stream.Send(&volume_server_pb.VolumeTailResponse{IsLastChunk: true})return lastTimestampNs, sendErr}err = storage.ScanVolumeFileNeedleFrom(v.Version(), v.DataFile(), foundOffset.ToAcutalOffset(), func(needleHeader, needleBody []byte, needleAppendAtNs uint64) error {- sendErr := stream.Send(&volume_server_pb.VolumeTailResponse{- NeedleHeader: needleHeader,- NeedleBody: needleBody,- })- if sendErr != nil {- return sendErr+ blockSizeLimit := 1024 * 1024 * 2+ isLastChunk := false++ // need to send body by chunks+ for i := 0; i < len(needleBody); i += blockSizeLimit {+ stopOffset := i + blockSizeLimit+ if stopOffset >= len(needleBody) {+ isLastChunk = true+ stopOffset = len(needleBody)+ }++ sendErr := stream.Send(&volume_server_pb.VolumeTailResponse{+ NeedleHeader: needleHeader,+ NeedleBody: needleBody[i:stopOffset],+ IsLastChunk: isLastChunk,+ })+ if sendErr != nil {+ return sendErr+ }}lastProcessedTimestampNs = needleAppendAtNsdiff --git a/weed/storage/needle_read_write.go b/weed/storage/needle_read_write.goindex 6e709d6c20..1a2c994506 100644--- a/weed/storage/needle_read_write.go+++ b/weed/storage/needle_read_write.go@@ -304,28 +304,35 @@ func (n *Needle) ReadNeedleBody(r *os.File, version Version, offset int64, bodyLif bodyLength <= 0 {return nil, nil}+ bytes = make([]byte, bodyLength)+ if _, err = r.ReadAt(bytes, offset); err != nil {+ return+ }++ err = n.ReadNeedleBodyBytes(bytes, version)++ return+}++func (n *Needle) ReadNeedleBodyBytes(needleBody []byte, version Version) (err error) {++ if len(needleBody) <= 0 {+ return nil+ }switch version {case Version1:- bytes = make([]byte, bodyLength)- if _, err = r.ReadAt(bytes, offset); err != nil {- return- }- n.Data = bytes[:n.Size]+ n.Data = needleBody[:n.Size]n.Checksum = NewCRC(n.Data)case Version2, Version3:- bytes = make([]byte, bodyLength)- if _, err = r.ReadAt(bytes, offset); err != nil {- return- }- err = n.readNeedleDataVersion2(bytes[0:n.Size])+ err = n.readNeedleDataVersion2(needleBody[0:n.Size])n.Checksum = NewCRC(n.Data)if version == Version3 {tsOffset := n.Size + NeedleChecksumSize- n.AppendAtNs = util.BytesToUint64(bytes[tsOffset : tsOffset+TimestampSize])+ n.AppendAtNs = util.BytesToUint64(needleBody[tsOffset : tsOffset+TimestampSize])}default:- err = fmt.Errorf("Unsupported Version! (%d)", version)+ err = fmt.Errorf("unsupported version %d!", version)}return}