summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@mongodb.com>2022-07-13 13:01:57 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-13 13:39:54 +0000
commitf4de1bd3b7de8b3e93d7d051cbfe8544df71112f (patch)
tree1dcd36559e54a40e540c22fd68482097147c80e1
parentf396ed9d5463904e835b5503b32b40e05ca7695d (diff)
downloadmongo-f4de1bd3b7de8b3e93d7d051cbfe8544df71112f.tar.gz
SERVER-67775 Add TicketAcquisitionPriority to the Locker class
-rw-r--r--src/mongo/util/concurrency/ticketholder.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mongo/util/concurrency/ticketholder.h b/src/mongo/util/concurrency/ticketholder.h
index cc571041344..1882d2168b1 100644
--- a/src/mongo/util/concurrency/ticketholder.h
+++ b/src/mongo/util/concurrency/ticketholder.h
@@ -49,6 +49,12 @@ namespace mongo {
class Ticket;
class ReaderWriterTicketHolder;
+/**
+ * A ticket mechanism is required for global lock acquisition to reduce contention on storage
+ * engine resources.
+ *
+ * Manages the distribution of tickets across operations.
+ */
class TicketHolder {
friend class Ticket;
@@ -56,6 +62,31 @@ public:
virtual ~TicketHolder(){};
/**
+ * Classifies the priority that an operation acquires a ticket when the system is under high
+ * load (operations are throttled waiting for a ticket). Only applicable when there are no
+ * available tickets.
+ *
+ * 'kLow': It's of low importance that the operation acquires a ticket. These low-priority
+ * operations are reserved for background tasks that have no other operations dependent on them.
+ * These operations may be throttled under load and make significantly less progress as compared
+ * to operations of a higher priority.
+ *
+ * 'kNormal': It's important that the operation be throttled under load. If this operation is
+ * throttled, it will not affect system availability or observability. Most operations, both
+ * user and internal, should use this priority unless they qualify as 'kLow' or 'kHigh'
+ * priority.
+ *
+ * 'kHigh': It's crucial that the operation makes forward progress - bypassing ticket
+ * acquisition. Reserved for operations critical to availability (e.g. replication workers) or
+ * observability (e.g. FTDC), and any operation that is releasing resources (e.g. committing or
+ * aborting prepared transactions). Should be used sparingly.
+ *
+ * TODO SERVER-67951: Update comment to address that kHigh priority operations are always
+ * granted a ticket immediately upon request.
+ */
+ enum class AcquisitionPriority { kLow, kNormal, kHigh };
+
+ /**
* Wait mode for ticket acquisition: interruptible or uninterruptible.
*/
enum WaitMode { kInterruptible, kUninterruptible };