-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lastsyncbytes and lastsyncduration to vol rep status #366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -380,6 +380,17 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re | |
if ts != nil { | ||
lastSyncTime := metav1.NewTime(ts.AsTime()) | ||
instance.Status.LastSyncTime = &lastSyncTime | ||
instance.Status.LastSyncDuration = nil | ||
instance.Status.LastSyncBytes = nil | ||
td := info.GetLastSyncDuration() | ||
if td != nil { | ||
lastSyncDuration := metav1.Duration{Duration: td.AsDuration()} | ||
instance.Status.LastSyncDuration = &lastSyncDuration | ||
} | ||
tb := info.GetLastSyncBytes() | ||
if tb != 0 { | ||
instance.Status.LastSyncBytes = &tb | ||
} | ||
Comment on lines
+385
to
+393
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fields should be explicitly set to nil to indicate missing value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure about this, considering the corner case where lastsynctime retains its value and on requeue other values will be nil. Will verify this once and update if it's fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On line 91 (wow, what a horrible long function this is?!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Rakshith-R @nixpanic IMO we should not set this to nil explicitly #366 (comment) |
||
} | ||
requeueForInfo = true | ||
} else if !util.IsUnimplementedError(err) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// Protocol Buffers - Google's data interchange format | ||
// Copyright 2008 Google Inc. All rights reserved. | ||
// https://developers.google.com/protocol-buffers/ | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
syntax = "proto3"; | ||
|
||
package google.protobuf; | ||
|
||
option cc_enable_arenas = true; | ||
option go_package = "google.golang.org/protobuf/types/known/durationpb"; | ||
option java_package = "com.google.protobuf"; | ||
option java_outer_classname = "DurationProto"; | ||
option java_multiple_files = true; | ||
option objc_class_prefix = "GPB"; | ||
option csharp_namespace = "Google.Protobuf.WellKnownTypes"; | ||
|
||
// A Duration represents a signed, fixed-length span of time represented | ||
// as a count of seconds and fractions of seconds at nanosecond | ||
// resolution. It is independent of any calendar and concepts like "day" | ||
// or "month". It is related to Timestamp in that the difference between | ||
// two Timestamp values is a Duration and it can be added or subtracted | ||
// from a Timestamp. Range is approximately +-10,000 years. | ||
// | ||
// # Examples | ||
// | ||
// Example 1: Compute Duration from two Timestamps in pseudo code. | ||
// | ||
// Timestamp start = ...; | ||
// Timestamp end = ...; | ||
// Duration duration = ...; | ||
// | ||
// duration.seconds = end.seconds - start.seconds; | ||
// duration.nanos = end.nanos - start.nanos; | ||
// | ||
// if (duration.seconds < 0 && duration.nanos > 0) { | ||
// duration.seconds += 1; | ||
// duration.nanos -= 1000000000; | ||
// } else if (duration.seconds > 0 && duration.nanos < 0) { | ||
// duration.seconds -= 1; | ||
// duration.nanos += 1000000000; | ||
// } | ||
// | ||
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. | ||
// | ||
// Timestamp start = ...; | ||
// Duration duration = ...; | ||
// Timestamp end = ...; | ||
// | ||
// end.seconds = start.seconds + duration.seconds; | ||
// end.nanos = start.nanos + duration.nanos; | ||
// | ||
// if (end.nanos < 0) { | ||
// end.seconds -= 1; | ||
// end.nanos += 1000000000; | ||
// } else if (end.nanos >= 1000000000) { | ||
// end.seconds += 1; | ||
// end.nanos -= 1000000000; | ||
// } | ||
// | ||
// Example 3: Compute Duration from datetime.timedelta in Python. | ||
// | ||
// td = datetime.timedelta(days=3, minutes=10) | ||
// duration = Duration() | ||
// duration.FromTimedelta(td) | ||
// | ||
// # JSON Mapping | ||
// | ||
// In JSON format, the Duration type is encoded as a string rather than an | ||
// object, where the string ends in the suffix "s" (indicating seconds) and | ||
// is preceded by the number of seconds, with nanoseconds expressed as | ||
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be | ||
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should | ||
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 | ||
// microsecond should be expressed in JSON format as "3.000001s". | ||
// | ||
message Duration { | ||
// Signed seconds of the span of time. Must be from -315,576,000,000 | ||
// to +315,576,000,000 inclusive. Note: these bounds are computed from: | ||
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years | ||
int64 seconds = 1; | ||
|
||
// Signed fractions of a second at nanosecond resolution of the span | ||
// of time. Durations less than one second are represented with a 0 | ||
// `seconds` field and a positive or negative `nanos` field. For durations | ||
// of one second or more, a non-zero value for the `nanos` field must be | ||
// of the same sign as the `seconds` field. Must be from -999,999,999 | ||
// to +999,999,999 inclusive. | ||
int32 nanos = 2; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think you should make this nil. You should preserve the last data because you already have lastSyncTime, Duration, Byte to give to complete sync information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Madhu-1 ,
We'll reach this point only when csi driver gives us a valid new lastSyncTime.
It'll be incorrect to keep previous duration and bytes data with new lastSyncTime according to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, just read the code, LGTM