| 1388 | } |
| 1389 | |
| 1390 | static void |
| 1391 | aoco_relation_copy_data(Relation rel, const RelFileNode *newrnode) |
| 1392 | { |
| 1393 | SMgrRelation dstrel; |
| 1394 | |
| 1395 | /* |
| 1396 | * Use the "AO-specific" (non-shared buffers backed storage) SMGR |
| 1397 | * implementation |
| 1398 | */ |
| 1399 | dstrel = smgropen(*newrnode, rel->rd_backend, SMGR_AO, rel); |
| 1400 | RelationOpenSmgr(rel); |
| 1401 | |
| 1402 | /* |
| 1403 | * Create and copy all forks of the relation, and schedule unlinking of |
| 1404 | * old physical files. |
| 1405 | * |
| 1406 | * NOTE: any conflict in relfilenode value will be caught in |
| 1407 | * RelationCreateStorage(). |
| 1408 | */ |
| 1409 | RelationCreateStorage(*newrnode, rel->rd_rel->relpersistence, SMGR_AO, rel); |
| 1410 | |
| 1411 | copy_append_only_data(rel->rd_node, *newrnode, rel->rd_smgr, dstrel, rel->rd_backend, rel->rd_rel->relpersistence); |
| 1412 | |
| 1413 | /* |
| 1414 | * For append-optimized tables, no forks other than the main fork should |
| 1415 | * exist with the exception of unlogged tables. For unlogged AO tables, |
| 1416 | * INIT_FORK must exist. |
| 1417 | */ |
| 1418 | if (rel->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED) |
| 1419 | { |
| 1420 | Assert (smgrexists(rel->rd_smgr, INIT_FORKNUM)); |
| 1421 | |
| 1422 | /* |
| 1423 | * INIT_FORK is empty, creating it is sufficient, no need to copy |
| 1424 | * contents from source to destination. |
| 1425 | */ |
| 1426 | smgrcreate(dstrel, INIT_FORKNUM, false); |
| 1427 | |
| 1428 | log_smgrcreate(newrnode, INIT_FORKNUM, SMGR_AO); |
| 1429 | } |
| 1430 | |
| 1431 | /* drop old relation, and close new one */ |
| 1432 | RelationDropStorage(rel); |
| 1433 | smgrclose(dstrel); |
| 1434 | } |
| 1435 | |
| 1436 | static void |
| 1437 | aoco_vacuum_rel(Relation onerel, VacuumParams *params, |
nothing calls this directly
no test coverage detected