struct trbt_tree *child_processes;
/* Used for locking record/db/alldb */
- int lock_num_current;
int lock_num_pending;
struct lock_context *lock_current;
struct lock_context *lock_pending;
struct trbt_tree *deferred_fetch;
struct ctdb_db_statistics statistics;
+
+ int lock_num_current;
};
if (lock_ctx->child > 0) {
ctdb_kill(lock_ctx->ctdb, lock_ctx->child, SIGKILL);
DLIST_REMOVE(lock_ctx->ctdb->lock_current, lock_ctx);
- lock_ctx->ctdb->lock_num_current--;
+ if (lock_ctx->ctdb_db) {
+ lock_ctx->ctdb_db->lock_num_current--;
+ }
CTDB_DECREMENT_STAT(lock_ctx->ctdb, locks.num_current);
if (lock_ctx->type == LOCK_RECORD || lock_ctx->type == LOCK_DB) {
CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_current);
CTDB_NO_MEMORY_VOID(ctdb, prog);
}
- if (ctdb->lock_num_current >= MAX_LOCK_PROCESSES_PER_DB) {
- return;
- }
-
if (ctdb->lock_pending == NULL) {
return;
}
lock_ctx->key, lock_ctx->priority,
lock_ctx->type);
if (active_ctx == NULL) {
- /* Found a lock context with lock requests */
- break;
+ if (lock_ctx->ctdb_db == NULL ||
+ lock_ctx->ctdb_db->lock_num_current < MAX_LOCK_PROCESSES_PER_DB) {
+ /* Found a lock context with lock requests */
+ break;
+ }
}
/* There is already a child waiting for the
DLIST_REMOVE(ctdb->lock_pending, lock_ctx);
ctdb->lock_num_pending--;
DLIST_ADD_END(ctdb->lock_current, lock_ctx, NULL);
- ctdb->lock_num_current++;
+ if (lock_ctx->ctdb_db) {
+ lock_ctx->ctdb_db->lock_num_current++;
+ }
}