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

Function AddRequestInIndexQueue

pg_documentdb/src/metadata/index.c:1440–1484  ·  view source on GitHub ↗

* AddRequestInIndexQueue inserts a record into ApiCatalogSchemaName.{ExtensionObjectPrefix}_index_queue * for given indexId using SPI. */

Source from the content-addressed store, hash-verified

1438 * for given indexId using SPI.
1439 */
1440void
1441AddRequestInIndexQueue(char *createIndexCmd, int indexId, uint64 collectionId, char
1442 cmdType, Oid userOid)
1443{
1444 Assert(cmdType == CREATE_INDEX_COMMAND_TYPE || cmdType == REINDEX_COMMAND_TYPE);
1445
1446 StringInfo cmdStr = makeStringInfo();
1447
1448 appendStringInfo(cmdStr,
1449 "INSERT INTO %s (index_cmd, index_id, collection_id, index_cmd_status, cmd_type, user_oid",
1450 GetIndexQueueName());
1451
1452 appendStringInfo(cmdStr, ") VALUES ($1, $2, $3, $4, $5, $6) ");
1453
1454 int argCount = 6;
1455 Oid argTypes[6];
1456 Datum argValues[6];
1457 char argNulls[6] = { ' ', ' ', ' ', ' ', ' ', ' ' };
1458
1459 argTypes[0] = TEXTOID;
1460 argValues[0] = PointerGetDatum(cstring_to_text(createIndexCmd));
1461
1462 argTypes[1] = INT4OID;
1463 argValues[1] = Int32GetDatum(indexId);
1464
1465 argTypes[2] = INT8OID;
1466 argValues[2] = Int64GetDatum(collectionId);
1467
1468 argTypes[3] = INT8OID;
1469 argValues[3] = Int64GetDatum(IndexCmdStatus_Queued);
1470
1471 argTypes[4] = CHAROID;
1472 argValues[4] = CharGetDatum(cmdType);
1473
1474 argTypes[5] = OIDOID;
1475 argValues[5] = ObjectIdGetDatum(userOid);
1476
1477 bool isNull = true;
1478 bool readOnly = false;
1479
1480 ExtensionExecuteQueryWithArgsViaSPI(cmdStr->data, argCount, argTypes,
1481 argValues, argNulls, readOnly,
1482 SPI_OK_INSERT,
1483 &isNull);
1484}
1485
1486
1487/*

Calls 2

GetIndexQueueNameFunction · 0.85

Tested by

no test coverage detected