PostgreSQL Source Code: src/backend/storage/ipc/procarray.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

47

48#include <signal.h>

49

71

72#define UINT32_ACCESS_ONCE(var) ((uint32)(*((volatile uint32 *)&(var))))

73

74

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

179

180

181

182

184{

185

186

187

188

190

191

192

193

194

197

198

199

200

201

202

203

204

205

206

207

208

210

211

212

213

214

215

216

217

219

220

221

222

223

224

225

226

227

228

230

231

232

233

234

236

237

238

239

240

242

243

244

245

246

249

250

251

252

260

261

262

263

271

272

274

276

277

278

279

281

282

283

284

288

289

290

291

292

293

295

296

297

298

299

300

305

306

307

308

309

310

312

313#ifdef XIDCACHE_DEBUG

314

315

325

326#define xc_by_recent_xmin_inc() (xc_by_recent_xmin++)

327#define xc_by_known_xact_inc() (xc_by_known_xact++)

328#define xc_by_my_xact_inc() (xc_by_my_xact++)

329#define xc_by_latest_xid_inc() (xc_by_latest_xid++)

330#define xc_by_main_xid_inc() (xc_by_main_xid++)

331#define xc_by_child_xid_inc() (xc_by_child_xid++)

332#define xc_by_known_assigned_inc() (xc_by_known_assigned++)

333#define xc_no_overflow_inc() (xc_no_overflow++)

334#define xc_slow_answer_inc() (xc_slow_answer++)

335

337#else

338

339#define xc_by_recent_xmin_inc() ((void) 0)

340#define xc_by_known_xact_inc() ((void) 0)

341#define xc_by_my_xact_inc() ((void) 0)

342#define xc_by_latest_xid_inc() ((void) 0)

343#define xc_by_main_xid_inc() ((void) 0)

344#define xc_by_child_xid_inc() ((void) 0)

345#define xc_by_known_assigned_inc() ((void) 0)

346#define xc_no_overflow_inc() ((void) 0)

347#define xc_slow_answer_inc() ((void) 0)

348#endif

349

350

371

375

376

377

378

381{

383

384

385#define PROCARRAY_MAXPROCS (MaxBackends + max_prepared_xacts)

386

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403#define TOTAL_MAX_CACHED_SUBXIDS \

404 ((PGPROC_MAX_CACHED_SUBXIDS + 1) * PROCARRAY_MAXPROCS)

405

407 {

413 }

414

415 return size;

416}

417

418

419

420

421void

423{

424 bool found;

425

426

432 &found);

433

434 if (!found)

435 {

436

437

438

449 }

450

452

453

455 {

460 &found);

464 &found);

465 }

466}

467

468

469

470

471void

473{

478

479

482

484 {

485

486

487

488

489

492 errmsg("sorry, too many clients already")));

493 }

494

495

496

497

498

499

500

501

502

503

505 {

507

510

511

513 break;

514 }

515

529

535

537

538

541 {

543

546

548 }

549

550

551

552

553

556}

557

558

559

560

561

562

563

564

565

566

567

568void

570{

574

575#ifdef XIDCACHE_DEBUG

576

577 if (proc->pid != 0)

579#endif

580

581

584

586

589

591 {

593

594

596

597

599

603 }

604 else

605 {

606

608 }

609

613

615

616

630

631 arrayP->pgprocnos[arrayP->numProcs - 1] = -1;

633

634

635

636

637

639 {

641

644

646 }

647

648

649

650

651

654}

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670void

672{

674 {

675

676

677

678

679

680

682

683

684

685

686

687

689 {

692 }

693 else

695 }

696 else

697 {

698

699

700

701

702

706

709

710

712

714

715

716

718 {

725 }

726 }

727}

728

729

730

731

732

733

734static inline void

736{

738

739

740

741

742

746

751

752

754

756

757

758

760 {

763 }

764

765

769 {

774 }

775

776

778

779

781}

782

783

784

785

786

787

788

789

790

791

792

793

794

795static void

797{

802

803

805

806

810 while (true)

811 {

813

817 break;

818 }

819

820

821

822

823

824

825

827 {

829

830

832 for (;;)

833 {

834

837 break;

839 }

841

843

844

847 return;

848 }

849

850

852

853

854

855

856

857

860

861

863

864

866 {

868

870

871

873 }

874

875

877

878

879

880

881

882

883

884

886 {

888

891

892

894

895 nextproc->procArrayGroupMember = false;

896

899 }

900}

901

902

903

904

905

906

907

908

909

910void

912{

913 int pgxactoff;

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

930

932

935

939

942

943

944

945

946

947

948

949

951

952

956 {

961 }

962

964}

965

966

967

968

969

970static void

972{

974

978

980 {

983 }

984

987}

988

989

990

991

992static void

994{

997

1000

1001

1002

1003

1004

1005

1008

1011 {

1014 }

1015

1017}

1018

1019

1020

1021

1022

1023

1024

1025

1026void

1028{

1031

1032

1033

1034

1035

1036

1037

1040}

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057void

1059{

1063 int i;

1064

1069

1070

1071

1072

1074

1075

1076

1077

1078

1079

1084

1085

1086

1087

1089

1090

1091

1092

1094 return;

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1108 {

1109

1110

1111

1112

1114 {

1115

1116

1117

1118

1121 }

1122 else

1123 {

1126 {

1129 "recovery snapshots are now enabled");

1130 }

1131 else

1133 "recovery snapshot waiting for non-overflowed snapshot or "

1134 "until oldest active xid on standby is at least %u (now %u)",

1137 return;

1138 }

1139 }

1140

1142

1143

1144

1145

1146

1147

1148

1149

1150

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1170

1171

1172

1173

1175 for (i = 0; i < running->xcnt + running->subxcnt; i++)

1176 {

1178

1179

1180

1181

1182

1183

1184

1186 continue;

1187

1188 xids[nxids++] = xid;

1189 }

1190

1192 {

1194 {

1196 elog(ERROR, "KnownAssignedXids is not empty");

1197 }

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1209

1210

1211

1212

1213

1214

1216 {

1218 {

1220 "found duplicated transaction %u for KnownAssignedXids insertion",

1221 xids[i]);

1222 continue;

1223 }

1225 }

1226

1228 }

1229

1231

1232

1233

1234

1235

1236

1237

1238

1239

1240

1241

1245 {

1248 }

1250

1251

1252

1253

1254

1255

1256

1257

1258

1259

1260

1261

1262

1263

1264

1266 {

1268

1271 }

1272 else

1273 {

1275

1277

1278

1279

1280

1281

1284 else

1285 {

1288 }

1289 }

1290

1291

1292

1293

1294

1295

1296

