Skip to content
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

Merged
merged 4 commits into from
Jun 22, 2023

Conversation

yati1998
Copy link
Contributor

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.

@mergify mergify bot requested review from nixpanic and Rakshith-R June 12, 2023 11:47
@mergify mergify bot added the vendor Pull requests that update vendored dependencies label Jun 12, 2023
Copy link
Member

@Rakshith-R Rakshith-R left a 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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LastSyncBytes int64 `json:"lastSyncBytes,omitempty"`
LastSyncBytes *int64 `json:"lastSyncBytes,omitempty"`

This should be a pointer since it is a optional parameter,

Copy link
Collaborator

@nixpanic nixpanic left a 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
Copy link
Collaborator

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?

@nixpanic
Copy link
Collaborator

@yati1998 make sure to install protoc v3.19.6, or do not commit the changes in the version of the .proto files.

There is also a crd generation issue, it seems that the duration can not have a format: date-time.

@yati1998
Copy link
Contributor Author

@yati1998 make sure to install protoc v3.19.6, or do not commit the changes in the version of the .proto files.

There is also a crd generation issue, it seems that the duration can not have a format: date-time.

yeah sure, I am testing with changes, once it is successful, I will update all.

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.30.0
// protoc v3.19.6
Copy link
Collaborator

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

@yati1998 yati1998 force-pushed the volrepstatus branch 4 times, most recently from 37b2062 to 5f45cec Compare June 21, 2023 11:22
@yati1998
Copy link
Contributor Author

Working on to revert the protobuf version issue, meanwhile please do review the PR.
cc @nixpanic @Rakshith-R @Madhu-1

nixpanic
nixpanic previously approved these changes Jun 21, 2023
Comment on lines 227 to 228
LastSyncDuration: lastsyncduration,
LastSyncBytes: lastsyncbytes,
Copy link
Member

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

@mergify mergify bot dismissed nixpanic’s stale review June 21, 2023 15:54

Pull request has been modified.

@yati1998
Copy link
Contributor Author

@nixpanic and @Madhu-1 can you please revisit it again.

Comment on lines 210 to 221
// 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;
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Comment on lines +383 to +393
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
}
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah done

Copy link
Member

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 <ypadia@redhat.com>
@yati1998
Copy link
Contributor Author

Addressed the changes, @Rakshith-R @nixpanic

Copy link
Member

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a small nit

Comment on lines 211 to 212
// last_sync_duration states the time taken to sync
// to execute the last sync operation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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 <ypadia@redhat.com>
This commit updates the vendor directory to
include lastest spec.

Signed-off-by: yati1998 <ypadia@redhat.com>
This commit updates the reconcile logic to
get more info and update the volrep status.

Signed-off-by: yati1998 <ypadia@redhat.com>
Copy link
Member

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

Comment on lines +383 to +384
instance.Status.LastSyncDuration = nil
instance.Status.LastSyncBytes = nil
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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

@mergify mergify bot merged commit ee9403c into csi-addons:main Jun 22, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vendor Pull requests that update vendored dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

replication: add lastsyncbytes and lastsyncduration to volumereplication object
4 participants