* Core implementation logic for currentOp on the query Coordinator. */
| 268 | * Core implementation logic for currentOp on the query Coordinator. |
| 269 | */ |
| 270 | static void |
| 271 | CurrentOpAggregateCore(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 | /* |
no test coverage detected