1298

1299

1300

1301

1302

1303

1305

1308 elog(DEBUG1, "recovery snapshots are now enabled");

1309 else

1311 "recovery snapshot waiting for non-overflowed snapshot or "

1312 "until oldest active xid on standby is at least %u (now %u)",

1315}

1316

1317

1318

1319

1320

1321void

1324{

1326 int i;

1327

1329

1331

1332

1333

1334

1335

1336

1337

1338

1339

1341

1342

1343

1344

1345

1346

1347

1348

1349

1350

1351

1352

1355

1356

1358 return;

1359

1360

1361

1362

1364

1365

1366

1367

1369

1370

1371

1372

1375

1377}

1378

1379

1380

1381

1382

1383

1384

1385

1386

1387

1388

1389

1390

1391

1392

1393

1394

1395

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405bool

1407{

1416 int numProcs;

1417 int j;

1418

1419

1420

1421

1422

1423

1424

1426 {

1428 return false;

1429 }

1430

1431

1432

1433

1434

1435

1437 {

1439 return false;

1440 }

1441

1442

1443

1444

1445

1447 {

1449 return true;

1450 }

1451

1452

1453

1454

1455

1456 if (xids == NULL)

1457 {

1458

1459

1460

1461

1462

1464

1466 if (xids == NULL)

1469 errmsg("out of memory")));

1470 }

1471

1474

1476

1477

1478

1479

1480

1481 latestCompletedXid =

1484 {

1487 return true;

1488 }

1489

1490

1492 numProcs = arrayP->numProcs;

1493 for (int pgxactoff = 0; pgxactoff < numProcs; pgxactoff++)

1494 {

1495 int pgprocno;

1499

1500

1502 continue;

1503

1504

1506

1508 continue;

1509

1510

1511

1512

1514 {

1517 return true;

1518 }

1519

1520

1521

1522

1523

1525 continue;

1526

1527

1528

1529

1531 pg_read_barrier();

1532 pgprocno = arrayP->pgprocnos[pgxactoff];

1534 for (j = pxids - 1; j >= 0; j--)

1535 {

1536

1538

1540 {

1543 return true;

1544 }

1545 }

1546

1547

1548

1549

1550

1551

1552

1553

1556 }

1557

1558

1559

1560

1561

1563 {

1564

1566

1568 {

1571 return true;

1572 }

1573

1574

1575

1576

1577

1578

1579

1580

1583 }

1584

1586

1587

1588

1589

1590

1592 {

1595 return false;

1596 }

1597

1598

1599

1600

1601

1602

1603

1604

1605

1607

1609 {

1611 return false;

1612 }

1613

1614

1615

1616

1617

1618

1623 return true;

1624

1626 return false;

1627}

1628

1629

1630

1631

1632

1633

1634

1635

1636

1637

1638

1639

1640

1641

1642

1643

1644

1645

1646

1647

1648

1649

1650

1651

1652

1653

1654

1655

1656

1657

1658

1659

1660

1661

1662

1663

1664

1665

1666

1667

1668

1669

1670

1671

1672

1673

1674

1675

1676

1677

1678

1679

1680

1681

1682

1683

1684

1685

1686static void

1688{

1693

1694

1696

1698

1700

1701

1702

1703

1704

1705

1706

1707 {

1709

1713

1717

1718

1719

1720

1721

1722

1723

1724

1725

1726

1727

1728

1729

1732 else

1734 }

1735

1736

1737

1738

1739

1740

1743

1745 {

1746 int pgprocno = arrayP->pgprocnos[index];

1751

1752

1755

1756

1757

1758

1759

1760

1761

1762

1764

1765

1767 continue;

1768

1769

1770

1771

1772

1773

1774

1777

1778

1779

1780

1781

1782

1784 continue;

1785

1786

1789

1790

1791

1792

1793

1794

1795

1796

1797

1798

1799

1800

1801

1802

1803

1804

1805

1806

1807

1808

1813 {

1816 }

1817 }

1818

1819

1820

1821

1822

1825

1826

1827

1828

1829

1831

1833 {

1840

1841 }

1842

1847

1848

1849

1850

1855

1856

1857

1858

1859

1860

1861

1862

1871

1872

1873

1874

1875

1885

1886

1887

1888

1889

1894

1895

1896

1897

1898

1913

1914

1916}

1917

1918

1919

1920

1921

1924{

1925

1926

1927

1928

1933

1941 else

1943}

1944

1945

1946

1947

1948

1949

1950

1951

1952

1953

1954

1955

1958{

1960

1962

1964 {

1966 return horizons.shared_oldest_nonremovable;

1968 return horizons.catalog_oldest_nonremovable;

1970 return horizons.data_oldest_nonremovable;

1972 return horizons.temp_oldest_nonremovable;

1973 }

1974

1975

1977}

1978

1979

1980

1981

1982

1983

1984

1987{

1989

1991

1992 return horizons.oldest_considered_running;

1993}

1994

1995

1996

1997

1998void

2000{

2002

2004

2005

2006

2007

2008

2009

2010

2011 *xmin = horizons.shared_oldest_nonremovable_raw;

2012 *catalog_xmin = horizons.slot_catalog_xmin;

2013}

2014

2015

2016

2017

2018

2019

2020int

2025

2026

2027

2028

2029

2030

2031int

2036

2037

2038

2039

2040

2041

2042

2043

2044

2045

2046static bool

2048{

2050

2052

2054 return false;

2055

2058 return false;

2059

2060

2061

2062

2063

2064

2065

2066

2067

2068

2069

2070

2071

2072

2073

2074

2075

2076

2077

2078

2079

2082

2085

2089 snapshot->copied = false;

2090

2091 return true;

2092}

2093

2094

2095

2096

2097

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2120

2121

2122

2123

2124

2125

2128{

2133 int count = 0;

2135 bool suboverflowed = false;

2141

2144

2146

2147

2148

2149

2150

2151

2152

2153

2154

2155

2156

2157

2158 if (snapshot->xip == NULL)

2159 {

2160

2161

2162

2163

2166 if (snapshot->xip == NULL)

2169 errmsg("out of memory")));

2176 errmsg("out of memory")));

2177 }

2178

2179

2180

2181

2182

2184

2186 {

2188 return snapshot;

2189 }

2190

2195

2198

2199

2203

2204

2205 xmin = xmax;

2206

2207

2210

2212

