mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
Merge git://git.samba.org/tridge/ctdb
(This used to be ctdb commit 3059ab5f3f21e331b80728773c36a74620e46677)
This commit is contained in:
commit
ba502da53f
@ -3181,7 +3181,7 @@ failed:
|
||||
*/
|
||||
int ctdb_transaction_commit(struct ctdb_transaction_handle *h)
|
||||
{
|
||||
int ret;
|
||||
int ret, retries=0;
|
||||
int32_t status;
|
||||
struct ctdb_context *ctdb = h->ctdb_db->ctdb;
|
||||
struct timeval timeout;
|
||||
@ -3215,7 +3215,7 @@ again:
|
||||
/* tell ctdbd to commit to the other nodes */
|
||||
timeout = timeval_current_ofs(1, 0);
|
||||
ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, h->ctdb_db->db_id,
|
||||
CTDB_CONTROL_TRANS2_COMMIT, 0,
|
||||
retries==0?CTDB_CONTROL_TRANS2_COMMIT:CTDB_CONTROL_TRANS2_COMMIT_RETRY, 0,
|
||||
ctdb_marshall_finish(h->m_write), NULL, NULL, &status,
|
||||
&timeout, NULL);
|
||||
if (ret != 0 || status != 0) {
|
||||
@ -3239,6 +3239,16 @@ again:
|
||||
}
|
||||
}
|
||||
|
||||
if (++retries == 10) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " Giving up transaction on db 0x%08x after %d retries failure_control=%u\n",
|
||||
h->ctdb_db->db_id, retries, (unsigned)failure_control));
|
||||
ctdb_control(ctdb, CTDB_CURRENT_NODE, h->ctdb_db->db_id,
|
||||
failure_control, CTDB_CTRL_FLAG_NOREPLY,
|
||||
tdb_null, NULL, NULL, NULL, NULL, NULL);
|
||||
talloc_free(h);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ctdb_replay_transaction(h) != 0) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " Failed to replay transaction\n"));
|
||||
ctdb_control(ctdb, CTDB_CURRENT_NODE, h->ctdb_db->db_id,
|
||||
|
@ -549,6 +549,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
|
||||
CTDB_CONTROL_TRANS2_COMMIT = 83,
|
||||
CTDB_CONTROL_TRANS2_FINISHED = 84,
|
||||
CTDB_CONTROL_TRANS2_ERROR = 85,
|
||||
CTDB_CONTROL_TRANS2_COMMIT_RETRY = 86,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -397,6 +397,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
return ctdb_control_cancel_persistent_update(ctdb, c, indata);
|
||||
|
||||
case CTDB_CONTROL_TRANS2_COMMIT:
|
||||
case CTDB_CONTROL_TRANS2_COMMIT_RETRY:
|
||||
return ctdb_control_trans2_commit(ctdb, c, indata, async_reply);
|
||||
|
||||
case CTDB_CONTROL_TRANS2_ERROR:
|
||||
|
@ -121,12 +121,18 @@ int32_t ctdb_control_trans2_commit(struct ctdb_context *ctdb,
|
||||
then have it decremented in ctdb_control_trans2_error
|
||||
or ctdb_control_trans2_finished
|
||||
*/
|
||||
if (c->opcode == CTDB_CONTROL_PERSISTENT_STORE) {
|
||||
switch (c->opcode) {
|
||||
case CTDB_CONTROL_PERSISTENT_STORE:
|
||||
if (client->num_persistent_updates > 0) {
|
||||
client->num_persistent_updates--;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
case CTDB_CONTROL_TRANS2_COMMIT:
|
||||
client->num_persistent_updates++;
|
||||
break;
|
||||
case CTDB_CONTROL_TRANS2_COMMIT_RETRY:
|
||||
/* already updated from the first commit */
|
||||
break;
|
||||
}
|
||||
|
||||
state = talloc_zero(ctdb, struct ctdb_persistent_state);
|
||||
|
Loading…
x
Reference in New Issue
Block a user