upload correctness checking (#160)

Now sending the md5, as well as the content length of the table files we will upload to the dolthub remote api.  This is used to make sure what is uploaded is complete and correct.
This commit is contained in:
Brian Hendriks
2019-10-22 10:06:54 -07:00
committed by GitHub
parent 84b84323bc
commit 67be3c36f6
14 changed files with 335 additions and 116 deletions

View File

@@ -585,19 +585,75 @@ func (m *GetDownloadLocsResponse) GetLocs() []*DownloadLoc {
return nil
}
type GetUploadLocsRequest struct {
RepoId *RepoId `protobuf:"bytes,1,opt,name=repo_id,json=repoId,proto3" json:"repo_id,omitempty"`
TableFileHashes [][]byte `protobuf:"bytes,2,rep,name=table_file_hashes,json=tableFileHashes,proto3" json:"table_file_hashes,omitempty"`
type TableFileDetails struct {
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
ContentLength uint64 `protobuf:"varint,2,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
ContentHash []byte `protobuf:"bytes,3,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TableFileDetails) Reset() { *m = TableFileDetails{} }
func (m *TableFileDetails) String() string { return proto.CompactTextString(m) }
func (*TableFileDetails) ProtoMessage() {}
func (*TableFileDetails) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{11}
}
func (m *TableFileDetails) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TableFileDetails.Unmarshal(m, b)
}
func (m *TableFileDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TableFileDetails.Marshal(b, m, deterministic)
}
func (m *TableFileDetails) XXX_Merge(src proto.Message) {
xxx_messageInfo_TableFileDetails.Merge(m, src)
}
func (m *TableFileDetails) XXX_Size() int {
return xxx_messageInfo_TableFileDetails.Size(m)
}
func (m *TableFileDetails) XXX_DiscardUnknown() {
xxx_messageInfo_TableFileDetails.DiscardUnknown(m)
}
var xxx_messageInfo_TableFileDetails proto.InternalMessageInfo
func (m *TableFileDetails) GetId() []byte {
if m != nil {
return m.Id
}
return nil
}
func (m *TableFileDetails) GetContentLength() uint64 {
if m != nil {
return m.ContentLength
}
return 0
}
func (m *TableFileDetails) GetContentHash() []byte {
if m != nil {
return m.ContentHash
}
return nil
}
type GetUploadLocsRequest struct {
RepoId *RepoId `protobuf:"bytes,1,opt,name=repo_id,json=repoId,proto3" json:"repo_id,omitempty"`
TableFileHashes [][]byte `protobuf:"bytes,2,rep,name=table_file_hashes,json=tableFileHashes,proto3" json:"table_file_hashes,omitempty"`
TableFileDetails []*TableFileDetails `protobuf:"bytes,3,rep,name=table_file_details,json=tableFileDetails,proto3" json:"table_file_details,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUploadLocsRequest) Reset() { *m = GetUploadLocsRequest{} }
func (m *GetUploadLocsRequest) String() string { return proto.CompactTextString(m) }
func (*GetUploadLocsRequest) ProtoMessage() {}
func (*GetUploadLocsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{11}
return fileDescriptor_702c187af9ca94ec, []int{12}
}
func (m *GetUploadLocsRequest) XXX_Unmarshal(b []byte) error {
@@ -632,6 +688,13 @@ func (m *GetUploadLocsRequest) GetTableFileHashes() [][]byte {
return nil
}
func (m *GetUploadLocsRequest) GetTableFileDetails() []*TableFileDetails {
if m != nil {
return m.TableFileDetails
}
return nil
}
type GetUploadLocsResponse struct {
Locs []*UploadLoc `protobuf:"bytes,1,rep,name=locs,proto3" json:"locs,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -643,7 +706,7 @@ func (m *GetUploadLocsResponse) Reset() { *m = GetUploadLocsResponse{} }
func (m *GetUploadLocsResponse) String() string { return proto.CompactTextString(m) }
func (*GetUploadLocsResponse) ProtoMessage() {}
func (*GetUploadLocsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{12}
return fileDescriptor_702c187af9ca94ec, []int{13}
}
func (m *GetUploadLocsResponse) XXX_Unmarshal(b []byte) error {
@@ -682,7 +745,7 @@ func (m *RebaseRequest) Reset() { *m = RebaseRequest{} }
func (m *RebaseRequest) String() string { return proto.CompactTextString(m) }
func (*RebaseRequest) ProtoMessage() {}
func (*RebaseRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{13}
return fileDescriptor_702c187af9ca94ec, []int{14}
}
func (m *RebaseRequest) XXX_Unmarshal(b []byte) error {
@@ -720,7 +783,7 @@ func (m *RebaseResponse) Reset() { *m = RebaseResponse{} }
func (m *RebaseResponse) String() string { return proto.CompactTextString(m) }
func (*RebaseResponse) ProtoMessage() {}
func (*RebaseResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{14}
return fileDescriptor_702c187af9ca94ec, []int{15}
}
func (m *RebaseResponse) XXX_Unmarshal(b []byte) error {
@@ -752,7 +815,7 @@ func (m *RootRequest) Reset() { *m = RootRequest{} }
func (m *RootRequest) String() string { return proto.CompactTextString(m) }
func (*RootRequest) ProtoMessage() {}
func (*RootRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{15}
return fileDescriptor_702c187af9ca94ec, []int{16}
}
func (m *RootRequest) XXX_Unmarshal(b []byte) error {
@@ -791,7 +854,7 @@ func (m *RootResponse) Reset() { *m = RootResponse{} }
func (m *RootResponse) String() string { return proto.CompactTextString(m) }
func (*RootResponse) ProtoMessage() {}
func (*RootResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{16}
return fileDescriptor_702c187af9ca94ec, []int{17}
}
func (m *RootResponse) XXX_Unmarshal(b []byte) error {
@@ -831,7 +894,7 @@ func (m *ChunkTableInfo) Reset() { *m = ChunkTableInfo{} }
func (m *ChunkTableInfo) String() string { return proto.CompactTextString(m) }
func (*ChunkTableInfo) ProtoMessage() {}
func (*ChunkTableInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{17}
return fileDescriptor_702c187af9ca94ec, []int{18}
}
func (m *ChunkTableInfo) XXX_Unmarshal(b []byte) error {
@@ -881,7 +944,7 @@ func (m *CommitRequest) Reset() { *m = CommitRequest{} }
func (m *CommitRequest) String() string { return proto.CompactTextString(m) }
func (*CommitRequest) ProtoMessage() {}
func (*CommitRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{18}
return fileDescriptor_702c187af9ca94ec, []int{19}
}
func (m *CommitRequest) XXX_Unmarshal(b []byte) error {
@@ -948,7 +1011,7 @@ func (m *CommitResponse) Reset() { *m = CommitResponse{} }
func (m *CommitResponse) String() string { return proto.CompactTextString(m) }
func (*CommitResponse) ProtoMessage() {}
func (*CommitResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{19}
return fileDescriptor_702c187af9ca94ec, []int{20}
}
func (m *CommitResponse) XXX_Unmarshal(b []byte) error {
@@ -988,7 +1051,7 @@ func (m *GetRepoMetadataRequest) Reset() { *m = GetRepoMetadataRequest{}
func (m *GetRepoMetadataRequest) String() string { return proto.CompactTextString(m) }
func (*GetRepoMetadataRequest) ProtoMessage() {}
func (*GetRepoMetadataRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{20}
return fileDescriptor_702c187af9ca94ec, []int{21}
}
func (m *GetRepoMetadataRequest) XXX_Unmarshal(b []byte) error {
@@ -1039,7 +1102,7 @@ func (m *GetRepoMetadataResponse) Reset() { *m = GetRepoMetadataResponse
func (m *GetRepoMetadataResponse) String() string { return proto.CompactTextString(m) }
func (*GetRepoMetadataResponse) ProtoMessage() {}
func (*GetRepoMetadataResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{21}
return fileDescriptor_702c187af9ca94ec, []int{22}
}
func (m *GetRepoMetadataResponse) XXX_Unmarshal(b []byte) error {
@@ -1086,7 +1149,7 @@ func (m *ClientRepoFormat) Reset() { *m = ClientRepoFormat{} }
func (m *ClientRepoFormat) String() string { return proto.CompactTextString(m) }
func (*ClientRepoFormat) ProtoMessage() {}
func (*ClientRepoFormat) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{22}
return fileDescriptor_702c187af9ca94ec, []int{23}
}
func (m *ClientRepoFormat) XXX_Unmarshal(b []byte) error {
@@ -1132,7 +1195,7 @@ func (m *ListTableFilesRequest) Reset() { *m = ListTableFilesRequest{} }
func (m *ListTableFilesRequest) String() string { return proto.CompactTextString(m) }
func (*ListTableFilesRequest) ProtoMessage() {}
func (*ListTableFilesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{23}
return fileDescriptor_702c187af9ca94ec, []int{24}
}
func (m *ListTableFilesRequest) XXX_Unmarshal(b []byte) error {
@@ -1173,7 +1236,7 @@ func (m *TableFileInfo) Reset() { *m = TableFileInfo{} }
func (m *TableFileInfo) String() string { return proto.CompactTextString(m) }
func (*TableFileInfo) ProtoMessage() {}
func (*TableFileInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{24}
return fileDescriptor_702c187af9ca94ec, []int{25}
}
func (m *TableFileInfo) XXX_Unmarshal(b []byte) error {
@@ -1227,7 +1290,7 @@ func (m *ListTableFilesResponse) Reset() { *m = ListTableFilesResponse{}
func (m *ListTableFilesResponse) String() string { return proto.CompactTextString(m) }
func (*ListTableFilesResponse) ProtoMessage() {}
func (*ListTableFilesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{25}
return fileDescriptor_702c187af9ca94ec, []int{26}
}
func (m *ListTableFilesResponse) XXX_Unmarshal(b []byte) error {
@@ -1275,7 +1338,7 @@ func (m *AddTableFilesRequest) Reset() { *m = AddTableFilesRequest{} }
func (m *AddTableFilesRequest) String() string { return proto.CompactTextString(m) }
func (*AddTableFilesRequest) ProtoMessage() {}
func (*AddTableFilesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{26}
return fileDescriptor_702c187af9ca94ec, []int{27}
}
func (m *AddTableFilesRequest) XXX_Unmarshal(b []byte) error {
@@ -1328,7 +1391,7 @@ func (m *AddTableFilesResponse) Reset() { *m = AddTableFilesResponse{} }
func (m *AddTableFilesResponse) String() string { return proto.CompactTextString(m) }
func (*AddTableFilesResponse) ProtoMessage() {}
func (*AddTableFilesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_702c187af9ca94ec, []int{27}
return fileDescriptor_702c187af9ca94ec, []int{28}
}
func (m *AddTableFilesResponse) XXX_Unmarshal(b []byte) error {
@@ -1368,6 +1431,7 @@ func init() {
proto.RegisterType((*UploadLoc)(nil), "dolt.services.remotesapi.v1alpha1.UploadLoc")
proto.RegisterType((*GetDownloadLocsRequest)(nil), "dolt.services.remotesapi.v1alpha1.GetDownloadLocsRequest")
proto.RegisterType((*GetDownloadLocsResponse)(nil), "dolt.services.remotesapi.v1alpha1.GetDownloadLocsResponse")
proto.RegisterType((*TableFileDetails)(nil), "dolt.services.remotesapi.v1alpha1.TableFileDetails")
proto.RegisterType((*GetUploadLocsRequest)(nil), "dolt.services.remotesapi.v1alpha1.GetUploadLocsRequest")
proto.RegisterType((*GetUploadLocsResponse)(nil), "dolt.services.remotesapi.v1alpha1.GetUploadLocsResponse")
proto.RegisterType((*RebaseRequest)(nil), "dolt.services.remotesapi.v1alpha1.RebaseRequest")
@@ -1392,78 +1456,83 @@ func init() {
}
var fileDescriptor_702c187af9ca94ec = []byte{
// 1136 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x6f, 0x1b, 0x45,
0x10, 0xcf, 0xd9, 0xc1, 0x89, 0xc7, 0x1f, 0x71, 0x4e, 0x4d, 0x6a, 0x19, 0xa1, 0xa6, 0x2b, 0x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ytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdf, 0x6f, 0x1b, 0xc5,
0x13, 0xef, 0xd9, 0xf9, 0x3a, 0xf1, 0xf8, 0x47, 0x9d, 0x55, 0x93, 0x5a, 0xfe, 0x0a, 0x35, 0x3d,
0xa9, 0x28, 0xb4, 0xd4, 0x6e, 0xd2, 0x4a, 0x6d, 0xe1, 0x05, 0x92, 0xb6, 0x71, 0xa4, 0x80, 0xca,
0xa6, 0x50, 0x42, 0x84, 0xac, 0xf3, 0x79, 0x6d, 0x9f, 0x38, 0xdf, 0xba, 0xb7, 0xeb, 0xf0, 0x88,
0x84, 0x40, 0xf0, 0x82, 0x78, 0xe1, 0x89, 0x7f, 0x06, 0xf8, 0x73, 0xf8, 0x2f, 0xd0, 0xce, 0xee,
0x39, 0x77, 0x57, 0x57, 0xd9, 0x54, 0x86, 0xb7, 0xec, 0x64, 0x67, 0xe6, 0x33, 0x9f, 0xf9, 0xb1,
0x73, 0x86, 0xdd, 0x01, 0x0f, 0x65, 0x47, 0xb0, 0xf8, 0x2c, 0xf0, 0x99, 0xe8, 0xc4, 0x6c, 0xc2,
0x25, 0x13, 0xde, 0x34, 0xe8, 0x9c, 0xed, 0x78, 0xe1, 0x74, 0xec, 0xed, 0x74, 0xfc, 0xf1, 0x2c,
0xfa, 0x46, 0x48, 0x1e, 0xb3, 0xf6, 0x34, 0xe6, 0x92, 0x93, 0x9b, 0x4a, 0xa7, 0x9d, 0xe8, 0xb4,
0xcf, 0x75, 0xda, 0x89, 0x8e, 0xfb, 0x10, 0x4a, 0x94, 0x4d, 0xf9, 0xe1, 0x80, 0x34, 0xa0, 0xc8,
0xe3, 0x51, 0xd3, 0xd9, 0x72, 0xb6, 0xcb, 0x54, 0xfd, 0x49, 0xfe, 0x0f, 0xe5, 0x98, 0x4d, 0x79,
0x2f, 0xf2, 0x26, 0xac, 0x59, 0x40, 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 0x5c, 0x99, 0x9d, 0xc5, 0x2a, 0xae, 0xdc, 0x13, 0xfd, 0xa3, 0x03, 0xf5, 0xec, 0x6c,
0x25, 0x36, 0x39, 0x59, 0xf8, 0x8e, 0xb4, 0x1e, 0xbf, 0x85, 0xa6, 0xc1, 0xf1, 0xbd, 0x03, 0xb5,
0xcc, 0xd4, 0xb0, 0xaa, 0xa9, 0x45, 0x33, 0xd8, 0xaa, 0xa6, 0x16, 0x0e, 0xa8, 0xbd, 0x93, 0xaf,
0x5e, 0x8e, 0x02, 0x39, 0x9e, 0xf5, 0xdb, 0x3e, 0x9f, 0x74, 0xc2, 0xe0, 0xd5, 0x2c, 0x50, 0x53,
0xe0, 0x6e, 0x10, 0xf9, 0x1d, 0xfc, 0x19, 0x66, 0xc4, 0x3b, 0x23, 0x16, 0x75, 0xf0, 0x57, 0x96,
0xce, 0x85, 0x3f, 0xcc, 0x7c, 0x78, 0x2e, 0xeb, 0x97, 0x50, 0xe7, 0xfe, 0x3f, 0x01, 0x00, 0x00,
0xff, 0xff, 0x9b, 0x26, 0xa3, 0x10, 0xcf, 0x11, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@@ -196,6 +196,8 @@ github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191003230430-3a1a09c79ada h1:2D7VUQT4JHEB1N3xUG/MqULhDfWWg65LmPDBjXWBZcs=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191003230430-3a1a09c79ada/go.mod h1:DdWE0ku/mNfuLsRJIrHeHpDtB7am+6oopxEsQKmVkx8=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191017183442-4b9329eafa5b h1:fdht6iaUhHYJEfSUY1m1KAghyi6zfyfv+12gaSsaQ+o=
github.com/liquidata-inc/go-mysql-server v0.4.1-0.20191017183442-4b9329eafa5b/go.mod h1:DdWE0ku/mNfuLsRJIrHeHpDtB7am+6oopxEsQKmVkx8=
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0 h1:phMgajKClMUiIr+hF2LGt8KRuUa2Vd2GI1sNgHgSXoU=
github.com/liquidata-inc/ishell v0.0.0-20190514193646-693241f1f2a0/go.mod h1:YC1rI9k5gx8D02ljlbxDfZe80s/iq8bGvaaQsvR+qxs=
github.com/liquidata-inc/mmap-go v1.0.3 h1:2LndAeAtup9rpvUmu4wZSYCsjCQ0Zpc+NqE+6+PnT7g=

View File

@@ -893,9 +893,20 @@ func (dcs *DoltChunkStore) getDownloadWorkForLoc(ctx context.Context, getRange *
}
// WriteTableFile reads a table file from the provided reader and writes it to the chunk store.
func (dcs *DoltChunkStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader) error {
func (dcs *DoltChunkStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader, contentLength uint64, contentHash []byte) error {
fileIdBytes := hash.Parse(fileId)
req := &remotesapi.GetUploadLocsRequest{RepoId: dcs.getRepoId(), TableFileHashes: [][]byte{fileIdBytes[:]}}
tfd := &remotesapi.TableFileDetails{
Id: fileIdBytes[:],
ContentLength: contentLength,
ContentHash: contentHash,
}
req := &remotesapi.GetUploadLocsRequest{
RepoId: dcs.getRepoId(),
TableFileDetails: []*remotesapi.TableFileDetails{tfd},
// redundant and deprecated. Still setting for compatibility, but will remove promptly.
TableFileHashes: [][]byte{fileIdBytes[:]},
}
resp, err := dcs.csClient.GetUploadLocations(ctx, req)
if err != nil {

View File

@@ -132,7 +132,7 @@ func clone(ctx context.Context, srcTS, sinkTS nbs.TableFileStore, eventCh chan<-
}
}()
err = sinkTS.WriteTableFile(ctx, tblFile.FileID(), tblFile.NumChunks(), rd)
err = sinkTS.WriteTableFile(ctx, tblFile.FileID(), tblFile.NumChunks(), rd, 0, nil)
if err != nil {
if eventCh != nil {

View File

@@ -421,7 +421,7 @@ func (ttfs *TestTableFileStore) Sources(ctx context.Context) (hash.Hash, []nbs.T
return ttfs.root, tblFiles, nil
}
func (ttfs *TestTableFileStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader) error {
func (ttfs *TestTableFileStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader, contentLength uint64, contentHash []byte) error {
tblFile := &TestTableFileWriter{fileId, numChunks, bytes.NewBuffer(nil), ttfs}
_, err := io.Copy(tblFile, rd)

View File

@@ -182,9 +182,11 @@ func NewPuller(ctx context.Context, tempDir string, chunksPerTF int, srcDB, sink
func (p *Puller) processCompletedTables(ctx context.Context, ae *atomicerr.AtomicError, completedTables <-chan FilledWriters) {
type tempTblFile struct {
id string
path string
numChunks int
id string
path string
numChunks int
contentLen uint64
contentHash []byte
}
var tblFiles []tempTblFile
@@ -209,7 +211,13 @@ func (p *Puller) processCompletedTables(ctx context.Context, ae *atomicerr.Atomi
continue
}
tblFiles = append(tblFiles, tempTblFile{id, path, tblFile.wr.Size()})
tblFiles = append(tblFiles, tempTblFile{
id: id,
path: path,
numChunks: tblFile.wr.Size(),
contentLen: tblFile.wr.ContentLength(),
contentHash: tblFile.wr.GetMD5(),
})
}
if ae.IsSet() {
@@ -239,7 +247,7 @@ func (p *Puller) processCompletedTables(ctx context.Context, ae *atomicerr.Atomi
p.eventCh <- NewTFPullerEvent(StartUploadTableFile, details)
fWithSize := FileReaderWithSize{f, fi.Size()}
err = p.sinkDB.chunkStore().(nbs.TableFileStore).WriteTableFile(ctx, tmpTblFile.id, tmpTblFile.numChunks, fWithSize)
err = p.sinkDB.chunkStore().(nbs.TableFileStore).WriteTableFile(ctx, tmpTblFile.id, tmpTblFile.numChunks, fWithSize, tmpTblFile.contentLen, tmpTblFile.contentHash)
go func() {
_ = os.Remove(tmpTblFile.path)

View File

@@ -15,7 +15,9 @@
package nbs
import (
"crypto/md5"
"errors"
"hash"
"io"
"os"
"path/filepath"
@@ -287,3 +289,58 @@ func (sink *BufferedFileByteSink) FlushToFile(path string) (err error) {
return os.Rename(sink.path, path)
}
// HashingByteSink is a ByteSink that keeps an md5 hash of all the data written to it.
type HashingByteSink struct {
backingSink ByteSink
hasher hash.Hash
size uint64
}
func NewHashingByteSink(backingSink ByteSink) *HashingByteSink {
return &HashingByteSink{backingSink: backingSink, hasher: md5.New(), size: 0}
}
// Write writes a byte array to the sink.
func (sink *HashingByteSink) Write(src []byte) (int, error) {
nWritten, err := sink.backingSink.Write(src)
if err != nil {
return 0, err
}
nHashed, err := sink.hasher.Write(src[:nWritten])
if err != nil {
return 0, err
} else if nWritten != nHashed {
return 0, errors.New("failed to hash all the data that was written to the byte sink.")
}
sink.size += uint64(nWritten)
return nWritten, nil
}
// Flush writes all the data that was written to the ByteSink to the supplied writer
func (sink *HashingByteSink) Flush(wr io.Writer) error {
return sink.backingSink.Flush(wr)
}
// FlushToFile writes all the data that was written to the ByteSink to a file at the given path
func (sink *HashingByteSink) FlushToFile(path string) error {
return sink.backingSink.FlushToFile(path)
}
// GetMD5 gets the MD5 hash of all the bytes written to the sink
func (sink *HashingByteSink) GetMD5() []byte {
result := make([]byte, 0, 128)
sink.hasher.Sum(result)
return result
}
// Size gets the number of bytes written to the sink
func (sink *HashingByteSink) Size() uint64 {
return sink.size
}

View File

@@ -36,7 +36,7 @@ var ErrAlreadyFinished = errors.New("already Finished")
// CmpChunkTableWriter writes CompressedChunks to a table file
type CmpChunkTableWriter struct {
sink ByteSink
sink *HashingByteSink
totalCompressedData uint64
totalUncompressedData uint64
prefixes prefixIndexSlice // TODO: This is in danger of exploding memory
@@ -51,7 +51,7 @@ func NewCmpChunkTableWriter() (*CmpChunkTableWriter, error) {
return nil, err
}
return &CmpChunkTableWriter{s, 0, 0, nil, nil}, nil
return &CmpChunkTableWriter{NewHashingByteSink(s), 0, 0, nil, nil}, nil
}
// Size returns the number of compressed chunks that have been added
@@ -59,6 +59,16 @@ func (tw *CmpChunkTableWriter) Size() int {
return len(tw.prefixes)
}
// Gets the size of the entire table file in bytes
func (tw *CmpChunkTableWriter) ContentLength() uint64 {
return tw.sink.Size()
}
// Gets the MD5 of the entire table file
func (tw *CmpChunkTableWriter) GetMD5() []byte {
return tw.sink.GetMD5()
}
// AddCmpChunk adds a compressed chunk
func (tw *CmpChunkTableWriter) AddCmpChunk(c CompressedChunk) error {
if len(c.CompressedData) == 0 {

View File

@@ -933,7 +933,7 @@ func (nbs *NomsBlockStore) Sources(ctx context.Context) (hash.Hash, []TableFile,
}
// WriteTableFile will read a table file from the provided reader and write it to the TableFileStore
func (nbs *NomsBlockStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader) error {
func (nbs *NomsBlockStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader, contentLength uint64, contentHash []byte) error {
fsPersister, ok := nbs.p.(*fsTablePersister)
if !ok {

View File

@@ -51,7 +51,7 @@ func TestNBSAsTableFileStore(t *testing.T) {
data, addr, err := buildTable(chunkData)
fileID := addr.String()
fileToData[fileID] = data
err = st.WriteTableFile(ctx, fileID, i+1, bytes.NewReader(data))
err = st.WriteTableFile(ctx, fileID, i+1, bytes.NewReader(data), 0, nil)
require.NoError(t, err)
}

View File

@@ -286,7 +286,7 @@ type TableFileStore interface {
Sources(ctx context.Context) (hash.Hash, []TableFile, error)
// WriteTableFile will read a table file from the provided reader and write it to the TableFileStore
WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader) error
WriteTableFile(ctx context.Context, fileId string, numChunks int, rd io.Reader, contentLength uint64, contentHash []byte) error
// SetRootChunk changes the root chunk hash from the previous value to the new root.
SetRootChunk(ctx context.Context, root, previous hash.Hash) error

View File

@@ -127,6 +127,25 @@ func (rs *RemoteChunkStore) getDownloadUrl(logger func(string), org, repoName, f
return fmt.Sprintf("http://%s/%s/%s/%s", rs.HttpHost, org, repoName, fileId), nil
}
func parseTableFileDetails(req *remotesapi.GetUploadLocsRequest) []*remotesapi.TableFileDetails {
tfd := req.GetTableFileDetails()
if len(tfd) == 0 {
_, hashToIdx := remotestorage.ParseByteSlices(req.TableFileHashes)
tfd = make([]*remotesapi.TableFileDetails, len(hashToIdx))
for h, i := range hashToIdx {
tfd[i] = &remotesapi.TableFileDetails{
Id: h[:],
ContentLength: 0,
ContentHash: nil,
}
}
}
return tfd
}
func (rs *RemoteChunkStore) GetUploadLocations(ctx context.Context, req *remotesapi.GetUploadLocsRequest) (*remotesapi.GetUploadLocsResponse, error) {
logger := getReqLogger("GRPC", "GetUploadLocations")
defer func() { logger("finished") }()
@@ -141,19 +160,19 @@ func (rs *RemoteChunkStore) GetUploadLocations(ctx context.Context, req *remotes
org := req.RepoId.Org
repoName := req.RepoId.RepoName
hashes, _ := remotestorage.ParseByteSlices(req.TableFileHashes)
tfds := parseTableFileDetails(req)
var locs []*remotesapi.UploadLoc
for h := range hashes {
tmp := h
url, err := rs.getUploadUrl(logger, org, repoName, h.String())
for _, tfd := range tfds {
h := hash.New(tfd.Id)
url, err := rs.getUploadUrl(logger, org, repoName, tfd)
if err != nil {
return nil, status.Error(codes.Internal, "Failed to get upload Url.")
}
loc := &remotesapi.UploadLoc_HttpPost{HttpPost: &remotesapi.HttpPostTableFile{Url: url}}
locs = append(locs, &remotesapi.UploadLoc{TableFileHash: tmp[:], Location: loc})
locs = append(locs, &remotesapi.UploadLoc{TableFileHash: h[:], Location: loc})
logger(fmt.Sprintf("sending upload location for chunk %s: %s", h.String(), url))
}
@@ -161,8 +180,10 @@ func (rs *RemoteChunkStore) GetUploadLocations(ctx context.Context, req *remotes
return &remotesapi.GetUploadLocsResponse{Locs: locs}, nil
}
func (rs *RemoteChunkStore) getUploadUrl(logger func(string), org, repoName, fileId string) (string, error) {
return fmt.Sprintf("http://%s/%s/%s/%s", rs.HttpHost, org, repoName, fileId), nil
func (rs *RemoteChunkStore) getUploadUrl(logger func(string), org, repoName string, tfd *remotesapi.TableFileDetails) (string, error) {
fileID := hash.New(tfd.Id).String()
expectedFiles[fileID] = *tfd
return fmt.Sprintf("http://%s/%s/%s/%s", rs.HttpHost, org, repoName, fileID), nil
}
func (rs *RemoteChunkStore) Rebase(ctx context.Context, req *remotesapi.RebaseRequest) (*remotesapi.RebaseResponse, error) {

View File

@@ -15,6 +15,8 @@
package main
import (
"bytes"
"crypto/md5"
"errors"
"fmt"
"io"
@@ -25,10 +27,14 @@ import (
"strconv"
"strings"
remotesapi "github.com/liquidata-inc/dolt/go/gen/proto/dolt/services/remotesapi/v1alpha1"
"github.com/liquidata-inc/dolt/go/libraries/utils/iohelp"
"github.com/liquidata-inc/dolt/go/store/hash"
)
var expectedFiles = make(map[string]remotesapi.TableFileDetails)
func ServeHTTP(respWr http.ResponseWriter, req *http.Request) {
logger := getReqLogger("HTTP_"+req.Method, req.RequestURI)
defer func() { logger("finished") }()
@@ -57,7 +63,7 @@ func ServeHTTP(respWr http.ResponseWriter, req *http.Request) {
}
case http.MethodPost, http.MethodPut:
statusCode = writeChunk(logger, org, repo, hashStr, req)
statusCode = writeTableFile(logger, org, repo, hashStr, req)
}
if statusCode != -1 {
@@ -65,7 +71,7 @@ func ServeHTTP(respWr http.ResponseWriter, req *http.Request) {
}
}
func writeChunk(logger func(string), org, repo, fileId string, request *http.Request) int {
func writeTableFile(logger func(string), org, repo, fileId string, request *http.Request) int {
_, ok := hash.MaybeParse(fileId)
if !ok {
@@ -73,9 +79,37 @@ func writeChunk(logger func(string), org, repo, fileId string, request *http.Req
return http.StatusBadRequest
}
tfd, ok := expectedFiles[fileId]
if !ok {
return http.StatusBadRequest
}
logger(fileId + " is valid")
data, err := ioutil.ReadAll(request.Body)
if tfd.ContentLength != 0 && tfd.ContentLength != uint64(len(data)) {
return http.StatusBadRequest
}
if len(tfd.ContentHash) > 0 {
hasher := md5.New()
n, err := hasher.Write(data)
if err != nil {
return http.StatusInternalServerError
} else if n != len(data) {
return http.StatusInternalServerError
}
actualMD5Bytes := make([]byte, 0, 128)
hasher.Sum(actualMD5Bytes)
if !bytes.Equal(tfd.ContentHash, actualMD5Bytes) {
return http.StatusBadRequest
}
}
if err != nil {
logger("failed to read body " + err.Error())
return http.StatusInternalServerError

View File

@@ -98,9 +98,16 @@ message GetDownloadLocsResponse {
repeated DownloadLoc locs = 1;
}
message TableFileDetails {
bytes id = 1;
uint64 content_length = 2;
bytes content_hash = 3;
}
message GetUploadLocsRequest {
RepoId repo_id = 1;
repeated bytes table_file_hashes = 2;
repeated bytes table_file_hashes = 2 [deprecated = true];
repeated TableFileDetails table_file_details = 3;
}
message GetUploadLocsResponse {