handle DryRun send size estimate errors with bookmarks

This commit is contained in:
Christian Schwarz
2018-09-05 17:41:25 -07:00
parent 9eca269ad8
commit acd2418803
6 changed files with 39 additions and 15 deletions
+3 -2
View File
@@ -59,7 +59,7 @@ type StepReport struct {
Status StepState
Problem string
Bytes int64
ExpectedBytes int64
ExpectedBytes int64 // 0 means no size estimate possible
}
type Report struct {
@@ -185,7 +185,7 @@ type ReplicationStep struct {
err error
byteCounter *util.ByteCounterReader
expectedSize int64
expectedSize int64 // 0 means no size estimate present / possible
}
func (f *Replication) TakeStep(ctx context.Context, sender Sender, receiver Receiver) (post State, nextStepDate time.Time) {
@@ -457,6 +457,7 @@ func (s *ReplicationStep) updateSizeEstimate(ctx context.Context, sender Sender)
sres, _, err := sender.Send(ctx, sr)
if err != nil {
log.WithError(err).Error("dry run send request failed")
return err
}
s.expectedSize = sres.ExpectedSize
return nil
+2 -1
View File
@@ -493,7 +493,8 @@ func (m *Property) GetValue() string {
type SendRes struct {
// Whether the resume token provided in the request has been used or not.
UsedResumeToken bool `protobuf:"varint,1,opt,name=UsedResumeToken,proto3" json:"UsedResumeToken,omitempty"`
// Expected stream size determined by dry run, not exact
// Expected stream size determined by dry run, not exact.
// 0 indicates that for the given SendReq, no size estimate could be made.
ExpectedSize int64 `protobuf:"varint,2,opt,name=ExpectedSize,proto3" json:"ExpectedSize,omitempty"`
Properties []*Property `protobuf:"bytes,3,rep,name=Properties,proto3" json:"Properties,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
+2 -1
View File
@@ -65,7 +65,8 @@ message SendRes {
// Whether the resume token provided in the request has been used or not.
bool UsedResumeToken = 1;
// Expected stream size determined by dry run, not exact
// Expected stream size determined by dry run, not exact.
// 0 indicates that for the given SendReq, no size estimate could be made.
int64 ExpectedSize = 2;
repeated Property Properties = 3;