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

Object Version Replication - add the ability to replicate object versions. #7412

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

liranmauda
Copy link
Contributor

@liranmauda liranmauda commented Jul 30, 2023

Explain the changes

Config.js:

  • Create config.BUCKET_DIFF_FOR_REPLICATION to determine if BucketDiff is in replication mode.

Replication api:

  • copy now get an object instead of keys and return an object instead of an array

Replication Server:

  • copy_objects_mixed_types:
    • Will get objects instead of keys
    • Will return an object of num_of_objects and size_of_objects
    • if there is only one metadata per key, copy it as none version (even if there is a version)
    • If there is more than one metadata, copy all from the older to the newest, considering the versionID

Replication Utils:

  • copy_objects will get objects instead of keys
  • Cleaned unused get_object_md and check_data_or_md_changed functions

Replication Scanner:

  • Use BucketDiff for replication instead of the functions in the scanner, and remove the unused functions
  • Support Object versions replication
  • Fix the metrics to consume the new replay format.

Gap

  1. will not copy the last version if the latest is a delete marker, in order to do so we will need to be were if there is versioning enabled (maybe add to the replication_api sync_version flag)
  2. need to add tests for replication of object versions
  3. This will break:
    async copy_objects(src_bucket_name, dst_bucket_name, keys) {
    const copy_type = replication_utils.get_copy_type();
    await replication_utils.copy_objects(
    this._scanner_sem,
    this.client,
    copy_type,
    src_bucket_name.unwrap(),
    dst_bucket_name.unwrap(),
    keys,
    );
    dbg.log2('log_replication_scanner: scan copy_objects: ', keys);
    }

Testing Instructions:

  1. Run npx jest --testPathPattern="test_bucket_diff.test.js"
  2. Run unit tests test_bucket_replication.js
  • Tests added

@liranmauda liranmauda force-pushed the liran-version-replication2 branch 4 times, most recently from af1ae61 to f750c21 Compare August 2, 2023 15:04
@liranmauda liranmauda force-pushed the liran-version-replication2 branch 2 times, most recently from c088e34 to b728f88 Compare August 3, 2023 07:47
@liranmauda liranmauda marked this pull request as ready for review August 3, 2023 07:47
@liranmauda liranmauda force-pushed the liran-version-replication2 branch 2 times, most recently from f9934bb to d9c7742 Compare August 3, 2023 12:22
Copy link
Contributor

@jackyalbo jackyalbo left a comment

Choose a reason for hiding this comment

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

in general It looks ok to me, under the assumptions and the gaps mentioned in the PR. I still think @romayalon should also take a look as she knows much more in this area than me :)

src/server/bg_services/replication_scanner.js Outdated Show resolved Hide resolved
src/server/bg_services/replication_scanner.js Outdated Show resolved Hide resolved
src/server/bg_services/replication_scanner.js Outdated Show resolved Hide resolved
src/api/replication_api.js Outdated Show resolved Hide resolved
@liranmauda liranmauda force-pushed the liran-version-replication2 branch 2 times, most recently from 1bfac0e to d7e9b63 Compare August 6, 2023 14:17
Copy link
Contributor

@Neon-White Neon-White left a comment

Choose a reason for hiding this comment

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

I did not realize that #7427 was dependent on this PR, so I left my review comments there

@liranmauda
Copy link
Contributor Author

I did not realize that #7427 was dependent on this PR, so I left my review comments there

@Neon-White Thanks for reviewing.
Can you please redo the review here?
the other PR is not getting updated and some comments are not relevant.

@liranmauda liranmauda force-pushed the liran-version-replication2 branch 2 times, most recently from 3ba699f to 57bcb7f Compare August 8, 2023 07:55
Copy link
Contributor

@Neon-White Neon-White left a comment

Choose a reason for hiding this comment

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

No major comments from my side

src/api/replication_api.js Outdated Show resolved Hide resolved
src/server/utils/replication_utils.js Outdated Show resolved Hide resolved
src/test/unit_tests/test_bucket_replication.js Outdated Show resolved Hide resolved
src/server/bg_services/replication_scanner.js Show resolved Hide resolved
src/server/bg_services/replication_scanner.js Show resolved Hide resolved
@liranmauda liranmauda force-pushed the liran-version-replication2 branch 6 times, most recently from c110c41 to 5eae524 Compare August 9, 2023 10:40
…ions.

- Create config.BUCKET_DIFF_FOR_REPLICATION to determine if BucketDiff is in replication mode.

- copy now get an object instead of keys and return an object instead of an array

 - copy_objects_mixed_types:
    - Will get objects instead of keys
    - Will return an object of num_of_objects and size_of_objects
    - if there is only one metadata per key, copy it as none version (even if there is a version)
     - If there is more than one metadata, copy all from the older to the newest, considering the versionID

 ### Replication Utils:
 - copy_objects will get objects instead of keys
 - Cleaned unused `get_object_md` and `check_data_or_md_changed` functions

- Use BucketDiff for replication instead of the functions in the scanner, and remove the unused functions
- Support Object versions replication
- Fix the metrics to consume the new replay format.

1.  will not copy the last version if the latest is a delete marker, in order to do so we will need to be were if there is versioning enabled (maybe add to the replication_api sync_version flag)

Signed-off-by: liranmauda <liran.mauda@gmail.com>
@liranmauda liranmauda merged commit 4d2b11a into noobaa:master Aug 21, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants