mirror of https://github.com/citusdata/citus.git
PG commit 11470f544e3729c60fab890145b2e839cbc8905e
parent
2ee6d4cae4
commit
3660b8fb0e
|
@ -828,10 +828,16 @@ columnar_tuple_delete(Relation relation, ItemPointer tid, CommandId cid,
|
||||||
|
|
||||||
|
|
||||||
static TM_Result
|
static TM_Result
|
||||||
columnar_tuple_update(Relation relation, ItemPointer otid, TupleTableSlot *slot,
|
columnar_tuple_update(Relation rel,
|
||||||
CommandId cid, Snapshot snapshot, Snapshot crosscheck,
|
ItemPointer otid,
|
||||||
bool wait, TM_FailureData *tmfd,
|
TupleTableSlot *slot,
|
||||||
LockTupleMode *lockmode, bool *update_indexes)
|
CommandId cid,
|
||||||
|
Snapshot snapshot,
|
||||||
|
Snapshot crosscheck,
|
||||||
|
bool wait,
|
||||||
|
TM_FailureData *tmfd,
|
||||||
|
LockTupleMode *lockmode,
|
||||||
|
TU_UpdateIndexes *update_indexes)
|
||||||
{
|
{
|
||||||
elog(ERROR, "columnar_tuple_update not implemented");
|
elog(ERROR, "columnar_tuple_update not implemented");
|
||||||
}
|
}
|
||||||
|
@ -1065,113 +1071,11 @@ static void
|
||||||
columnar_vacuum_rel(Relation rel, VacuumParams *params,
|
columnar_vacuum_rel(Relation rel, VacuumParams *params,
|
||||||
BufferAccessStrategy bstrategy)
|
BufferAccessStrategy bstrategy)
|
||||||
{
|
{
|
||||||
if (!CheckCitusColumnarVersion(WARNING))
|
/* TODO: PG commits b6074846cebc33d752f1d9a66e5a9932f21ad177 and
|
||||||
{
|
4ce3afb82ecfbf64d4f6247e725004e1da30f47c has changed how vacuum
|
||||||
/*
|
works. Read them and adjust
|
||||||
* Skip if the extension catalogs are not up-to-date, but avoid
|
For now, comment out so that we can compile
|
||||||
* erroring during auto-vacuum.
|
|
||||||
*/
|
*/
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pgstat_progress_start_command(PROGRESS_COMMAND_VACUUM,
|
|
||||||
RelationGetRelid(rel));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If metapage version of relation is older, then we hint users to VACUUM
|
|
||||||
* the relation in ColumnarMetapageCheckVersion. So if needed, upgrade
|
|
||||||
* the metapage before doing anything.
|
|
||||||
*/
|
|
||||||
bool isUpgrade = true;
|
|
||||||
ColumnarStorageUpdateIfNeeded(rel, isUpgrade);
|
|
||||||
|
|
||||||
int elevel = (params->options & VACOPT_VERBOSE) ? INFO : DEBUG2;
|
|
||||||
|
|
||||||
/* this should have been resolved by vacuum.c until now */
|
|
||||||
Assert(params->truncate != VACOPTVALUE_UNSPECIFIED);
|
|
||||||
|
|
||||||
LogRelationStats(rel, elevel);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We don't have updates, deletes, or concurrent updates, so all we
|
|
||||||
* care for now is truncating the unused space at the end of storage.
|
|
||||||
*/
|
|
||||||
if (params->truncate == VACOPTVALUE_ENABLED)
|
|
||||||
{
|
|
||||||
TruncateColumnar(rel, elevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockNumber new_rel_pages = smgrnblocks(RelationGetSmgr(rel), MAIN_FORKNUM);
|
|
||||||
|
|
||||||
/* get the number of indexes */
|
|
||||||
List *indexList = RelationGetIndexList(rel);
|
|
||||||
int nindexes = list_length(indexList);
|
|
||||||
|
|
||||||
TransactionId oldestXmin;
|
|
||||||
TransactionId freezeLimit;
|
|
||||||
MultiXactId multiXactCutoff;
|
|
||||||
|
|
||||||
/* initialize xids */
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
|
||||||
MultiXactId oldestMxact;
|
|
||||||
vacuum_set_xid_limits(rel,
|
|
||||||
params->freeze_min_age,
|
|
||||||
params->freeze_table_age,
|
|
||||||
params->multixact_freeze_min_age,
|
|
||||||
params->multixact_freeze_table_age,
|
|
||||||
&oldestXmin, &oldestMxact,
|
|
||||||
&freezeLimit, &multiXactCutoff);
|
|
||||||
|
|
||||||
Assert(MultiXactIdPrecedesOrEquals(multiXactCutoff, oldestMxact));
|
|
||||||
#else
|
|
||||||
TransactionId xidFullScanLimit;
|
|
||||||
MultiXactId mxactFullScanLimit;
|
|
||||||
vacuum_set_xid_limits(rel,
|
|
||||||
params->freeze_min_age,
|
|
||||||
params->freeze_table_age,
|
|
||||||
params->multixact_freeze_min_age,
|
|
||||||
params->multixact_freeze_table_age,
|
|
||||||
&oldestXmin, &freezeLimit, &xidFullScanLimit,
|
|
||||||
&multiXactCutoff, &mxactFullScanLimit);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Assert(TransactionIdPrecedesOrEquals(freezeLimit, oldestXmin));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Columnar storage doesn't hold any transaction IDs, so we can always
|
|
||||||
* just advance to the most aggressive value.
|
|
||||||
*/
|
|
||||||
TransactionId newRelFrozenXid = oldestXmin;
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
|
||||||
MultiXactId newRelminMxid = oldestMxact;
|
|
||||||
#else
|
|
||||||
MultiXactId newRelminMxid = multiXactCutoff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
double new_live_tuples = ColumnarTableTupleCount(rel);
|
|
||||||
|
|
||||||
/* all visible pages are always 0 */
|
|
||||||
BlockNumber new_rel_allvisible = 0;
|
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
|
||||||
bool frozenxid_updated;
|
|
||||||
bool minmulti_updated;
|
|
||||||
|
|
||||||
vac_update_relstats(rel, new_rel_pages, new_live_tuples,
|
|
||||||
new_rel_allvisible, nindexes > 0,
|
|
||||||
newRelFrozenXid, newRelminMxid,
|
|
||||||
&frozenxid_updated, &minmulti_updated, false);
|
|
||||||
#else
|
|
||||||
vac_update_relstats(rel, new_rel_pages, new_live_tuples,
|
|
||||||
new_rel_allvisible, nindexes > 0,
|
|
||||||
newRelFrozenXid, newRelminMxid, false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pgstat_report_vacuum(RelationGetRelid(rel),
|
|
||||||
rel->rd_rel->relisshared,
|
|
||||||
Max(new_live_tuples, 0),
|
|
||||||
0);
|
|
||||||
pgstat_progress_end_command();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue