Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pg15] merge: master commit 'd4103e809e0662c5cd4a51f9dfafb44ce210d38c…
…' into pg15 Summary: Merge YB master commit d4103e8 titled [#23513] YSQL: Fix broken org.yb.pgsql.TestYsqlMetrics#testExplainMaxMemory unit test and committed 2024-09-18T13:24:18+03:00 into YB pg15. YB pg15 initial merge refers to 55782d5. - yb_lsm.c: - ybcinbuildCallback: adjacent conflict between YB pg15 b263910 changing ybcinbuildCallback signature and YB master f0a5db7 adding new function doAssignForIdxUpdate. - tablecmds.c: - declarations: - ATExecAddIndexConstraint: YB master 2ac2e98 adds a new parameter yb_wqueue to this function that upstream PG 8255c7a5eeba8f1a38b7a431c04909bde4f5e67d changes the indentation for. Trivial merge. - ATPrepSetTableSpace: YB master 06baaf0 introduces a new parameter to this function that upstream PG changes indentation for. Trivial merge. - ATRewriteTable: after YB master 24a5af0, ALTER TABLE VALIDATE CONSTRAINT is supported. Upstream PG commit f1fcf2d3b2e00b3d7ad3e0d2b1d26b77f5a48413 delays constraint validation for ALTER TABLE VALIDATE CONSTRAINT to phase 3 of alter table. So it shares the code paths for constraint validation with a regular ADD CONSTRAINT operation. YB has added logic to ATExecDropConstraint in case of constraint failure. This is only intended for ADD CONSTRAINT, but now that code paths are shared, this also affects VALIDATE CONSTRAINT incorrectly. The original logic also could use !YbDdlRollbackEnabled to avoid ATExecDropConstraint in case DDL atomicity is enabled. This is orthogonal to the issue, but it at least helps get the tests to pass for now since DDL atomicity is enabled by default. Do that improvement here, and add a todo to fix the condition properly. - execIndexing.c: - includes: YB master f0a5db7 includes catalog/pg_am_d.h. YB pg15 initial merge touches the same area. - YbExecDoInsertIndexTuple: (see ExecInsertIndexTuples) - ExecInsertIndexTuples: - for loop variable declarations: YB master f0a5db7 moves three variable declarations into new YbExecDoInsertIndexTuple and moves skip index logic into new YbExecUpdateIndexTuples. Upstream PG 9dc718bdf2b1a574481a45624d42b674332e2903 adds indexUnchanged variable declaration among the three variable declarations. Move that to the new location as well. - for loop after check for partial index: YB master f0a5db7 moves code into new YbExecDoInsertIndexTuple. YB pg15 initial merge and b263910 modify this moved code (add indexUnchanged computation and modify two satisfiesConstraint assignments). Apply the modifications to the new location. (This also involves forwarding local variable "update" and "tupleid" as opposed to "tuple". And also copying local variables "heapRelation" and "isYBRelation".) - YbExecDoDeleteIndexTuple: (see ExecDeleteIndexTuples) - ExecDeleteIndexTuples: YB master f0a5db7 moves code into new YbExecDoDeleteIndexTuple. YB pg15 initial merge touches this code (renaming index_delete to yb_index_delete). Apply the modification to the new location. (This also involves copying local variable "heapRelation".) - YbExecUpdateIndexTuples: YB master f0a5db7 adds this function: - signature: - Upstream PG 1375422c7826a2bf387be29895e961614f69de4b changes ResultRelInfo to be passed around directly rather than deriving it from EState. Add it as a parameter and remove the invalid code trying to derive it from estate. - Change "tuple" to "tupleid" similar to YbExecDoInsertIndexTuple. - MakeSingleTupleTableSlot: upstream PG adds additional param to this function. Pass &TTSOpsHeapTuple. - ybamcanupdatetupleinplace: upstream PG 346ed70b0ad7efc574711a97812692dab4542712 renames rd_amroutine to rd_indam. Change it for this new usage as well. - YbExecDoInsertIndexTuple: (see YbExecUpdateIndexTuples signature) - nodeModifyTable.c: - ExecUpdate: YB master f0a5db7 replaces ExecDeleteIndexTuplesOptimized + ExecInsertIndexTuplesOptimized with YbExecUpdateIndexTuples and passes yb_cols_marked_for_update to that call. YB pg15 initial merge moves this code to ExecUpdateEpilogue (also note the functions were renamed to not have "Optimized"), and YB pg15 6d46032 moves the yb_cols_marked_for_update code into YBExecUpdateAct. To resolve this, there are two main things: - Replace the delete + insert with update in the new location ExecUpdateEpilogue. - Pass around variables across the functions that need it, particularly yb_cols_marked_for_update but also yb_is_pk_updated. This also involves changing the lifetime of the variables. - YBExecUpdateAct: (see ExecUpdate) - ExecUpdateEpilogue: - signature: (see ExecUpdate) - YbExecUpdateIndexTuples: YB master f0a5db7 adds this function call. Adapt to signature changes mentioned above and change planSlot to context->planSlot and estate to context->estate. - ExecMergeMatched: this function is introduced by upstream PG and calls ExecUpdateEpilogue. The signature of ExecUpdateEpilogue is changed by YB master f0a5db7. Populate the new parameters with default/fake values and add a todo because MERGE is not supported yet. - nodeYbSeqscan.c: - YbSeqNext: YB master 7f59bd8 touches code where YB pg15 71dc8d0 changes scandesc->ybscan to ybScan. Trivial merge. - costsize.c: - yb_get_bitmap_index_quals: YB master a913524 makes changes that are not relevant to pg15. Discard the master changes. - gram.y: - "ALTER TABLE <name> SET TABLESPACE <tablespacename>": adjacent conflict between YB master 06baaf0 adding n->yb_cascade = false and upstream PG 30ed71e423ee63b263730b86326da2a629a29f84 changing style of adjacent line. - guc.c: - yb_plpgsql_disable_prefetch_in_for_query: adjacent lines conflict between YB pg15 91a265a touching GUC yb_plpgsql_disable_prefetch_in_for_query (QUERY_TUNING to QUERY_TUNING_METHOD) and YB master 063dbe5 adding GUC yb_make_next_ddl_statement_nonincrementing above that. - amapi.h: - struct IndexAmRoutine: adjacent lines conflict between YB master f0a5db7 adding ybamcanupdatetupleinplace and upstream PG 4d8a8d0c738410ec02aab46b1ebe1835365ad384 adding amusemaintenanceworkmem and amparallelvacuumoptions in the same location. - genam.h: - yb_index_update: adjacent lines conflict between YB master f0a5db7 adding this function and YB pg15 initial merge renaming index_delete to yb_index_delete. - executor.h: - YbExecUpdateIndexTuples: adjacent lines conflict between YB master f0a5db7 adding this function and various YB pg15 commits touching surrounding code, the most relevant being YB pg15 initial merge moving ExecDeleteIndexTuples declaration lower. Position the new YbExecUpdateIndexTuples below that. Furthermore, update the signature according as mentioned above in execIndexing.c. - ybcModifyTable.h: - YBCExecuteUpdateIndex: YB master f0a5db7 adds this function where YB pg15 473ebf8 incorrectly removes a line, causing merge conflict. Bring back the line. - relcache.h: - CheckUpdateExprOrPred: YB master f0a5db7 adds this function below CheckIndexForUpdate. YB pg15 moves CheckIndexForUpdate lower, and upstream PG e7eea52b2d61917fbbdac7f3f895e4ef636e935b adds new function RelationGetIdentityKeyBitmap in the original area. Add this function to the new location. (Note both Check* functions are YB functions despite not having YB prefix.) - yb_pg_foreign_data.out: - "ALTER TABLE fd_pt1 VALIDATE CONSTRAINT fd_pt1chk3": YB master 24a5af0 no longer expects this command to fail. YB pg15 1b1b3a0 makes minor changes in this area. Take master's version. This involves removing YB comment saying the output differs with upstream since it no longer differs. - a little below that: YB master 24a5af0 updates output for queries that are deleted by YB pg15 1b1b3a0 because WITH OIDS is no longer supported. Drop the master changes. - yb_pg_index_including.out: - "CREATE TABLE tbl_include_box": both YB master 2ac2e98 and YB pg15 9690419 uncomment some tests. These tests were ported, modified to change the box column to int, and commented out. Likely what happened is that, at the time, include index using box column was not supported. YB pg15's uncommenting reverts this back to using the box column, so it is superior. Take YB pg15's version, but keep YB master's expectation that ALTER TABLE succeeds. - yb_pg_select.out: - YB master a913524 makes changes that are not relevant to pg15. Discard the master changes. - yb_pg_index_including.sql: (see yb_pg_index_including.out) - pg_hint_plan.c: - YB master 5523770 modifies get_query_string which no longer exists. Disregard the master change. See the YB master commit message's pg15 note for more detail. - pg_hint_plan/yb_schedule: - YB master 5523770 adds new test yb_hint_table at the end. YB pg15 4c9db48 changes the other tests greatly. Do both. - indexam.c: - yb_index_update: YB master f0a5db7 adds this function containing usage of rd_amroutine. Upstream PG 346ed70b0ad7efc574711a97812692dab4542712 renames rd_amroutine to rd_indam. Change it for this new usage as well. - yb_alter_table.out: - YB master 24a5af0 adds tests. Update constraint violation error messages according to upstream PG 05f18c6b6b6e4b44302ee20a042cedc664532aa2. - yb_alter_table_rewrite.out: - YB master 2ac2e98 adds tests. Update various error messages according to upstream PG 8e599897ca20fe31cb58fad0b401d7e317235024 and 05f18c6b6b6e4b44302ee20a042cedc664532aa2. - yb_pg_alter_table.out: (same as yb_alter_table.out) - yb_pg_create_index.out: - YB master 2ac2e98 adds tests. YB pg15 5e40db0 makes this test run with yb_use_hash_splitting_by_default=false, so update \d output accordingly. - yb_pg_foreign_data.sql: - Remove the comment "\\ -- YB: output differs with the original test due to failed ALTER TABLE above" (see yb_pg_foreign_data.out explanation). - yb_pg_dbms_alert_session_A.out: - "advisory locks are not yet implemented": YB master 5951e18 changes the hint message for test queries added by YB pg15. Update the hint message. - yb_pg_dbms_alert_session_B.out: (same) - yb_pg_dbms_alert_session_C.out: (same) - yb_pg_dbms_pipe_session_A.out: (same) - yb_pg_dbms_pipe_session_B.out: (same) - pg15_tests/passing_tests.tsv: - XClusterOutboundReplicationGroupParameterized: rename XClusterOutboundReplicationGroupTest tests to parameterized XClusterOutboundReplicationGroupParameterized due to YB master f157e2e. Test Plan: pg15_tests are in bad shape: - some tests have been check failing: this will likely be fixed by future YB master 8d228a8. Tests include - org.yb.pgsql.TestAlterTableWithConcurrentTxn - org.yb.pgsql.TestPgRegressPgIndex - org.yb.pgsql.TestPgRegressTablespaces is removed from passing_tests.tsv by YB pg15 d528e86. - org.yb.pgsql.TestPgBatch fails altogether but not when tests are run individually. In the interest of time, don't deal with them for now. Jenkins: rebase: pg15 Reviewers: tfoucher Reviewed By: tfoucher Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D38252
- Loading branch information