Skip to content

Commit 16e0f9c

Browse files
wip restore without nullVersionCompatMode md back
1 parent 2242e1f commit 16e0f9c

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

lib/services.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ const services = {
175175
}
176176
if (versionId || versionId === '') {
177177
options.versionId = versionId;
178+
// Without nullVersionCompatMode (for metadata backend)
179+
// a null version object key doesn't have versionId.
180+
// Override md options.versionId to 'null' to avoid creating a new version object.
181+
// At the end of processing to avoid impacting versionId in MD payload
182+
if (headers &&headers['x-scal-s3-version-id'] === 'null' && !config.nullVersionCompatMode) {
183+
options.versionId = 'null';
184+
}
178185
}
179186
if (needOplogUpdate) {
180187
options.needOplogUpdate = true;

tests/functional/aws-node-sdk/test/utils/init.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ const log = new DummyRequestLogger();
77
const nonVersionedObjId =
88
versionIdUtils.getInfVid(config.replicationGroupId);
99

10+
const nullKeySupported = ['file', 'scality'].includes(config.backends.metadata);
11+
// With null version compat mode the null key should look like
12+
// 'object1putversion\u000099999999999999999999RG001 '
13+
// Without it for BucketFile backends it looks like
14+
// 'object1putversion\x00'
15+
const nullKey = nullKeySupported && !config.nullVersionCompatMode;
16+
1017
function decodeVersionId(versionId) {
1118
let decodedVersionId;
1219
if (versionId) {
1320
if (versionId === 'null') {
1421
// At least file backend handles both
15-
decodedVersionId = config.enableNullVersionCompatMode ? nonVersionedObjId : 'null';
22+
decodedVersionId = nullKey ? 'null' : nonVersionedObjId;
1623
} else {
1724
decodedVersionId = versionIdUtils.decode(versionId);
1825
}

0 commit comments

Comments
 (0)