Cassandra Transaction with ZooKeeper - Does this work?
I am trying to implement a transaction system for Cassandra with the help of ZooKeeper. Since I don't think I have enough experience in database implementation, I would like to know if my idea would work in principle, or is there any major flaw.
Here is the high level description of the steps:
- identify all the rows(keys) and columns to be edited. Let the keys be [K0..Kn]
- apply write lock on all the rows involved (locks are in-memory Zookeeper implementation)
- copy the old values to separate locations in Cassandra which are uniquely identified by key: [K'0..K'n]
- store [K'0..K'n] and the mapping of them to [K0..Kn] in ZooKeeper using persistent mode
- go ahead apply the update to the data
- delete the entries in ZooKeeper
- unlock the rows
- delete the entries of [K'0..K'n] lazily on a maintenance thread (cassandra deletion uses timestamp, so K'0..K'n can be reused for another transaction with a newer time stamp)
Justification:
- if the transaction failed on step 1-4, no change is applied, I can abort the transaction and delete whatever is stored in zookeeper and backup-ed in cassandra, if any.
- if the transaction failed on step 5, the information saved on step 3 is used to rollback the any changes.
- if the server happen to be failed/crashed/stolen by cleaning man, upon restart before serving any request, I check if there is any keys persisted in the zookeeper from step 4, if so, i will use those keys to fetch backed up data stored by step 3, and put those data to where they were, thus roll-back any failed transactions.
One of my concern is what would happen if some of the servers are partitioned from the cluster. I have no experience in this area, does my scheme work at all? and does it work if partition happens?
database database-design transactions nosql cassandra
add a comment |
I am trying to implement a transaction system for Cassandra with the help of ZooKeeper. Since I don't think I have enough experience in database implementation, I would like to know if my idea would work in principle, or is there any major flaw.
Here is the high level description of the steps:
- identify all the rows(keys) and columns to be edited. Let the keys be [K0..Kn]
- apply write lock on all the rows involved (locks are in-memory Zookeeper implementation)
- copy the old values to separate locations in Cassandra which are uniquely identified by key: [K'0..K'n]
- store [K'0..K'n] and the mapping of them to [K0..Kn] in ZooKeeper using persistent mode
- go ahead apply the update to the data
- delete the entries in ZooKeeper
- unlock the rows
- delete the entries of [K'0..K'n] lazily on a maintenance thread (cassandra deletion uses timestamp, so K'0..K'n can be reused for another transaction with a newer time stamp)
Justification:
- if the transaction failed on step 1-4, no change is applied, I can abort the transaction and delete whatever is stored in zookeeper and backup-ed in cassandra, if any.
- if the transaction failed on step 5, the information saved on step 3 is used to rollback the any changes.
- if the server happen to be failed/crashed/stolen by cleaning man, upon restart before serving any request, I check if there is any keys persisted in the zookeeper from step 4, if so, i will use those keys to fetch backed up data stored by step 3, and put those data to where they were, thus roll-back any failed transactions.
One of my concern is what would happen if some of the servers are partitioned from the cluster. I have no experience in this area, does my scheme work at all? and does it work if partition happens?
database database-design transactions nosql cassandra
guess i will have to find it out myself and let you guys know...
– Viele
Jun 30 '10 at 18:32
add a comment |
I am trying to implement a transaction system for Cassandra with the help of ZooKeeper. Since I don't think I have enough experience in database implementation, I would like to know if my idea would work in principle, or is there any major flaw.
Here is the high level description of the steps:
- identify all the rows(keys) and columns to be edited. Let the keys be [K0..Kn]
- apply write lock on all the rows involved (locks are in-memory Zookeeper implementation)
- copy the old values to separate locations in Cassandra which are uniquely identified by key: [K'0..K'n]
- store [K'0..K'n] and the mapping of them to [K0..Kn] in ZooKeeper using persistent mode
- go ahead apply the update to the data
- delete the entries in ZooKeeper
- unlock the rows
- delete the entries of [K'0..K'n] lazily on a maintenance thread (cassandra deletion uses timestamp, so K'0..K'n can be reused for another transaction with a newer time stamp)
Justification:
- if the transaction failed on step 1-4, no change is applied, I can abort the transaction and delete whatever is stored in zookeeper and backup-ed in cassandra, if any.
- if the transaction failed on step 5, the information saved on step 3 is used to rollback the any changes.
- if the server happen to be failed/crashed/stolen by cleaning man, upon restart before serving any request, I check if there is any keys persisted in the zookeeper from step 4, if so, i will use those keys to fetch backed up data stored by step 3, and put those data to where they were, thus roll-back any failed transactions.
One of my concern is what would happen if some of the servers are partitioned from the cluster. I have no experience in this area, does my scheme work at all? and does it work if partition happens?
database database-design transactions nosql cassandra
I am trying to implement a transaction system for Cassandra with the help of ZooKeeper. Since I don't think I have enough experience in database implementation, I would like to know if my idea would work in principle, or is there any major flaw.
Here is the high level description of the steps:
- identify all the rows(keys) and columns to be edited. Let the keys be [K0..Kn]
- apply write lock on all the rows involved (locks are in-memory Zookeeper implementation)
- copy the old values to separate locations in Cassandra which are uniquely identified by key: [K'0..K'n]
- store [K'0..K'n] and the mapping of them to [K0..Kn] in ZooKeeper using persistent mode
- go ahead apply the update to the data
- delete the entries in ZooKeeper
- unlock the rows
- delete the entries of [K'0..K'n] lazily on a maintenance thread (cassandra deletion uses timestamp, so K'0..K'n can be reused for another transaction with a newer time stamp)
Justification:
- if the transaction failed on step 1-4, no change is applied, I can abort the transaction and delete whatever is stored in zookeeper and backup-ed in cassandra, if any.
- if the transaction failed on step 5, the information saved on step 3 is used to rollback the any changes.
- if the server happen to be failed/crashed/stolen by cleaning man, upon restart before serving any request, I check if there is any keys persisted in the zookeeper from step 4, if so, i will use those keys to fetch backed up data stored by step 3, and put those data to where they were, thus roll-back any failed transactions.
One of my concern is what would happen if some of the servers are partitioned from the cluster. I have no experience in this area, does my scheme work at all? and does it work if partition happens?
database database-design transactions nosql cassandra
database database-design transactions nosql cassandra
edited Jun 30 '10 at 16:13
Viele
asked Jun 30 '10 at 14:56
VieleViele
9612925
9612925
guess i will have to find it out myself and let you guys know...
– Viele
Jun 30 '10 at 18:32
add a comment |
guess i will have to find it out myself and let you guys know...
– Viele
Jun 30 '10 at 18:32
guess i will have to find it out myself and let you guys know...
– Viele
Jun 30 '10 at 18:32
guess i will have to find it out myself and let you guys know...
– Viele
Jun 30 '10 at 18:32
add a comment |
1 Answer
1
active
oldest
votes
You should look into Cages: http://ria101.wordpress.com/2010/05/12/locking-and-transactions-over-cassandra-using-cages/
http://code.google.com/p/cages/
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3150446%2fcassandra-transaction-with-zookeeper-does-this-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should look into Cages: http://ria101.wordpress.com/2010/05/12/locking-and-transactions-over-cassandra-using-cages/
http://code.google.com/p/cages/
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
add a comment |
You should look into Cages: http://ria101.wordpress.com/2010/05/12/locking-and-transactions-over-cassandra-using-cages/
http://code.google.com/p/cages/
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
add a comment |
You should look into Cages: http://ria101.wordpress.com/2010/05/12/locking-and-transactions-over-cassandra-using-cages/
http://code.google.com/p/cages/
You should look into Cages: http://ria101.wordpress.com/2010/05/12/locking-and-transactions-over-cassandra-using-cages/
http://code.google.com/p/cages/
answered Jul 13 '10 at 2:05
jbellisjbellis
18.8k23144
18.8k23144
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
add a comment |
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
it's not bad. The first thing I looked at. However, what it supplies is still far away from transaction.
– Viele
Jul 13 '10 at 13:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3150446%2fcassandra-transaction-with-zookeeper-does-this-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
guess i will have to find it out myself and let you guys know...
– Viele
Jun 30 '10 at 18:32