From 3660b8fb0e1d7350c6c19f23cbacb6b948b23d58 Mon Sep 17 00:00:00 2001 From: onderkalaci Date: Wed, 26 Apr 2023 20:14:16 +0300 Subject: [PATCH] PG commit 11470f544e3729c60fab890145b2e839cbc8905e --- src/backend/columnar/columnar_tableam.c | 126 +++--------------------- 1 file changed, 15 insertions(+), 111 deletions(-) diff --git a/src/backend/columnar/columnar_tableam.c b/src/backend/columnar/columnar_tableam.c index 2796064c4..a8d0b265f 100644 --- a/src/backend/columnar/columnar_tableam.c +++ b/src/backend/columnar/columnar_tableam.c @@ -828,10 +828,16 @@ columnar_tuple_delete(Relation relation, ItemPointer tid, CommandId cid, static TM_Result -columnar_tuple_update(Relation relation, ItemPointer otid, TupleTableSlot *slot, - CommandId cid, Snapshot snapshot, Snapshot crosscheck, - bool wait, TM_FailureData *tmfd, - LockTupleMode *lockmode, bool *update_indexes) +columnar_tuple_update(Relation rel, + ItemPointer otid, + TupleTableSlot *slot, + CommandId cid, + Snapshot snapshot, + Snapshot crosscheck, + bool wait, + TM_FailureData *tmfd, + LockTupleMode *lockmode, + TU_UpdateIndexes *update_indexes) { elog(ERROR, "columnar_tuple_update not implemented"); } @@ -1065,113 +1071,11 @@ static void columnar_vacuum_rel(Relation rel, VacuumParams *params, BufferAccessStrategy bstrategy) { - if (!CheckCitusColumnarVersion(WARNING)) - { - /* - * Skip if the extension catalogs are not up-to-date, but avoid - * 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(); +/* TODO: PG commits b6074846cebc33d752f1d9a66e5a9932f21ad177 and +4ce3afb82ecfbf64d4f6247e725004e1da30f47c has changed how vacuum +works. Read them and adjust +For now, comment out so that we can compile +*/ }