[#335] Improve determining AccessBox latest version #391

Merged
alexvanin merged 1 commit from Anoke/frostfs-s3-gw:improve-determing-latest-version-accessbox into master 2024-06-06 12:35:52 +00:00
Contributor

As it was asked used S3-CRDT-Versions-Add header to know if one version is older than other, for this I modified function less to sort objectVersion correctly

As it was asked used S3-CRDT-Versions-Add header to know if one version is older than other, for this I modified function less to sort objectVersion correctly
dkirillov reviewed 2024-05-27 06:32:42 +00:00
@ -108,6 +108,12 @@ func (v *ObjectVersions) getAddHeader() string {
}
func less(ov1, ov2 *ObjectVersion) bool {
if contains(splitVersions(ov1.Headers[versionsAddAttr]), ov2.VersionID()) {
Member

It seems we can use just

strings.Contains(ov1.Headers[versionsAddAttr], ov2.VersionID())
It seems we can use just ```golang strings.Contains(ov1.Headers[versionsAddAttr], ov2.VersionID()) ```
dkirillov marked this conversation as resolved
dkirillov requested review from storage-services-committers 2024-05-27 06:33:36 +00:00
dkirillov requested review from storage-services-developers 2024-05-27 06:33:38 +00:00
dkirillov reviewed 2024-05-27 06:45:23 +00:00
@ -111,2 +115,4 @@
return true
}
if ov1.CreationEpoch == ov2.CreationEpoch {
return ov1.VersionID() < ov2.VersionID()
Member

On this line we will compute VersionIDs, that have already been computed above (line 111, 114). So probably we can compute this just one in the beginning of the function:

func less(ov1, ov2 *ObjectVersion) bool {
    versionID1, versionID2 := ov1.VersionID(), ov2.VersionID()
    // ...
}
On this line we will compute VersionIDs, that have already been computed above (line 111, 114). So probably we can compute this just one in the beginning of the function: ```golang func less(ov1, ov2 *ObjectVersion) bool { versionID1, versionID2 := ov1.VersionID(), ov2.VersionID() // ... } ```
dkirillov marked this conversation as resolved
Anoke force-pushed improve-determing-latest-version-accessbox from 81b3b213d2 to b98a43e059 2024-05-27 13:33:43 +00:00 Compare
dkirillov approved these changes 2024-05-28 06:18:24 +00:00
alexvanin added this to the v0.30.0 milestone 2024-05-29 12:02:19 +00:00
Owner

@Anoke please check linter error. You can run it locally with make lint or see output of CI/CD runner: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/actions/runs/2643/jobs/0

@Anoke please check linter error. You can run it locally with `make lint` or see output of CI/CD runner: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/actions/runs/2643/jobs/0
Anoke force-pushed improve-determing-latest-version-accessbox from 373b8552bd to eb13da1565 2024-05-31 08:45:01 +00:00 Compare
dkirillov approved these changes 2024-05-31 11:13:47 +00:00
pogpp approved these changes 2024-05-31 13:10:39 +00:00
alexvanin merged commit 58850f590e into master 2024-06-06 12:35:52 +00:00
alexvanin deleted branch improve-determing-latest-version-accessbox 2024-06-06 12:36:04 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#391
No description provided.