2214 {

2215 int numProcs = arrayP->numProcs;

2217 int *pgprocnos = arrayP->pgprocnos;

2220

2221

2222

2223

2224

2225 for (int pgxactoff = 0; pgxactoff < numProcs; pgxactoff++)

2226 {

2227

2229 uint8 statusFlags;

2230

2232

2233

2234

2235

2236

2238 continue;

2239

2240

2241

2242

2243

2244

2246 continue;

2247

2248

2249

2250

2251

2252

2253

2255

2256

2257

2258

2259

2260

2262 continue;

2263

2264

2265

2266

2267

2270 continue;

2271

2273 xmin = xid;

2274

2275

2276 xip[count++] = xid;

2277

2278

2279

2280

2281

2282

2283

2284

2285

2286

2287

2288

2289

2290

2291

2292

2293 if (!suboverflowed)

2294 {

2295

2296 if (subxidStates[pgxactoff].overflowed)

2297 suboverflowed = true;

2298 else

2299 {

2301

2303 {

2304 int pgprocno = pgprocnos[pgxactoff];

2306

2308

2313 }

2314 }

2315 }

2316 }

2317 }

2318 else

2319 {

2320

2321

2322

2323

2324

2325

2326

2327

2328

2329

2330

2331

2332

2333

2334

2335

2336

2337

2338

2339

2340

2341

2342

2343

2344

2345

2346

2347

2348

2350 xmax);

2351

2353 suboverflowed = true;

2354 }

2355

2356

2357

2358

2359

2360

2361

2364

2367

2369

2370

2371 {

2377

2378

2379

2380

2381

2382

2384

2385

2388

2389

2390

2391

2392

2394

2395

2396

2397

2398

2401

2404

2405

2406

2407

2408

2409

2419

2423 else

2424 {

2427 }

2428

2429

2430

2431

2432

2433

2434

2435

2436

2446

2448 }

2449

2452

2453 snapshot->xmin = xmin;

2454 snapshot->xmax = xmax;

2455 snapshot->xcnt = count;

2459

2461

2462

2463

2464

2465

2468 snapshot->copied = false;

2469

2470 return snapshot;

2471}

2472

2473

2474

2475

2476

2477

2478

2479

2480

2481

2482

2483bool

2486{

2487 bool result = false;

2490

2493 return false;

2494

2495

2497

2498

2499

2500

2501

2502

2504 {

2505 int pgprocno = arrayP->pgprocnos[index];

2509

2510

2512 continue;

2513

2514

2516 continue;

2518 continue;

2519

2520

2521

2522

2523

2524

2525

2527 continue;

2528

2529

2530

2531

2535 continue;

2536

2537

2538

2539

2540

2541

2542

2544

2545 result = true;

2546 break;

2547 }

2548

2550

2551 return result;

2552}

2553

2554

2555

2556

2557

2558

2559

2560

2561

2562

2563

2564

2565

2566

2567bool

2569{

2570 bool result = false;

2572

2575

2576

2577

2578

2580

2581

2582

2583

2584

2585

2586

2591 {

2592

2593

2594

2595

2600

2601 result = true;

2602 }

2603

2605

2606 return result;

2607}

2608

2609

2610

2611

2612

2613

2614

2615

2616

2617

2618

2619

2620

2621

2622

2623

2624

2625

2626

2627

2628

2629

2630

2631

2632

2633

2634

2635

2636

2637

2638

2639

2642{

2643

2645

2654 int count;

2656 bool suboverflowed;

2657

2659

2660

2661

2662

2663

2664

2665

2666

2667

2668

2670 {

2671

2672

2673

2679 errmsg("out of memory")));

2680 }

2681

2683

2685 suboverflowed = false;

2686

2687

2688

2689

2690

2693

2694 latestCompletedXid =

2696 oldestDatabaseRunningXid = oldestRunningXid =

2698

2699

2700

2701

2703 {

2705

2706

2708

2709

2710

2711

2712

2714 continue;

2715

2716

2717

2718

2719

2720

2722 oldestRunningXid = xid;

2723

2724

2725

2726

2727

2728

2730 {

2731 int pgprocno = arrayP->pgprocnos[index];

2733

2735 oldestDatabaseRunningXid = xid;

2736 }

2737

2739 suboverflowed = true;

2740

2741

2742

2743

2744

2745

2746

2747

2748

2749 xids[count++] = xid;

2750 }

2751

2752

2753

2754

2755

2756 if (!suboverflowed)

2757 {

2759

2761 {

2762 int pgprocno = arrayP->pgprocnos[index];

2765

2766

2767

2768

2769

2772 {

2773

2775

2780

2781

2782

2783

2784

2785

2786 }

2787 }

2788 }

2789

2790

2791

2792

2793

2794

2795

2796

2797

2798

2804 CurrentRunningXacts->oldestDatabaseRunningXid = oldestDatabaseRunningXid;

2806

2810

2811

2812

2814}

2815

2816

2817

2818

2819

2820

2821

2822

2823

2824

2825

2826

2827

2828

2829

2830

2831

2832

2833

2834

2835

2838{

2843

2845

2846

2847

2848

2849

2850

2851

2852

2856

2857

2858

2859

2862 {

2864 int pgprocno = arrayP->pgprocnos[index];

2866

2867

2869

2871 continue;

2872

2875 continue;

2876

2878 continue;

2879

2881 oldestRunningXid = xid;

2882

2883

2884

2885

2886

2887

2888 }

2890

2891 return oldestRunningXid;

2892}

2893

2894

2895

2896

2897

2898

2899

2900

2901

2902

2903

2904

2905

2906

2907

2908

2909

2912{

2917

2919

2920

2921

2922

2923

2924

2925

2926

2927

2930

2931

2932

2933

2934

2935

2936

2937

2942

2948

2949

2950

2951

2952

2953

2954

2955

2956

2957

2958

2959

2960

2962 {

2964

2965

2966

2967

2969 {

2971

2972

2974

2976 continue;

2977

2980 }

2981 }

2982

2984

2986}

2987

2988

2989

2990

2991

2992

2993

2994

2995

2996

2997

2998

2999

3000

3001

3002

3003

3004

3005

3006

3007

3010{

3013 int count = 0;

3015

3017

3018

3020

3022

3024 {

3025 int pgprocno = arrayP->pgprocnos[index];

3027

3029 {

3031

3034 vxids[count++] = vxid;

3035 }

3036 }

3037

3039

3042}

3043

3044

3045

3046

3047

3048

3049

3050

3051

3052

3053bool

3055{

3056 bool result = false;

3059

3061

3063

3065 {

3066 int pgprocno = arrayP->pgprocnos[index];

3069

3071

3074 {

3075 int i;

3076

3078 {

3080 {

3081 result = true;

3082 break;

3083 }

3084 }

3085 if (result)

3086 break;

3087 }

3088 }

3089

3091

3092 return result;

3093}

3094

3095

3096

3097

3098

3099

3100

3101

