Upgrade microVersionId to timestamp-ordered format and add isReplica#2628
Upgrade microVersionId to timestamp-ordered format and add isReplica#2628maeldonn wants to merge 2 commits into
Conversation
Hello maeldonn,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
|
LGTM |
caf9a51 to
868cae8
Compare
Review by Claude Code |
868cae8 to
2eae0c5
Compare
|
LGTM |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
Review by Claude Code |
fbaf3fe to
3160d6b
Compare
| */ | ||
| updateMicroVersionId() { | ||
| this._data.microVersionId = crypto.randomBytes(8).toString('hex'); | ||
| updateMicroVersionId(replicationGroupId: string) { |
There was a problem hiding this comment.
Breaking API change: updateMicroVersionId() now requires a replicationGroupId argument. All downstream callers (CloudServer, Backbeat, etc.) that invoke this method without arguments will fail at compile time. Ensure coordinated updates across dependent repos.
— Claude Code
|
LGTM — one breaking change to flag: |
3160d6b to
5f4839a
Compare
5f4839a to
7be6414
Compare
Review by Claude Code |
| updateMicroVersionId() { | ||
| this._data.microVersionId = crypto.randomBytes(8).toString('hex'); | ||
| updateMicroVersionId(instanceId: string, replicationGroupId: string) { | ||
| this._data.microVersionId = VersionIDUtils.generateVersionId(instanceId, replicationGroupId); |
There was a problem hiding this comment.
are the instanceID and replicaitionGroupId not usually pick'ed up (in arsenal!) by env variables?
(i.e. do we need to have params, or can we just pick the right values automatically)
There was a problem hiding this comment.
For instance id, we have this in cloudserver so maybe we could :
const instanceId = process.env.CLOUDSERVER_INSTANCE_ID || config.instanceId;
But for replicationGroupId, it's not an env variable.
And this function will also be used by S3UTILS so I think we have to leave it like this
7be6414 to
2d68077
Compare
| * Get whether this object was written by replication (replica). | ||
| * @return true if this object is a replica | ||
| */ | ||
| getReplicationIsReplica() { |
There was a problem hiding this comment.
i think we should still also have an || data.replicationInfo.status === 'REPLICA' for cross compatiblity with older code ?
ConflictThere is a conflict between your branch Please resolve the conflict on the feature branch ( git fetch && \
git checkout origin/improvement/ARSN-578/micro-version-id && \
git merge origin/development/8.4Resolve merge conflicts and commit git push origin HEAD:improvement/ARSN-578/micro-version-id |
| * Get whether this object was written by replication (replica). | ||
| * @return true if this object is a replica | ||
| */ | ||
| getReplicationIsReplica() { |
There was a problem hiding this comment.
call it "isReplica" ? and the setter "setReplica" ?
| * @param isReplica - true if this object was written by replication | ||
| * @return itself | ||
| */ | ||
| setReplicationIsReplica(isReplica: boolean) { |
There was a problem hiding this comment.
wonder if we should also set
replicationInfo.status = 'REPLICA'
2d68077 to
031c259
Compare
| storageType: storageType || '', | ||
| dataStoreVersionId: dataStoreVersionId || '', | ||
| isNFS, | ||
| isReplica: isReplica !== undefined ? isReplica : (status === 'REPLICA' ? true : undefined), |
There was a problem hiding this comment.
| isReplica: isReplica !== undefined ? isReplica : (status === 'REPLICA' ? true : undefined), | |
| isReplica: isReplica !== undefined ? isReplica : (status === 'REPLICA' ? true : false), |
not sure if undefined or false when status not REPLICA
110b0c8 to
e166386
Compare
| */ | ||
| getMicroVersionId() { | ||
| return this._data.microVersionId || null; | ||
| return this._data.microVersionId || undefined; |
There was a problem hiding this comment.
Return value changed from null to undefined. Any downstream caller in CloudServer/Backbeat checking getMicroVersionId() === null will silently stop matching. If this is intentional, it should be called out in the PR description as a breaking change so dependent repos can audit their checks.
— Claude Code
There was a problem hiding this comment.
no worries this function wasn't even called before https://github.com/search?q=org%3Ascality%20getMicroVersionId&type=code
i switched to undefined to align with getEncodedVersionId, and because it fits better the client that can use string | undefined
| incomingRaw: string, | ||
| existingRaw: string | null | undefined, | ||
| ): 'loop' | 'stale' | 'proceed' { | ||
| if (!isMicroVersionIdComparable(existingRaw)) { |
There was a problem hiding this comment.
checkCrrCascadeEvent validates existingRaw with isMicroVersionIdComparable but does not validate incomingRaw. If incomingRaw is a legacy 16-char random-hex microVersionId, the lexicographic comparison against a time-ordered ID is meaningless and can return incorrect results (e.g. a hex value starting with f will sort after the time-ordered value, producing a false stale). Add !isMicroVersionIdComparable(incomingRaw) to the guard clause.
— Claude Code
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development/8.4 #2628 +/- ##
===================================================
+ Coverage 73.65% 73.71% +0.06%
===================================================
Files 223 223
Lines 18247 18268 +21
Branches 3776 3807 +31
===================================================
+ Hits 13440 13467 +27
+ Misses 4802 4796 -6
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replace the random 8-byte hex microVersionId the timestamp-ordered identifier matching the versionId scheme, and add helpers for the crr cascade feature. Add an optional isReplica flag to ReplicationInfo to distinguish replica writes from user writes, enabling cascaded CRR. Issue: ARSN-578
e166386 to
2c429ab
Compare
|
Replace the random 8-byte hex microVersionId with a 20-character timestamp-ordered identifier matching the versionId scheme, and add encode/decode/compare helpers in a new MicroVersionID module. Add an optional isReplica flag to ReplicationInfo to distinguish replica writes from user writes, enabling cascaded CRR.
Issue: ARSN-578
Crr cascaded design : https://github.com/scality/citadel/pull/349
Related PRs :
Cloudserver : scality/cloudserver#6179
CloudserverClient : scality/cloudserverclient#24
Backbeat : Not done yet
S3utils : scality/s3utils#395