-
Notifications
You must be signed in to change notification settings - Fork 78
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
CLIENT-3181: Add Multi-Record Transactions #645
Merged
Merged
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a504408
Merge pull request #637 from aerospike/stage
DomPeliniAerospike ba94e17
Changed protected class modifier to class.
DomPeliniAerospike 1ad2472
refreshed package-lock.json
DomPeliniAerospike 5d43d80
Merge pull request #638 from aerospike/Release-5.13.2
DomPeliniAerospike 7d3e7dd
Added Multi-Record Transactions
DomPeliniAerospike 445d969
Set MRT tests to run on enterprise only except for backward_compatibl…
DomPeliniAerospike a361f08
Fixed test setup.
DomPeliniAerospike b795990
Fixed test setup.
DomPeliniAerospike 3ff3c86
Fixed test setup.
DomPeliniAerospike 65f1aa1
Added mrt examples
DomPeliniAerospike c0e343d
lint fix
DomPeliniAerospike da7e45f
lint fix
DomPeliniAerospike 3e1a6cd
Skipped functionality tests on older releases
DomPeliniAerospike 0d5b6ed
Skipped functionality tests on older releases
DomPeliniAerospike 84e44d8
Fixed test timing issue
DomPeliniAerospike 78281bc
Test fix
DomPeliniAerospike 65418fb
Test fix
DomPeliniAerospike 1d61fb3
Test fix
DomPeliniAerospike d94b946
Test fix
DomPeliniAerospike 3b624df
Added commit and abort statuses to Transaction as static variables.
DomPeliniAerospike 8ae16a8
Loosened time windows for readTouchTtl tests
DomPeliniAerospike File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule aerospike-client-c
updated
94 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env node | ||
// ***************************************************************************** | ||
// Copyright 2013-2024 Aerospike, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License") | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ***************************************************************************** | ||
// | ||
const Aerospike = require('aerospike') | ||
const shared = require('./shared') | ||
|
||
shared.runner() | ||
|
||
async function mrtAbort (client, argv) { | ||
// sconst record1 = { abc: 123 } | ||
const record2 = { def: 456 } | ||
|
||
const mrt = new Aerospike.Transaction() | ||
|
||
const policy = { | ||
txn: mrt | ||
} | ||
const keyList = [] | ||
for (let i = 0; i < argv.keys.length; i++) { | ||
keyList.push(new Aerospike.Key(argv.namespace, argv.set, argv.keys[i])) | ||
} | ||
|
||
for (let i = 0; i < keyList.length; i++) { | ||
await client.put(keyList[i], record2, policy) | ||
await client.get(keyList[i], policy) | ||
} | ||
|
||
console.log(keyList) | ||
|
||
console.log('aborting multi-record transaction with %d operations.', keyList.length * 2) | ||
await client.abort(mrt) | ||
console.info('multi-record transaction has been aborted.') | ||
} | ||
|
||
exports.command = 'mrtAbort <keys..>' | ||
exports.describe = 'Abort a multi-record transaction' | ||
exports.handler = shared.run(mrtAbort) | ||
exports.builder = { | ||
keys: { | ||
desc: 'Provide keys for the records in the multi-record transaction', | ||
type: 'array', | ||
group: 'Command:' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env node | ||
// ***************************************************************************** | ||
// Copyright 2013-2024 Aerospike, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License") | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ***************************************************************************** | ||
// | ||
const Aerospike = require('aerospike') | ||
const shared = require('./shared') | ||
|
||
shared.runner() | ||
|
||
async function mrtCommit (client, argv) { | ||
// const record1 = { abc: 123 } | ||
const record2 = { def: 456 } | ||
|
||
const mrt = new Aerospike.Transaction() | ||
|
||
const policy = { | ||
txn: mrt | ||
} | ||
const keyList = [] | ||
for (let i = 0; i < argv.keys.length; i++) { | ||
keyList.push(new Aerospike.Key(argv.namespace, argv.set, argv.keys[i])) | ||
} | ||
for (let i = 0; i < argv.keys.length; i++) { | ||
await client.put(keyList[i], record2, policy) | ||
await client.get(keyList[i], policy) | ||
} | ||
|
||
console.log(keyList) | ||
|
||
console.log('committing multi-record transaction with %d operations.', keyList.length * 2) | ||
await client.commit(mrt) | ||
console.info('multi-record transaction has been committed.') | ||
} | ||
|
||
exports.command = 'mrtCommit <keys..>' | ||
exports.describe = 'Commit a multi-record transaction' | ||
exports.handler = shared.run(mrtCommit) | ||
exports.builder = { | ||
keys: { | ||
desc: 'Provide keys for the records in the multi-record transaction', | ||
type: 'array', | ||
group: 'Command:' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// ***************************************************************************** | ||
// Copyright 2024 Aerospike, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the 'License') | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an 'AS IS' BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ***************************************************************************** | ||
|
||
'use strict' | ||
|
||
const as = require('bindings')('aerospike.node') | ||
const abortStatus = as.abortStatus | ||
|
||
module.exports = { | ||
OK: abortStatus.OK, | ||
ALREADY_COMMITTED: abortStatus.ALREADY_COMMITTED, | ||
ALREADY_ABORTED: abortStatus.ALREADY_ABORTED, | ||
ROLL_BACK_ABANDONED: abortStatus.ROLL_BACK_ABANDONED, | ||
CLOSE_ABANDONED: abortStatus.CLOSE_ABANDONED | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it say "All commands in the same MRT must use the same namespace"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this in recent commits.