*/
int ctdb_record_store(struct ctdb_record_handle *h, TDB_DATA data)
{
- int ret;
- int32_t status;
- struct ctdb_rec_data *rec;
- TDB_DATA recdata;
-
if (h->ctdb_db->persistent) {
- h->header.rsn++;
- }
-
- ret = ctdb_ltdb_store(h->ctdb_db, h->key, &h->header, data);
- if (ret != 0) {
- return ret;
- }
-
- /* don't need the persistent_store control for non-persistent databases */
- if (!h->ctdb_db->persistent) {
- return 0;
- }
-
- rec = ctdb_marshall_record(h, h->ctdb_db->db_id, h->key, &h->header, data);
- if (rec == NULL) {
- DEBUG(DEBUG_ERR,("Unable to marshall record in ctdb_record_store\n"));
- return -1;
- }
-
- recdata.dptr = (uint8_t *)rec;
- recdata.dsize = rec->length;
-
- ret = ctdb_control(h->ctdb_db->ctdb, CTDB_CURRENT_NODE, 0,
- CTDB_CONTROL_PERSISTENT_STORE, 0,
- recdata, NULL, NULL, &status, NULL, NULL);
-
- talloc_free(rec);
-
- if (ret != 0 || status != 0) {
- DEBUG(DEBUG_ERR,("Failed persistent store in ctdb_record_store\n"));
+ DEBUG(DEBUG_ERR, (__location__ " ctdb_record_store prohibited for persistent dbs\n"));
return -1;
}
- return 0;
+ return ctdb_ltdb_store(h->ctdb_db, h->key, &h->header, data);
}
/*