MCPcopy Create free account
hub / github.com/documentdb/documentdb / CurrentOpAggregateCore

Function CurrentOpAggregateCore

pg_documentdb/src/commands/current_op.c:270–299  ·  view source on GitHub ↗

* Core implementation logic for currentOp on the query Coordinator. */

Source from the content-addressed store, hash-verified

268 * Core implementation logic for currentOp on the query Coordinator.
269 */
270static void
271CurrentOpAggregateCore(pgbson *spec, TupleDesc descriptor,
272 Tuplestorestate *tupleStore)
273{
274 CurrentOpOptions options = { 0 };
275 PopulateCurrentOpOptions(spec, &options);
276
277 List *workerBsons = NIL;
278 if (options.localOps)
279 {
280 workerBsons = list_make1(CurrentOpWorkerCore(spec));
281 }
282 else
283 {
284 int numValues = 1;
285 Datum values[1] = { PointerGetDatum(spec) };
286 Oid types[1] = { BsonTypeId() };
287 workerBsons = RunQueryOnAllServerNodes("CurrentOp", values, types, numValues,
288 command_current_op_worker,
289 ApiToApiInternalSchemaName,
290 "current_op_worker");
291 }
292
293 MergeWorkerBsons(workerBsons, descriptor, tupleStore);
294
295 /* The index queue and build status only needs to run on the coordinator
296 * run this only here.
297 */
298 AddIndexBuilds(descriptor, tupleStore);
299}
300
301
302/*

Callers 2

Calls 6

PopulateCurrentOpOptionsFunction · 0.85
CurrentOpWorkerCoreFunction · 0.85
BsonTypeIdFunction · 0.85
RunQueryOnAllServerNodesFunction · 0.85
MergeWorkerBsonsFunction · 0.85
AddIndexBuildsFunction · 0.85

Tested by

no test coverage detected