3104{

3106

3108 return NULL;

3110

3111 if (result->pid == 0)

3112 return NULL;

3113

3114 return result;

3115}

3116

3117

3118

3119

3120

3121

3122

3123

3124void

3127{

3129

3133 *overflowed = false;

3134

3136 return;

3138

3139

3141

3142 if (proc->pid != 0)

3143 {

3144 *xid = proc->xid;

3145 *xmin = proc->xmin;

3148 }

3149

3151}

3152

3153

3154

3155

3156

3157

3158

3159

3162{

3164

3165 if (pid == 0)

3166 return NULL;

3167

3169

3171

3173

3174 return result;

3175}

3176

3177

3178

3179

3180

3181

3182

3185{

3189

3190 if (pid == 0)

3191 return NULL;

3192

3194 {

3196

3197 if (proc->pid == pid)

3198 {

3199 result = proc;

3200 break;

3201 }

3202 }

3203

3204 return result;

3205}

3206

3207

3208

3209

3210

3211

3212

3213

3214

3215

3216

3217

3218

3219

3220int

3222{

3223 int result = 0;

3227

3229 return 0;

3230

3232

3234 {

3236 {

3237 int pgprocno = arrayP->pgprocnos[index];

3239

3240 result = proc->pid;

3241 break;

3242 }

3243 }

3244

3246

3247 return result;

3248}

3249

3250

3251

3252

3253

3254

3255bool

3260

3261

3262

3263

3264

3265

3266

3267

3268

3269

3270

3271

3272

3273

3274

3275

3276

3277

3278

3279

3280

3281

3282

3283

3284

3285

3286

3287

3292{

3295 int count = 0;

3297

3298

3300

3302

3304 {

3305 int pgprocno = arrayP->pgprocnos[index];

3308

3310 continue;

3311

3313 continue;

3314

3316 {

3317

3319

3321 continue;

3322

3323

3324

3325

3326

3329 {

3331

3334 vxids[count++] = vxid;

3335 }

3336 }

3337 }

3338

3340

3343}

3344

3345

3346

3347

3348

3349

3350

3351

3352

3353

3354

3355

3356

3357

3358

3359

3360

3361

3362

3363

3364

3365

3366

3367

3368

3369

3370

3371

3372

3373

3374

3375

3376

3377

3378

3379

3382{

3385 int count = 0;

3387

3388

3389

3390

3391

3392

3394 {

3400 errmsg("out of memory")));

3401 }

3402

3404

3406 {

3407 int pgprocno = arrayP->pgprocnos[index];

3409

3410

3411 if (proc->pid == 0)

3412 continue;

3413

3416 {

3417

3419

3420

3421

3422

3423

3424

3425

3426

3427

3430 {

3432

3435 vxids[count++] = vxid;

3436 }

3437 }

3438 }

3439

3441

3442

3445

3447}

3448

3449

3450

3451

3452

3453

3454

3455

3456

3457

3458bool

3460{

3461 bool found = false;

3462

3464

3465

3466

3467

3468

3469 if (proc->pid == pid)

3470 {

3472

3473

3475 found = true;

3476 }

3477

3479

3480 return found;

3481}

3482

3483

3484

3485

3486

3487

3488bool

3490{

3494

3496

3498 {

3499 int pgprocno = arrayP->pgprocnos[index];

3502

3504

3507 {

3508 pid = proc->pid;

3509 if (pid != 0)

3510 {

3512

3513

3514

3515

3516

3518 }

3519 break;

3520 }

3521 }

3522

3524

3525 return pid != 0;

3526}

3527

3528

3529

3530

3531

3532

3533void

3535{

3538

3539

3541

3543 {

3544 int pgprocno = arrayP->pgprocnos[index];

3546

3548 {

3551

3553

3554 pid = proc->pid;

3555 if (pid != 0)

3556 {

3558

3559

3560

3561

3562

3564 }

3565 }

3566 }

3567

3569}

3570

3571

3572

3573

3574

3575

3576

3577

3578

3579

3580bool

3582{

3584 int count = 0;

3586

3587

3588 if (min == 0)

3589 return true;

3590

3591

3592

3593

3594

3595

3597 {

3598 int pgprocno = arrayP->pgprocnos[index];

3600

3601

3602

3603

3604

3605

3606

3607

3608

3609

3610

3611

3612 if (pgprocno == -1)

3613 continue;

3615 continue;

3617 continue;

3618 if (proc->pid == 0)

3619 continue;

3621 continue;

3622 count++;

3623 if (count >= min)

3624 break;

3625 }

3626

3627 return count >= min;

3628}

3629

3630

3631

3632

3633int

3635{

3637 int count = 0;

3639

3641

3643 {

3644 int pgprocno = arrayP->pgprocnos[index];

3646

3647 if (proc->pid == 0)

3648 continue;

3651 count++;

3652 }

3653

3655

3656 return count;

3657}

3658

3659

3660

3661

3662int

3664{

3666 int count = 0;

3668

3670

3672 {

3673 int pgprocno = arrayP->pgprocnos[index];

3675

3676 if (proc->pid == 0)

3677 continue;

3679 continue;

3682 count++;

3683 }

3684

3686

3687 return count;

3688}

3689

3690

3691

3692

3693

3694int

3696{

3698 int count = 0;

3700

3702

3704 {

3705 int pgprocno = arrayP->pgprocnos[index];

3707

3708 if (proc->pid == 0)

3709 continue;

3711 continue;

3712 if (proc->roleId == roleid)

3713 count++;

3714 }

3715

3717

3718 return count;

3719}

3720

3721

3722

3723

3724

3725

3726

3727

3728

3729

3730

3731

3732

3733

3734

3735

3736

3737

3738

3739

3740

3741

3742

3743

3744

3745

3746bool

3748{

3750

3751#define MAXAUTOVACPIDS 10

3753

3754

3755

3756

3757

3759

3760#ifdef USE_INJECTION_POINTS

3763#endif

3764

3765 for (int tries = 0; tries < ntries; tries++)

3766 {

3768 bool found = false;

3770

3772

3774

3776

3778 {

3779 int pgprocno = arrayP->pgprocnos[index];

3782

3784 continue;

3786 continue;

3787

3788 found = true;

3789

3790 if (proc->pid == 0)

3791 (*nprepared)++;

3792 else

3793 {

3794 (*nbackends)++;

3798 }

3799 }

3800

3802

3803 if (!found)

3804 return false;

3805

3806

3807

3808

3809

3810

3811

3814

3815

3816

3817

3818

3820

3821

3822 pg_usleep(100 * 1000L);

3823 }

3824

3825 return true;

3826}

3827

3828

3829

3830

3831

3832

3833

3834

