mirror of https://github.com/mongodb/mongo
SERVER-112570 Fix priority stats with the new ticketing system implementation (#42926)
GitOrigin-RevId: d3b89976277f0099ac5b41f6b30cfbb799ac8fa0
This commit is contained in:
parent
da6ca6ce50
commit
cf3a5e9ef1
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* Checks the statistic scheme of the different execution control algorithms.
|
||||
*
|
||||
* @tags: [
|
||||
* featureFlagMultipleTicketPoolsExecutionControl,
|
||||
* ]
|
||||
*/
|
||||
|
||||
import {ReplSetTest} from "jstests/libs/replsettest.js";
|
||||
|
||||
function assertTicketStatsScheme(bool, obj) {
|
||||
assert.eq(bool, obj.hasOwnProperty("out"));
|
||||
assert.eq(bool, obj.hasOwnProperty("available"));
|
||||
assert.eq(bool, obj.hasOwnProperty("totalTickets"));
|
||||
}
|
||||
|
||||
function assertNormalScheme(obj) {
|
||||
assertTicketStatsScheme(true, obj);
|
||||
assert.eq(true, obj.hasOwnProperty("exempt"));
|
||||
assertTicketStatsScheme(false, obj.exempt);
|
||||
assert.eq(false, obj.hasOwnProperty("lowPriority"));
|
||||
assert.eq(true, obj.hasOwnProperty("normalPriority"));
|
||||
assertTicketStatsScheme(false, obj.normalPriority);
|
||||
}
|
||||
|
||||
function assertDeprioritizationScheme(obj) {
|
||||
assertTicketStatsScheme(true, obj);
|
||||
assert.eq(true, obj.hasOwnProperty("lowPriority"));
|
||||
assertTicketStatsScheme(true, obj.lowPriority);
|
||||
assert.eq(true, obj.hasOwnProperty("normalPriority"));
|
||||
assertTicketStatsScheme(true, obj.normalPriority);
|
||||
assert.eq(true, obj.hasOwnProperty("exempt"));
|
||||
assertTicketStatsScheme(false, obj.exempt);
|
||||
}
|
||||
|
||||
const rst = new ReplSetTest({
|
||||
nodes: 1,
|
||||
});
|
||||
|
||||
rst.startSet();
|
||||
rst.initiate();
|
||||
|
||||
const primary = rst.getPrimary();
|
||||
const db = primary.getDB(jsTestName());
|
||||
|
||||
assert.commandWorked(
|
||||
rst.getPrimary().adminCommand({
|
||||
setParameter: 1,
|
||||
storageEngineConcurrencyAdjustmentAlgorithm: "throughputProbing",
|
||||
}),
|
||||
);
|
||||
|
||||
const serverStatus = db.serverStatus().queues.execution.read;
|
||||
assertNormalScheme(serverStatus);
|
||||
|
||||
assert.commandWorked(
|
||||
rst.getPrimary().adminCommand({
|
||||
setParameter: 1,
|
||||
storageEngineConcurrencyAdjustmentAlgorithm: "fixedConcurrentTransactions",
|
||||
}),
|
||||
);
|
||||
|
||||
const serverStatusFixedTxns = db.serverStatus().queues.execution.read;
|
||||
assertNormalScheme(serverStatusFixedTxns);
|
||||
|
||||
assert.commandWorked(
|
||||
rst.getPrimary().adminCommand({
|
||||
setParameter: 1,
|
||||
storageEngineConcurrencyAdjustmentAlgorithm: "fixedConcurrentTransactionsWithPrioritization",
|
||||
}),
|
||||
);
|
||||
|
||||
const serverStatusFixedTxnsPrioritization = db.serverStatus().queues.execution.read;
|
||||
assertDeprioritizationScheme(serverStatusFixedTxnsPrioritization);
|
||||
|
||||
rst.stopSet();
|
||||
|
|
@ -367,8 +367,11 @@ void TicketingSystem::appendStats(BSONObjBuilder& b) const {
|
|||
for (size_t i = 0; i < _holders.size(); ++i) {
|
||||
const auto priority = static_cast<AdmissionContext::Priority>(i);
|
||||
|
||||
if (priority == AdmissionContext::Priority::kExempt) {
|
||||
// Do not report statistics for kExempt as they are included in the normal priority pool
|
||||
if (priority == AdmissionContext::Priority::kExempt ||
|
||||
(priority == AdmissionContext::Priority::kLow && !usesPrioritization())) {
|
||||
// Do not report statistics for kExempt as they are included in the normal priority
|
||||
// pool. Also, low priority statistics should only be reported when prioritization is
|
||||
// enabled.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -385,7 +388,9 @@ void TicketingSystem::appendStats(BSONObjBuilder& b) const {
|
|||
readStats.emplace();
|
||||
}
|
||||
BSONObjBuilder bb(readStats->subobjStart(fieldName));
|
||||
if (usesPrioritization()) {
|
||||
rw.read->appendTicketStats(bb);
|
||||
}
|
||||
rw.read->appendHolderStats(bb);
|
||||
bb.done();
|
||||
if (priority == AdmissionContext::Priority::kNormal) {
|
||||
|
|
@ -402,7 +407,9 @@ void TicketingSystem::appendStats(BSONObjBuilder& b) const {
|
|||
writeStats.emplace();
|
||||
}
|
||||
BSONObjBuilder bb(writeStats->subobjStart(fieldName));
|
||||
if (usesPrioritization()) {
|
||||
rw.write->appendTicketStats(bb);
|
||||
}
|
||||
rw.write->appendHolderStats(bb);
|
||||
bb.done();
|
||||
if (priority == AdmissionContext::Priority::kNormal) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue