| 1212 | |
| 1213 | |
| 1214 | static uint64 |
| 1215 | InsertOneWithTransactionCore(uint64 collectionId, const char *shardTableName, |
| 1216 | int64 shardKeyValue, text *transactionId, |
| 1217 | pgbson *objectId, pgbson *document) |
| 1218 | { |
| 1219 | RetryableWriteResult writeResult; |
| 1220 | |
| 1221 | /* |
| 1222 | * If a retry record exists, delete it since only a single retry is allowed. |
| 1223 | */ |
| 1224 | if (DeleteRetryRecord(collectionId, shardKeyValue, transactionId, &writeResult)) |
| 1225 | { } |
| 1226 | else |
| 1227 | { |
| 1228 | /* no retry record exists, insert the document */ |
| 1229 | InsertDocument(collectionId, shardTableName, shardKeyValue, objectId, document); |
| 1230 | |
| 1231 | /* we always insert 1 row */ |
| 1232 | bool rowsAffected = true; |
| 1233 | |
| 1234 | /* remember that transaction performed the insert */ |
| 1235 | InsertRetryRecord(collectionId, shardKeyValue, transactionId, objectId, |
| 1236 | rowsAffected, NULL); |
| 1237 | } |
| 1238 | |
| 1239 | return 1; |
| 1240 | } |
| 1241 | |
| 1242 | |
| 1243 | Datum |
no test coverage detected