3835

3836

3837

3838

3839void

3841{

3845 int i;

3846

3848

3850 {

3851 int pgprocno = arrayP->pgprocnos[i];

3853

3855 continue;

3857 continue;

3858

3859 if (proc->pid != 0)

3861 else

3863 }

3864

3866

3870 errmsg("database \"%s\" is being used by prepared transactions",

3872 errdetail_plural("There is %d prepared transaction using the database.",

3873 "There are %d prepared transactions using the database.",

3876

3878 {

3880

3881

3882

3883

3884

3885

3886

3887

3888

3889

3890

3891

3892

3893

3894

3895

3897 {

3900

3901 if (proc != NULL)

3902 {

3906 errmsg("permission denied to terminate process"),

3907 errdetail("Only roles with the %s attribute may terminate processes of roles with the %s attribute.",

3908 "SUPERUSER", "SUPERUSER")));

3909

3914 errmsg("permission denied to terminate process"),

3915 errdetail("Only roles with privileges of the role whose process is being terminated or with privileges of the \"%s\" role may terminate this process.",

3916 "pg_signal_backend")));

3917 }

3918 }

3919

3920

3921

3922

3923

3924

3925

3927 {

3930

3931 if (proc != NULL)

3932 {

3933

3934

3935

3936

3937#ifdef HAVE_SETSID

3939#else

3941#endif

3942 }

3943 }

3944 }

3945}

3946

3947

3948

3949

3950

3951

3952

3953

3954void

3957{

3959

3962

3965

3968

3969 elog(DEBUG1, "xmin required by slots: data %u, catalog %u",

3970 xmin, catalog_xmin);

3971}

3972

3973

3974

3975

3976

3977

3978

3979void

3982{

3984

3985 if (xmin != NULL)

3987

3988 if (catalog_xmin != NULL)

3990

3992}

3993

3994

3995

3996

3997

3998

3999

4000

4001

4002void

4006{

4007 int i,

4008 j;

4010

4012

4013

4014

4015

4016

4017

4018

4019

4020

4021

4022

4023

4024

4026

4028

4029

4030

4031

4032

4033

4034 for (i = nxids - 1; i >= 0; i--)

4035 {

4037

4039 {

4041 {

4046 break;

4047 }

4048 }

4049

4050

4051

4052

4053

4054

4055

4056

4059 }

4060

4062 {

4064 {

4069 break;

4070 }

4071 }

4072

4074 elog(WARNING, "did not find subXID %u in MyProc", xid);

4075

4076

4078

4079

4081

4083}

4084

4085#ifdef XIDCACHE_DEBUG

4086

4087

4088

4089

4090static void

4092{

4094 "XidCache: xmin: %ld, known: %ld, myxact: %ld, latest: %ld, mainxid: %ld, childxid: %ld, knownassigned: %ld, nooflo: %ld, slow: %ld\n",

4104}

4105#endif

4106

4107

4108

4109

4110

4111

4112

4113

4114

4115

4116

4117

4120{

4122

4123

4125

4127 {

4130 break;

4133 break;

4136 break;

4139 break;

4140 }

4141

4144

4146}

4147

4148

4149

4150

4151

4152

4153

4154

4155

4156

4157

4158static bool

4160{

4161

4163 return true;

4164

4165

4166

4167

4168

4170 state->definitely_needed))

4171 return false;

4172

4173

4175}

4176

4177static void

4179{

4182 horizons->shared_oldest_nonremovable);

4185 horizons->catalog_oldest_nonremovable);

4188 horizons->data_oldest_nonremovable);

4191 horizons->temp_oldest_nonremovable);

4192

4193

4194

4195

4196

4197

4208

4210}

4211

4212

4213

4214

4215

4216static void

4224

4225

4226

4227

4228

4229

4230

4231

4232

4233bool

4236{

4237

4238

4239

4240

4242 return true;

4243

4244

4245

4246

4247

4249 return false;

4250

4251

4252

4253

4254

4255

4257 {

4259

4261

4263 }

4264 else

4265 return false;

4266}

4267

4268

4269

4270

4271

4272

4273

4274

4275bool

4277{

4279

4280

4281

4282

4283

4284

4285

4286

4287

4289

4291}

4292

4293

4294

4295

4296

4297bool

4306

4307

4308

4309

4310

4311bool

4320

4321

4322

4323

4324

4325

4326

4327

4328

4329

4330

4331

4334{

4336

4339

4340

4342

4345}

4346

4347

4348

4349

4350

4351

4352

4353

4354

4355

4356

4357

4358

4359

4360

4361

4362

4363

4364

4365

4366

4367

4368

4369

4370

4371

4372

4373

4374

4375

4376

4377

4378

4379

4380

4381

4382

4383

4384

4385

4386

4387

4388

4389

4390

4391

4392

4393

4394

4395

4396

4397

4398

4399

4400

4401

4402

4403

4404

4405

4406

4407

4408

4409

4410

4411

4412

4413

4414void

