|
28 | 28 | #include "access/xlog.h" |
29 | 29 | #include "storage/proc.h" |
30 | 30 | #include "storage/procarray.h" |
31 | | -#include "executor/spi.h" |
32 | 31 | #include "executor/executor.h" |
33 | 32 | #include "access/twophase.h" |
34 | 33 | #include "utils/guc.h" |
@@ -104,7 +103,6 @@ static void DtmShmemStartup(void); |
104 | 103 | static void DtmBackgroundWorker(Datum arg); |
105 | 104 |
|
106 | 105 | static void MMMarkTransAsLocal(TransactionId xid); |
107 | | -static void MMExecutor(int id, void* work, size_t size); |
108 | 106 | static BgwPool* MMPoolConstructor(void); |
109 | 107 |
|
110 | 108 | static shmem_startup_hook_type prev_shmem_startup_hook; |
@@ -1185,48 +1183,7 @@ MMExecutorFinish(QueryDesc *queryDesc) |
1185 | 1183 | { |
1186 | 1184 | standard_ExecutorFinish(queryDesc); |
1187 | 1185 | } |
1188 | | -} |
1189 | | - |
1190 | | -static void MMExecutor(int id, void* work, size_t size) |
1191 | | -{ |
1192 | | - TransactionId xid = *(TransactionId*)work; |
1193 | | - char* stmts = (char*)work + 4; |
1194 | | - bool finished = false; |
1195 | | - |
1196 | | - MMJoinTransaction(xid); |
1197 | | - |
1198 | | - SetCurrentStatementStartTimestamp(); |
1199 | | - StartTransactionCommand(); |
1200 | | - SPI_connect(); |
1201 | | - PushActiveSnapshot(GetTransactionSnapshot()); |
1202 | | - |
1203 | | - PG_TRY(); |
1204 | | - { |
1205 | | - int rc = SPI_execute(stmts, false, 0); |
1206 | | - SPI_finish(); |
1207 | | - PopActiveSnapshot(); |
1208 | | - finished = true; |
1209 | | - if (rc != SPI_OK_INSERT && rc != SPI_OK_UPDATE && rc != SPI_OK_DELETE) { |
1210 | | - ereport(LOG, (errmsg("Executor %d: failed to apply transaction %u", |
1211 | | - id, xid))); |
1212 | | - AbortCurrentTransaction(); |
1213 | | - } else { |
1214 | | - CommitTransactionCommand(); |
1215 | | - } |
1216 | | - } |
1217 | | - PG_CATCH(); |
1218 | | - { |
1219 | | - FlushErrorState(); |
1220 | | - if (!finished) { |
1221 | | - SPI_finish(); |
1222 | | - if (ActiveSnapshotSet()) { |
1223 | | - PopActiveSnapshot(); |
1224 | | - } |
1225 | | - } |
1226 | | - AbortCurrentTransaction(); |
1227 | | - } |
1228 | | - PG_END_TRY(); |
1229 | | -} |
| 1186 | +} |
1230 | 1187 |
|
1231 | 1188 | extern void MMExecute(void* work, int size) |
1232 | 1189 | { |
|
0 commit comments