mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### Does this PR have any customer impact? ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) ### Are you introducing any new config? If yes, do you have tests with and without them being set? ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description Write directly to shard if available ---- #### AI description (iteration 1) #### PR Classification Code cleanup and optimization. #### PR Summary This pull request refactors the shard handling logic to directly write to a shard if available, removing redundant code and simplifying the shard query process. - `src/api_hook_impl.c`: Simplified shard query logic by removing the `GetShardIdOptimistically` function and optimizing the shard ID retrieval process. - `src/metadata/collection.c`: Removed the `allowLocalShard` parameter and related logic, streamlining the collection retrieval process. - `src/aggregation/bson_aggregation_output_pipeline.c` and `src/aggregation/bson_aggregation_pipeline.c`: Updated functions to use the simplified collection retrieval method. - `include/metadata/collection.h`: Removed the declaration for `GetMongoCollectionOrViewByNameDatumWithLocalShard`. - `src/helio_api_init.c`: Changed the default value of `UseLocalExecutionShardQueries` to `true`.
26 lines
922 B
C
26 lines
922 B
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/commands/insert.h
|
|
*
|
|
* Functions for inserting documents.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef COMMANDS_INSERT_H
|
|
#define COMMANDS_INSERT_H
|
|
|
|
#include <io/helio_bson_core.h>
|
|
#include "commands/commands_common.h"
|
|
|
|
MongoCollection * CreateCollectionForInsert(Datum databaseNameDatum,
|
|
Datum collectionNameDatum);
|
|
bool InsertDocument(uint64 collectionId, const char *shardTableName, int64 shardKeyValue,
|
|
pgbson *objectId, pgbson *document);
|
|
|
|
bool InsertDocumentToTempCollection(MongoCollection *collection, int64 shardKeyValue,
|
|
pgbson *document);
|
|
bool TryInsertOne(MongoCollection *collection, pgbson *document, int64 shardKeyHash, bool
|
|
sameSourceAndTarget, WriteError *writeError);
|
|
#endif
|