4416{

4420

4421 elog(DEBUG4, "record known xact %u latestObservedXid %u",

4423

4424

4425

4426

4427

4428

4430 {

4432

4433

4434

4435

4436

4437

4438

4439

4440

4441

4444 {

4447 }

4449

4450

4451

4452

4453

4455 {

4457 return;

4458 }

4459

4460

4461

4462

4466

4467

4468

4469

4471

4472

4474 }

4475}

4476

4477

4478

4479

4480

4481

4482

4483void

4486{

4488

4489

4490

4491

4493

4495

4496

4498

4499

4501

4503}

4504

4505

4506

4507

4508

4509void

4511{

4513

4516

4517

4522

4523

4524

4525

4526

4528

4529

4530

4531

4532

4533

4536}

4537

4538

4539

4540

4541

4542

4543void

4545{

4547

4549

4550

4554

4555

4557

4558

4559

4560

4561

4562

4563

4568}

4569

4570

4571

4572

4573

4574

4575void

4580

4581

4582

4583

4584

4585

4586

4587

4588

4589

4590

4591

4592

4593

4594

4595

4596

4597

4598

4599

4600

4601

4602

4603

4604

4605

4606

4607

4608

4609

4610

4611

4612

4613

4614

4615

4616

4617

4618

4619

4620

4621

4622

4623

4624

4625

4626

4627

4628

4629

4630

4631

4632

4633

4634

4635

4636

4637

4638

4639

4640

4641

4642

4643

4644

4645

4646

4647

4648

4649

4650

4651

4652

4653

4654

4655

4656

4657

4658

4659

4660

4661

4662

4663

4664

4665

4666

4667

4668

4669

4670

4671

4672

4673

4674

4675

4676static void

4678{

4680 int head,

4681 tail,

4682 nelements;

4684 int i;

4685

4686

4689

4690

4691#define KAX_COMPRESS_FREQUENCY 128

4692#define KAX_COMPRESS_IDLE_INTERVAL 1000

4693

4694

4695

4696

4697

4699 tail = pArray->tailKnownAssignedXids;

4700 nelements = head - tail;

4701

4702

4703

4704

4705

4706

4707

4708 if (nelements == pArray->numKnownAssignedXids)

4709 {

4710

4711

4712

4713

4714

4716 return;

4717 }

4719 {

4720

4721

4722

4723

4725 return;

4726

4727

4728

4729

4730

4732 return;

4733 }

4735 {

4736

4737

4738

4739

4740

4742 {

4744

4748 return;

4749 }

4750 }

4751

4752

4755

4756

4757

4758

4759

4761 for (i = tail; i < head; i++)

4762 {

4764 {

4768 }

4769 }

4771

4772 pArray->tailKnownAssignedXids = 0;

4774

4777

4778

4780}

4781

4782

4783

4784

4785

4786

4787

4788

4789

4790

4791

4792

4793static void

4796{

4799 int head,

4800 tail;

4802 int i;

4803

4805

4806

4807

4808

4809

4810

4813 else

4814 {

4818 {

4821 }

4822 }

4823

4824

4825

4826

4827

4828 head = pArray->headKnownAssignedXids;

4829 tail = pArray->tailKnownAssignedXids;

4830

4833

4834

4835

4836

4837

4838

4839 if (head > tail &&

4841 {

4843 elog(ERROR, "out-of-order XID insertion in KnownAssignedXids");

4844 }

4845

4846

4847

4848

4849 if (head + nxids > pArray->maxKnownAssignedXids)

4850 {

4852

4853 head = pArray->headKnownAssignedXids;

4854

4855

4856

4857

4858

4859 if (head + nxids > pArray->maxKnownAssignedXids)

4860 elog(ERROR, "too many KnownAssignedXids");

4861 }

4862

4863

4866 {

4870 head++;

4871 }

4872

4873

4875

4876

4877

4878

4879

4880

4881

4884

4885 pArray->headKnownAssignedXids = head;

4886}

4887

4888

4889

4890

4891

4892

4893

4894

4895

4896

4897static bool

4899{

4901 int first,

4902 last;

4903 int head;

4904 int tail;

4906

4908 head = pArray->headKnownAssignedXids;

4909

4910

4911

4912

4913

4914 if (!remove)

4915 pg_read_barrier();

4916

4917

4918

4919

4920

4921 first = tail;

4922 last = head - 1;

4923 while (first <= last)

4924 {

4927

4930

4932 {

4934 break;

4935 }

4938 else

4940 }

4941

4943 return false;

4944

4946 return false;

4947

4948 if (remove)

4949 {

4951

4952 pArray->numKnownAssignedXids--;

4954

4955

4956

4957

4958

4960 {

4961 tail++;

4963 tail++;

4964 if (tail >= head)

4965 {

4966

4967 pArray->headKnownAssignedXids = 0;

4968 pArray->tailKnownAssignedXids = 0;

4969 }

4970 else

4971 {

4972 pArray->tailKnownAssignedXids = tail;

4973 }

4974 }

4975 }

4976

4977 return true;

4978}

4979

4980

4981

4982

4983

4984

4985static bool

4992

4993

4994

4995

4996

4997

4998static void

5000{

5002

5003 elog(DEBUG4, "remove KnownAssignedXid %u", xid);

5004

5005

5006

5007

5008

5009

5010

5011

5012

5013

5014

5016}

5017

5018

5019

5020

5021

5022

5023

5024static void

5027{

5028 int i;

5029

5032

5035

5036

5038}

5039

5040

5041

5042

5043

5044

5045

5046static void

5048{

5050 int count = 0;

5051 int head,

5052 tail,

5053 i;

5054

5056 {

5057 elog(DEBUG4, "removing all KnownAssignedXids");

5058 pArray->numKnownAssignedXids = 0;

5059 pArray->headKnownAssignedXids = pArray->tailKnownAssignedXids = 0;

5060 return;

5061 }

5062

5064

5065

5066

5067

5068

5069 tail = pArray->tailKnownAssignedXids;

5070 head = pArray->headKnownAssignedXids;

5071

5072 for (i = tail; i < head; i++)

5073 {

5075 {

5077

5079 break;

5080

5082 {

5084 count++;

5085 }

5086 }

5087 }

5088

5089 pArray->numKnownAssignedXids -= count;

5091

5092

5093

5094

5095 for (i = tail; i < head; i++)

5096 {

5098 break;

5099 }

5100 if (i >= head)

5101 {

5102

5103 pArray->headKnownAssignedXids = 0;

5104 pArray->tailKnownAssignedXids = 0;

5105 }

5106 else

5107 {

5108 pArray->tailKnownAssignedXids = i;

5109 }

5110

5111

5113}

5114

5115

5116

5117

5118

5119

5120

5121

5122

5123

5124static int

5131

5132

5133

5134

5135

5136

5137

5138static int

5141{

5142 int count = 0;

5143 int head,

5144 tail;

5145 int i;

5146

5147

5148

5149

5150

5151

5152

5153

5156

5157 pg_read_barrier();

5158

5159 for (i = tail; i < head; i++)

5160 {

5161

5163 {

5165

5166

5167

5168

5169

5170 if (count == 0 &&

5173

5174

5175

5176

5177

5180 break;

5181

5182

5184 }

5185 }

5186

5187 return count;

5188}

5189

5190

5191

5192

5193

5196{

5197 int head,

5198 tail;

5199 int i;

5200

5201

5202

5203

5206

5207 pg_read_barrier();

5208

5209 for (i = tail; i < head; i++)

5210 {

5211

5214 }

5215

5217}

5218

5219

5220

5221

5222

5223

5224

5225

5226

5227

5228

5229static void

5231{

5234 int head,

5235 tail,

5236 i;

5238

5239 tail = pArray->tailKnownAssignedXids;

5240 head = pArray->headKnownAssignedXids;

5241

5243

5244 for (i = tail; i < head; i++)

5245 {

5247 {

5250 }

5251 }

5252

5253 elog(trace_level, "%d KnownAssignedXids (num=%d tail=%d head=%d) %s",

5255 pArray->numKnownAssignedXids,

5256 pArray->tailKnownAssignedXids,

5257 pArray->headKnownAssignedXids,

5258 buf.data);

5259

5261}

5262

5263

5264

5265

5266

5267static void

5269{

5271

5273

5274 pArray->numKnownAssignedXids = 0;

5275 pArray->tailKnownAssignedXids = 0;

5276 pArray->headKnownAssignedXids = 0;

5277

5279}

bool has_privs_of_role(Oid member, Oid role)

static bool pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)

static uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)

#define pg_read_barrier()

#define pg_write_barrier()

static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)

