void ctdb_db_set_readonly(struct ctdb_db_context *ctdb_db);
void ctdb_db_reset_readonly(struct ctdb_db_context *ctdb_db);
+bool ctdb_db_sticky(struct ctdb_db_context *ctdb_db);
+void ctdb_db_set_sticky(struct ctdb_db_context *ctdb_db);
+
uint32_t ctdb_lmaster(struct ctdb_context *ctdb, const TDB_DATA *key);
int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db,
ctdb_db->readonly = false;
}
+bool ctdb_db_sticky(struct ctdb_db_context *ctdb_db)
+{
+ return ctdb_db->sticky;
+}
+
+void ctdb_db_set_sticky(struct ctdb_db_context *ctdb_db)
+{
+ ctdb_db->sticky = true;
+}
+
/*
return the lmaster given a key
*/
see if the record is flagged as "hot" and set up a pin-down
context to stop migrations for a little while if so
*/
- if (ctdb_db->sticky) {
+ if (ctdb_db_sticky(ctdb_db)) {
ctdb_set_sticky_pindown(ctdb, ctdb_db, key);
}
/* If this record is pinned down we should defer the
request until the pindown times out
*/
- if (ctdb_db->sticky) {
+ if (ctdb_db_sticky(ctdb_db)) {
if (ctdb_defer_pinned_down_request(ctdb, ctdb_db, call->key, hdr) == 0) {
DEBUG(DEBUG_WARNING,
("Defer request for pinned down record in %s\n", ctdb_db->db_name));
hopcount is big. If it is it means the record is hot and we
should make it sticky.
*/
- if (ctdb_db->sticky && c->hopcount >= ctdb->tunable.hopcount_make_sticky) {
+ if (ctdb_db_sticky(ctdb_db) &&
+ c->hopcount >= ctdb->tunable.hopcount_make_sticky) {
ctdb_make_record_sticky(ctdb, ctdb_db, call->key);
}
int ctdb_set_db_sticky(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db)
{
- if (ctdb_db->sticky) {
+ if (ctdb_db_sticky(ctdb_db)) {
return 0;
}
ctdb_db->sticky_records = trbt_create(ctdb_db, 0);
- ctdb_db->sticky = true;
+ ctdb_db_set_sticky(ctdb_db);
DEBUG(DEBUG_NOTICE,("set db sticky %s\n", ctdb_db->db_name));
if (ctdb_db_readonly(ctdb_db)) {
dbid_map->dbs[i].flags |= CTDB_DB_FLAGS_READONLY;
}
- if (ctdb_db->sticky != 0) {
+ if (ctdb_db_sticky(ctdb_db)) {
dbid_map->dbs[i].flags |= CTDB_DB_FLAGS_STICKY;
}
}