-
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
Conversation
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.
Can you please add controller and sidecar changes too (in same pr) and (keep it in draft) / open it for review when completed ?
LastStartTime *metav1.Time `json:"lastStartTime,omitempty"` | ||
LastCompletionTime *metav1.Time `json:"lastCompletionTime,omitempty"` | ||
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"` | ||
LastSyncBytes int64 `json:"lastSyncBytes,omitempty"` |
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.
LastSyncBytes int64 `json:"lastSyncBytes,omitempty"` | |
LastSyncBytes *int64 `json:"lastSyncBytes,omitempty"` |
This should be a pointer since it is a optional parameter,
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.
the duration.proto
file should probably be moved to the commit where it is imported.
format: int64 | ||
type: integer | ||
lastSyncDuration: | ||
format: date-time |
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.
is this really date-time? is there not a duration
format, there is no date in this, I think?
@yati1998 make sure to install protoc v3.19.6, or do not commit the changes in the version of the There is also a crd generation issue, it seems that the duration can not have a |
yeah sure, I am testing with changes, once it is successful, I will update all. |
internal/proto/networkfence.pb.go
Outdated
@@ -1,7 +1,7 @@ | |||
// Code generated by protoc-gen-go. DO NOT EDIT. | |||
// versions: | |||
// protoc-gen-go v1.30.0 | |||
// protoc v3.19.6 |
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.
You are using an old version to re-generate these files, please use protoc v3.19.6
37b2062
to
5f45cec
Compare
Working on to revert the protobuf version issue, meanwhile please do review the PR. |
LastSyncDuration: lastsyncduration, | ||
LastSyncBytes: lastsyncbytes, |
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.
instead of new variables you can directly use resp.GetLastSyncDuration() and resp.GetLastSyncBytes() here
internal/proto/replication.proto
Outdated
// This field is OPTIONAL. | ||
.google.protobuf.Duration last_sync_duration = 2; | ||
// This field is OPTIONAL. | ||
// A value of 0 is equal to an unspecified field value. | ||
// The value of this field MUST NOT be negative. | ||
int64 last_sync_bytes = 3; |
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.
Make sure to match the comments with csi-addons spec or close to it.
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.
This has to be edited in spec then, cause it's required to clear it here, will send another PR to update spec comments
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 meant to update it here.
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 | ||
} |
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.
Fields should be explicitly set to nil to indicate missing value.
otherwise, they may inherit values that were previously set.
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 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 comment
The reason will be displayed to describe this comment to others. Learn more.
On line 91 (wow, what a horrible long function this is?!) instance
is fetched, so it will have a .Status.LastSyncBytes
from the previous reconcile. If there were 0 bytes in the last sync, the information would not be correct in the object. So yes, setting it explicitly to an initial value is probably a good thing.
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.
yeah done
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.
@Rakshith-R @nixpanic IMO we should not set this to nil explicitly #366 (comment)
This commit adds lastsyncbytes and lastsyncduration to volume replication status and generates updated crds. Signed-off-by: yati1998 <[email protected]>
Addressed the changes, @Rakshith-R @nixpanic |
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.
a small nit
internal/proto/replication.proto
Outdated
// last_sync_duration states the time taken to sync | ||
// to execute the last sync operation. |
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.
// last_sync_duration states the time taken to sync | |
// to execute the last sync operation. | |
// last_sync_duration represents the time taken | |
// to execute the last sync operation. |
This commit updates the getvolumereplicationinfo rpc to include lastsyncbytes and lastsyncduration. Signed-off-by: yati1998 <[email protected]>
This commit updates the vendor directory to include lastest spec. Signed-off-by: yati1998 <[email protected]>
This commit updates the reconcile logic to get more info and update the volrep status. Signed-off-by: yati1998 <[email protected]>
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.
Thanks !
instance.Status.LastSyncDuration = nil | ||
instance.Status.LastSyncBytes = nil |
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.
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.
@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
This PR adds lastsyncbytes and lastsyncduration to volume replication status and generates updated crds.
Also it adds the logic to update the status in the volume replication object.