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

sync controller: replace revision file with full diff each interval #1892

Merged
merged 6 commits into from
Sep 27, 2019

Conversation

skriss
Copy link
Contributor

@skriss skriss commented Sep 19, 2019

Signed-off-by: Steve Kriss [email protected]

Closes #1343

This is kind of what I was thinking ref. #1343 (comment). Instead of relying on the revision file to tell us when BSL contents change, we get the full list of backups from the BSL (this is just a single API call to the object store), and do a setwise comparison (based on name) to the backups in the cluster. We then sync/import any ones that are in the BSL but not in the cluster.

I also removed the limitation that the sync period must be >= 1 minute - I figure users should be able to set it lower if they want.

I haven't yet removed the actual updating of the revision file when backups happen - we could choose to leave that in for now, or remove it entirely.

If this makes sense, I'll proceed with tests/etc.

Copy link
Contributor

@prydonius prydonius left a comment

Choose a reason for hiding this comment

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

+1 to this approach, I think this is much much simpler!

pkg/controller/backup_sync_controller.go Show resolved Hide resolved
@skriss
Copy link
Contributor Author

skriss commented Sep 23, 2019

I fixed the tests, and removed the code that gets/sets the metadata/revision file in object storage.

The only other thing to consider doing is adding some code to remove any existing metadata/revision files, or we could just add a script/instructions to the release notes to do this - any thoughts? It's not hurting anything by being there, will just be ignored.

@prydonius
Copy link
Contributor

The only other thing to consider doing is adding some code to remove any existing metadata/revision files, or we could just add a script/instructions to the release notes to do this - any thoughts? It's not hurting anything by being there, will just be ignored.

Seems like we could just leave the older metadata/revision files there, unless we think they might be used by some other tooling and it doesn't make sense to keep out-of-date revision files around (in which case this would be breaking anyway).

Copy link
Contributor

@carlisia carlisia left a comment

Choose a reason for hiding this comment

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

Much simpler. 👍

@carlisia
Copy link
Contributor

I'm fine with leaving the revision file in backups from past versions.

@skriss skriss changed the title WIP sync controller: replace revision file with full diff each interval sync controller: replace revision file with full diff each interval Sep 24, 2019
@skriss skriss marked this pull request as ready for review September 24, 2019 15:56
Copy link
Contributor

@nrb nrb left a comment

Choose a reason for hiding this comment

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

I like the simpler approach!

Have you observed any time differences (based on log messages would be simplest, I suppose) between the old approach and this one?

pkg/controller/backup_sync_controller.go Show resolved Hide resolved
@skriss
Copy link
Contributor Author

skriss commented Sep 24, 2019

Have you observed any time differences (based on log messages would be simplest, I suppose) between the old approach and this one?

Haven't specifically looked, though performance seemed fine/~instantaneous in the testing I did. I can try with some bigger data sets.

@skriss
Copy link
Contributor Author

skriss commented Sep 26, 2019

Tweaked logging so it only info-logs if there are actually backups to sync into the cluster for a location; otherwise, debug-logs.

@skriss
Copy link
Contributor Author

skriss commented Sep 26, 2019

Have you observed any time differences (based on log messages would be simplest, I suppose) between the old approach and this one?

The algorithm I'm using now should actually be faster than the old one -- previously, when syncing a location, we'd first get a list of all backups in the bucket, then make a K8s API call per backup in the BSL to check if that backup exists in-cluster. Now, I'm making a single List call (to a lister) upfront to get all backups in the cluster, and then doing an in-memory set diff to figure out which ones should be synced in. So a bunch of over-the-wire API calls are saved.

Signed-off-by: Steve Kriss <[email protected]>
@carlisia
Copy link
Contributor

@nrb PTAL.

@nrb nrb merged commit d961864 into vmware-tanzu:master Sep 27, 2019
@skriss skriss deleted the sync-rm-revision branch September 27, 2019 21:07
jessestuart added a commit to jessestuart/velero that referenced this pull request Sep 28, 2019
* upstream/master: (38 commits)
  sync controller: replace revision file with full diff each interval (vmware-tanzu#1892)
  Increment logging for item backupper (vmware-tanzu#1904)
  Add LD_LIBRARY_PATH as an env varible for the use of vsphere plugin (vmware-tanzu#1893)
  Remove unused flag (vmware-tanzu#1913)
  Use layers in the builder Dockerfile (vmware-tanzu#1907)
  Fix for vmware-tanzu#1888: check item's original namespace, not remapped one, for inclusion/exclusion (vmware-tanzu#1909)
  fail on make verify if generated CRDs differ (vmware-tanzu#1906)
  velero API type changes for structural schema CRDs (vmware-tanzu#1898)
  Generate CRDs with structural schema (vmware-tanzu#1885)
  Plan for moving plugin repos (vmware-tanzu#1870)
  move plugin proto updating into make update (vmware-tanzu#1887)
  Add features package (vmware-tanzu#1849)
  GCP: support specifying Cloud KMS key name for backup storage locations (vmware-tanzu#1879)
  Adds to website (vmware-tanzu#1882)
  proposal for generating Velero CRDs with structural schema (vmware-tanzu#1875)
  Improve contributing docs (vmware-tanzu#1852)
  [doc] Diagram (image) now mentions velero  (vmware-tanzu#1877)
  AWS: add support for arbitrary SSE algorithms, e.g. AES256 (vmware-tanzu#1869)
  update restic docs for PR vmware-tanzu#1807 (vmware-tanzu#1867)
  changelog for PR vmware-tanzu#1864
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a way to change full sync period
4 participants