static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)

static uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)

TimestampTz GetCurrentTimestamp(void)

void TerminateBackgroundWorkersForDatabase(Oid databaseId)

#define Assert(condition)

#define FLEXIBLE_ARRAY_MEMBER

#define OidIsValid(objectId)

bool IsCatalogRelation(Relation relation)

#define fprintf(file, fmt, msg)

int errcode(int sqlerrcode)

int errdetail(const char *fmt,...) pg_attribute_printf(1

#define ereport(elevel,...)

int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1

#define palloc_array(type, count)

#define IS_INJECTION_POINT_ATTACHED(name)

List * lappend_int(List *list, int datum)

#define VirtualTransactionIdIsValid(vxid)

#define GET_VXID_FROM_PGPROC(vxid_dst, proc)

#define InvalidLocalTransactionId

#define VirtualTransactionIdEquals(vxid1, vxid2)

char * get_database_name(Oid dbid)

bool LWLockHeldByMe(LWLock *lock)

bool LWLockAcquire(LWLock *lock, LWLockMode mode)

bool LWLockHeldByMeInMode(LWLock *lock, LWLockMode mode)

void LWLockRelease(LWLock *lock)

bool LWLockConditionalAcquire(LWLock *lock, LWLockMode mode)

void pfree(void *pointer)

#define AmStartupProcess()

#define IsBootstrapProcessingMode()

#define CHECK_FOR_INTERRUPTS()

static bool pg_lfind32(uint32 key, const uint32 *base, uint32 nelem)

static char buf[DEFAULT_XLOG_SEG_SIZE]

#define qsort(a, b, c, d)

void PGSemaphoreUnlock(PGSemaphore sema)

void PGSemaphoreLock(PGSemaphore sema)

#define PROC_IN_LOGICAL_DECODING

#define NUM_AUXILIARY_PROCS

#define DELAY_CHKPT_IN_COMMIT

#define PROC_AFFECTS_ALL_HORIZONS

#define GetPGProcByNumber(n)

#define GetNumberFromPGProc(proc)

#define PROC_VACUUM_STATE_MASK

#define PROC_IS_AUTOVACUUM

@ KAX_STARTUP_PROCESS_IDLE

static GlobalVisState GlobalVisDataRels

bool GlobalVisTestIsRemovableFullXid(GlobalVisState *state, FullTransactionId fxid)

TransactionId GetOldestNonRemovableTransactionId(Relation rel)

#define TOTAL_MAX_CACHED_SUBXIDS

static GlobalVisState GlobalVisSharedRels

void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, TransactionId *catalog_xmin)

static GlobalVisState GlobalVisCatalogRels

VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids)

bool SignalRecoveryConflictWithVirtualXID(VirtualTransactionId vxid, RecoveryConflictReason reason)

bool GlobalVisTestIsRemovableXid(GlobalVisState *state, TransactionId xid)

bool GlobalVisCheckRemovableFullXid(Relation rel, FullTransactionId fxid)

static void KnownAssignedXidsCompress(KAXCompressReason reason, bool haveLock)

Size ProcArrayShmemSize(void)

TransactionId GetOldestSafeDecodingTransactionId(bool catalogOnly)

void XidCacheRemoveRunningXids(TransactionId xid, int nxids, const TransactionId *xids, TransactionId latestXid)

static FullTransactionId FullXidRelativeTo(FullTransactionId rel, TransactionId xid)

bool MinimumActiveBackends(int min)

void TerminateOtherDBBackends(Oid databaseId)

#define xc_no_overflow_inc()

static TransactionId standbySnapshotPendingXmin

void ExpireAllKnownAssignedTransactionIds(void)

#define UINT32_ACCESS_ONCE(var)

RunningTransactions GetRunningTransactionData(void)

static void KnownAssignedXidsRemoveTree(TransactionId xid, int nsubxids, TransactionId *subxids)

static int KnownAssignedXidsGetAndSetXmin(TransactionId *xarray, TransactionId *xmin, TransactionId xmax)

#define xc_by_recent_xmin_inc()

void ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)

void ProcNumberGetTransactionIds(ProcNumber procNumber, TransactionId *xid, TransactionId *xmin, int *nsubxid, bool *overflowed)

void RecordKnownAssignedTransactionIds(TransactionId xid)

static int KnownAssignedXidsGet(TransactionId *xarray, TransactionId xmax)

TransactionId GetOldestTransactionIdConsideredRunning(void)

static TransactionId latestObservedXid

static ProcArrayStruct * procArray

int GetMaxSnapshotSubxidCount(void)

int CountDBConnections(Oid databaseid)

static GlobalVisState GlobalVisTempRels

#define xc_by_my_xact_inc()

#define xc_by_known_assigned_inc()

#define PROCARRAY_MAXPROCS

void GetReplicationHorizons(TransactionId *xmin, TransactionId *catalog_xmin)

static bool GlobalVisTestShouldUpdate(GlobalVisState *state)

static void ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid)

static void KnownAssignedXidsRemovePreceding(TransactionId removeXid)

void ProcArrayAdd(PGPROC *proc)

static TransactionId * KnownAssignedXids

#define xc_by_child_xid_inc()

Snapshot GetSnapshotData(Snapshot snapshot)

static bool * KnownAssignedXidsValid

bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids, int type)

static void KnownAssignedXidsRemove(TransactionId xid)

void SignalRecoveryConflictWithDatabase(Oid databaseid, RecoveryConflictReason reason)

void KnownAssignedTransactionIdsIdleMaintenance(void)

static void GlobalVisUpdateApply(ComputeXidHorizonsResult *horizons)

int GetMaxSnapshotXidCount(void)

int CountDBBackends(Oid databaseid)

PGPROC * BackendPidGetProcWithLock(int pid)

bool GlobalVisCheckRemovableXid(Relation rel, TransactionId xid)

PGPROC * BackendPidGetProc(int pid)

bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)

PGPROC * ProcNumberGetProc(ProcNumber procNumber)

#define KAX_COMPRESS_FREQUENCY

GlobalVisState * GlobalVisTestFor(Relation rel)

static TransactionId KnownAssignedXidsGetOldestXmin(void)

void ProcArrayApplyRecoveryInfo(RunningTransactions running)

void ProcArrayClearTransaction(PGPROC *proc)

int CountUserBackends(Oid roleid)

static TransactionId ComputeXidHorizonsResultLastXmin

static void GlobalVisUpdate(void)

