*/
int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
- TDB_DATA *data)
+ TDB_DATA *data, bool updatetdb)
{
struct ctdb_call_info *c;
struct ctdb_registered_call *fn;
c->new_data = &c->record_data;
}
- if (c->new_data) {
+ if (c->new_data && updatetdb) {
/* XXX check that we always have the lock here? */
if (ctdb_ltdb_store(ctdb_db, call->key, header, *c->new_data) != 0) {
ctdb_set_error(ctdb, "ctdb_call tdb_store failed\n");
call->status = state->call->status;
talloc_free(state);
- return 0;
+ return call->status;
}
*(state->call) = *call;
state->ctdb_db = ctdb_db;
- ret = ctdb_call_local(ctdb_db, state->call, header, state, data);
+ ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
return state;
}
int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
- TDB_DATA *data);
+ TDB_DATA *data, bool updatetdb);
#define ctdb_reqid_find(ctdb, reqid, type) (type *)_ctdb_reqid_find(ctdb, reqid, #type, __location__)
return;
}
- ctdb_call_local(ctdb_db, state->call, &header, state, &data);
+ ctdb_call_local(ctdb_db, state->call, &header, state, &data, true);
ret = ctdb_ltdb_unlock(ctdb_db, state->call->key);
if (ret != 0) {
}
}
- ctdb_call_local(ctdb_db, call, &header, hdr, &data);
+ ret = ctdb_call_local(ctdb_db, call, &header, hdr, &data, true);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,(__location__ " ctdb_call_local failed\n"));
+ call->status = -1;
+ }
ret = ctdb_ltdb_unlock(ctdb_db, call->key);
if (ret != 0) {
*(state->call) = *call;
state->ctdb_db = ctdb_db;
- ret = ctdb_call_local(ctdb_db, state->call, header, state, data);
+ ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
event_add_timed(ctdb->ev, state, timeval_zero(), call_local_trigger, state);