#define xc_slow_answer_inc()

static void KnownAssignedXidsDisplay(int trace_level)

#define xc_by_main_xid_inc()

static void MaintainLatestCompletedXidRecovery(TransactionId latestXid)

static void ComputeXidHorizons(ComputeXidHorizonsResult *h)

void ProcArrayApplyXidAssignment(TransactionId topxid, int nsubxids, TransactionId *subxids)

static bool KnownAssignedXidExists(TransactionId xid)

TransactionId GetOldestActiveTransactionId(bool inCommitOnly, bool allDbs)

void ProcArrayShmemInit(void)

bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)

int BackendXidGetPid(TransactionId xid)

#define xc_by_latest_xid_inc()

bool IsBackendPid(int pid)

#define xc_by_known_xact_inc()

static bool KnownAssignedXidsSearch(TransactionId xid, bool remove)

static void KnownAssignedXidsReset(void)

static GlobalVisHorizonKind GlobalVisHorizonKindForRel(Relation rel)

void ProcArraySetReplicationSlotXmin(TransactionId xmin, TransactionId catalog_xmin, bool already_locked)

void ProcArrayInitRecovery(TransactionId initializedUptoXID)

void ProcArrayRemove(PGPROC *proc, TransactionId latestXid)

#define KAX_COMPRESS_IDLE_INTERVAL

VirtualTransactionId * GetConflictingVirtualXIDs(TransactionId limitXmin, Oid dbOid)

static void MaintainLatestCompletedXid(TransactionId latestXid)

static void ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)

void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids, TransactionId *subxids, TransactionId max_xid)

bool SignalRecoveryConflict(PGPROC *proc, pid_t pid, RecoveryConflictReason reason)

VirtualTransactionId * GetVirtualXIDsDelayingChkpt(int *nvxids, int type)

static TransactionId cachedXidIsNotInProgress

bool ProcArrayInstallImportedXmin(TransactionId xmin, VirtualTransactionId *sourcevxid)

static bool GetSnapshotDataReuse(Snapshot snapshot)

static void KnownAssignedXidsAdd(TransactionId from_xid, TransactionId to_xid, bool exclusive_lock)

bool TransactionIdIsInProgress(TransactionId xid)

void ExpireOldKnownAssignedTransactionIds(TransactionId xid)

#define INVALID_PROC_NUMBER

int SendProcSignal(pid_t pid, ProcSignalReason reason, ProcNumber procNumber)

@ PROCSIG_RECOVERY_CONFLICT

#define RELATION_IS_LOCAL(relation)

#define RelationIsAccessibleInLogicalDecoding(relation)

Size add_size(Size s1, Size s2)

Size mul_size(Size s1, Size s2)

void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)

void pg_usleep(long microsec)

TransactionId TransactionXmin

void StandbyReleaseOldLocks(TransactionId oldxid)

void appendStringInfo(StringInfo str, const char *fmt,...)

void initStringInfo(StringInfo str)

TransactionId slot_catalog_xmin

TransactionId data_oldest_nonremovable

TransactionId temp_oldest_nonremovable

TransactionId shared_oldest_nonremovable

TransactionId oldest_considered_running

FullTransactionId latest_completed

TransactionId catalog_oldest_nonremovable

TransactionId shared_oldest_nonremovable_raw

FullTransactionId definitely_needed

FullTransactionId maybe_needed

bool procArrayGroupMember

pg_atomic_uint32 procArrayGroupNext

XidCacheStatus subxidStatus

pg_atomic_uint32 pendingRecoveryConflicts

TransactionId procArrayGroupMemberXid

XidCacheStatus * subxidStates

TransactionId replication_slot_xmin

TransactionId replication_slot_catalog_xmin

int pgprocnos[FLEXIBLE_ARRAY_MEMBER]

TransactionId lastOverflowedXid

int tailKnownAssignedXids

int headKnownAssignedXids

TransactionId oldestRunningXid

TransactionId latestCompletedXid

subxids_array_status subxid_status

uint64 snapXactCompletionCount

FullTransactionId latestCompletedXid

FullTransactionId nextXid

uint64 xactCompletionCount

LocalTransactionId localTransactionId

TransactionId xids[PGPROC_MAX_CACHED_SUBXIDS]

void SubTransSetParent(TransactionId xid, TransactionId parent)

TransactionId SubTransGetTopmostTransaction(TransactionId xid)

void ExtendSUBTRANS(TransactionId newestXact)

bool superuser_arg(Oid roleid)

TransactionId TransactionIdLatest(TransactionId mainxid, int nxids, const TransactionId *xids)

bool TransactionIdDidCommit(TransactionId transactionId)

bool TransactionIdDidAbort(TransactionId transactionId)

static bool TransactionIdFollows(TransactionId id1, TransactionId id2)

#define FullTransactionIdIsNormal(x)

static FullTransactionId FullTransactionIdNewer(FullTransactionId a, FullTransactionId b)

#define TransactionIdRetreat(dest)

#define InvalidTransactionId

static void FullTransactionIdRetreat(FullTransactionId *dest)

#define U64FromFullTransactionId(x)

static bool TransactionIdPrecedesOrEquals(TransactionId id1, TransactionId id2)

static FullTransactionId FullTransactionIdFromU64(uint64 value)

#define FullTransactionIdFollowsOrEquals(a, b)

static bool TransactionIdFollowsOrEquals(TransactionId id1, TransactionId id2)

#define AssertTransactionIdInAllowableRange(xid)

#define TransactionIdEquals(id1, id2)

#define NormalTransactionIdPrecedes(id1, id2)

#define XidFromFullTransactionId(x)

static void FullTransactionIdAdvance(FullTransactionId *dest)

#define TransactionIdIsValid(xid)

#define TransactionIdIsNormal(xid)

#define TransactionIdAdvance(dest)

#define FullTransactionIdPrecedes(a, b)

#define FullTransactionIdIsValid(x)

static TransactionId TransactionIdOlder(TransactionId a, TransactionId b)

static bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)

bool StandbyTransactionIdIsPrepared(TransactionId xid)

#define TimestampTzPlusMilliseconds(tz, ms)

void AdvanceNextFullTransactionIdPastXid(TransactionId xid)

TransamVariablesData * TransamVariables

static void pgstat_report_wait_start(uint32 wait_event_info)

static void pgstat_report_wait_end(void)

bool TransactionIdIsCurrentTransactionId(TransactionId xid)

CommandId GetCurrentCommandId(bool used)

int xidLogicalComparator(const void *arg1, const void *arg2)

bool RecoveryInProgress(void)

HotStandbyState standbyState

@ STANDBY_SNAPSHOT_PENDING