Skip to content

[#26918] YSQL: Stop index backfill when the CREATE INDEX session is terminated#31378

Merged
jasonyb merged 2 commits into
yugabyte:masterfrom
Shopify:query_cancellation_for_index_backfills
May 27, 2026
Merged

[#26918] YSQL: Stop index backfill when the CREATE INDEX session is terminated#31378
jasonyb merged 2 commits into
yugabyte:masterfrom
Shopify:query_cancellation_for_index_backfills

Conversation

@egladysh

@egladysh egladysh commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

DO NOT MERGE!! CSI ❌. Once CSI passes, comment trigger jenkins to clear this warning.

Summary

Add DdlRequesterLivenessTask, a master-side task that polls the transaction
status of the DDL transaction held open by the CREATE INDEX CONCURRENTLY
backend. If the transaction is aborted (e.g. because the backend was killed
via pg_terminate_backend), the task calls BackfillTable::Abort() to stop
the in-progress backfill.

Test plan

  • PgIndexBackfillCancellationTest.BackfillStopsAfterBackendKill — asserts
    that no new backfill RPCs are issued after the backend is killed.
  • PgIndexBackfillCancellationWithoutFixTest.BackfillContinuesAfterBackendKill
    — asserts the old behavior (backfill continues) when the liveness monitor is
    disabled, serving as a regression baseline.
  • PgIndexBackfillCancellationEarlyKillTest.BackfillStopsAfterEarlyBackendKill
    — same as above but the backend is killed before backfill starts.

Upgrade / Rollback Safety

Upgrade safety: Safe.
Rollback safety: Safe.

No special procedures are required.

CSI
Jira: DB-16358

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to cancel background index backfill operations when the initiating PostgreSQL backend is terminated. It implements a DdlRequesterLivenessTask to monitor the transaction status and abort the backfill if the transaction is aborted. The changes span the client, master, and tserver layers to propagate transaction metadata and include extensive regression tests. Feedback was provided to increase the logging severity from a warning to an error when a backfill abort operation fails.

Comment thread src/yb/master/ysql_ddl_verification_task.cc Outdated
@egladysh egladysh force-pushed the query_cancellation_for_index_backfills branch from 82438bc to 288225c Compare April 30, 2026 22:37
@jasonyb

jasonyb commented May 1, 2026

Copy link
Copy Markdown
Contributor

trigger jenkins

@hari90

hari90 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Phorge diff synced: D52659
Commit: 288225c0

Jenkins build has been triggered. Results will be posted here once it completes.


JenkinsBot

@jasonyb jasonyb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not get a chance to look at the whole thing but have provided a lot of comments to keep you busy.

Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/master/ysql_ddl_verification_task.h Outdated
Comment thread src/yb/client/client_master_rpc.cc
Comment thread src/yb/master/ysql_backends_manager.cc
Comment thread src/yb/master/ysql_ddl_verification_task.cc Outdated
Comment thread src/yb/master/catalog_entity_info.h
@hari90

hari90 commented May 2, 2026

Copy link
Copy Markdown
Contributor

Jenkins build for commit 288225c0: Fail

Exceptions:


🔨 DB Build/Test Job Summary

Build Total Passed Failed Failed After Retries
D52659-arm-alma8-clang21-release 9849 9470 12 6
D52659-alma8-clang21-release 9852 9470 12 8
D52659-ubuntu22.04-clang21-debug 2 2 0 0
D52659-arm-mac14-clang21-release 17 17 0 0
D52659-mac14-clang21-release 2 2 0 0
D52659-alma8-clang21-tsan 9665 8029 18 12
D52659-alma8-gcc12-fastdebug 9867 9426 18 8
D52659-alma9-clang21-asan 9759 9042 8 5

Full status


JenkinsBot

@netlify

netlify Bot commented May 4, 2026

Copy link
Copy Markdown

Deploy Preview for infallible-bardeen-164bc9 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f564a98
🔍 Latest deploy log https://app.netlify.com/projects/infallible-bardeen-164bc9/deploys/6a10b17bcb1d1c0008cdc793
😎 Deploy Preview https://deploy-preview-31378--infallible-bardeen-164bc9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@egladysh egladysh force-pushed the query_cancellation_for_index_backfills branch 2 times, most recently from a5a7305 to ebaafb3 Compare May 4, 2026 17:40
@egladysh egladysh requested a review from jasonyb May 4, 2026 17:44
@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

Had another busy day. This is still on my radar.

@egladysh

egladysh commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

merged the latest changes to PollTransactionStatusBase

@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

This old test run #31378 (comment) had 100% failing tests PgIndexBackfillCancellationEarlyKillTest - BackfillStopsAfterEarlyBackendKill/* and PgIndexBackfillCancellationTest - BackfillStopsAfterBackendKill/* on release and fastdebug builds.

@egladysh

egladysh commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

That's not good. Did they fail on all platforms including arm mac14 clang21 (that the setup I have been testing it with)? I don't seem to have access to the test logs. Also is it possible to trigger the tests again?

@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

BackfillStopsAfterEarlyBackendKill/0:

../../src/yb/yql/pgwrapper/pg_index_backfill-test.cc:3726: Failure
Expected: (rpcs_final) <= (2), actual: 4 vs 2
Expected ≤ 2 BackfillIndex RPCs (liveness task should abort after ≤ 2 chunks), got 4. Suggests requester_transaction was not forwarded from the placeholder BackfillTable to the real BackfillTable.

BackfillStopsAfterEarlyBackendKill/1:

../../src/yb/yql/pgwrapper/pg_index_backfill-test.cc:3726: Failure
Expected: (rpcs_final) <= (2), actual: 4 vs 2
Expected ≤ 2 BackfillIndex RPCs (liveness task should abort after ≤ 2 chunks), got 4. Suggests requester_transaction was not forwarded from the placeholder BackfillTable to the real BackfillTable.

BackfillStopsAfterBackendKill/0:

../../src/yb/yql/pgwrapper/pg_index_backfill-test.cc:3542: Failure
Expected equality of these values:
  rpcs_after_wait
    Which is: 4
  rpcs_after_kill
    Which is: 2
BackfillIndex RPCs continued after pg_terminate_backend: 2 unexpected additional RPC(s) issued

BackfillStopsAfterBackendKill/1:

../../src/yb/yql/pgwrapper/pg_index_backfill-test.cc:3542: Failure
Expected equality of these values:
  rpcs_after_wait
    Which is: 4
  rpcs_after_kill
    Which is: 2
BackfillIndex RPCs continued after pg_terminate_backend: 2 unexpected additional RPC(s) issued

Also note I see [ts-1] TRAP: FailedAssertion("!IsTransactionOrTransactionBlock()", File: "../../../../../../../src/postgres/src/backend/utils/activity/pgstat.c", Line: 586, PID: 490741) in all four of these fastdebug logs.

@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

These are alma8-clang21-release and alma8-gcc12-fastdebug. All four full logs (fastdebug) are present here: https://gist.github.com/jasonyb/1b2eb85d6240aae92586bbb85e207173

@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

That's not good. Did they fail on all platforms including arm mac14 clang21 (that the setup I have been testing it with)? I don't seem to have access to the test logs. Also is it possible to trigger the tests again?

This test is not run on mac, but I think it was run on arm-alma8-clang21-release and passed there. So 2 of 3 build types failed consistently.

Trigger jenkins

@hari90

hari90 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Jenkins build has been triggered. Results will be posted once it completes. CSI


JenkinsBot

@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

@egladysh For https://github.com/yugabyte/yugabyte-db/pull/31378/changes#r3175721299, I notice you have split commits locally. Our current policy is to always squash-merge PRs, so splitting commits locally doesn't really do anything. Two options:

  • safe: create two PRs off master for each of 4b38b00 and f2675a3. Wait for those to land on master. After they land on master, create the final PR that does the main feature you want.
  • risky: I am not completely sure how stacking multiple PRs together works, but it may be possible to build the three PRs all depending on each other. It is not clear to me whether triggering builds off of these would work (the infra team has expressed verbally that it should, but I do not believe it has been tested yet).

Given the two dependency pieces are low-review-contention, I believe the safe option is better. All we would have to do is wait for test results to pass and for the PR title/description to be good. Make sure to explain what (potential) problems are fixed by each of these pieces.

@egladysh

egladysh commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

The comments were: "It's logically independent of the liveness monitoring feature. Consider splitting into
its own commit so it can be cherry-picked independently and won't be lost if this
commit is reverted." But yeah, squash-merge makes a difference. I'll split them up.

As for the failing tests. I looked at the logs and it seems like it fails because of the asserts in fastdebug that you mentioned when the tests does pg_terminate_backend and that leads to

[ts-1] W0502 01:33:34.751808 207507 pg_txn_manager.cc:689] Failed to abort DDL transaction: Aborted (yb/rpc/reactor.cc:122): Shutdown connection (system error 108)
2797 [ts-1] 2026-05-02 01:33:34.753 UTC [207507] FATAL:  Failed to abort DDL transaction: Shutdown connection

The abort fails, DdlRequesterLivenessTask doesn't know about it, backfill continues, the test fails. It could be another independent bug. I'll investigate it.

@egladysh

egladysh commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

It seems to be a more serious issue with timing in YBCAbortTransaction when DDL transactions are not aborted cleanly and it's independent from this PR.

@egladysh

egladysh commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

@jasonyb I picked the safe option for the independent fixes. Could you take a look when you have a chance?

#31436
#31437

@hari90

hari90 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Jenkins build for commit f5f5f28d: Fail
CSI
Reason: CSI status: WARNING

Exceptions:

Checking test failure count per build versus limit of 20 (0 on mac).

Build Failures Status
PR31378-mac14-clang21-release #1 1 FAILURE
PR31378-alma8-clang21-release #1 1 Okay
PR31378-ubuntu22.04-clang21-debug #1 1 Okay
PR31378-alma8-clang21-tsan #1 1 Okay
PR31378-arm-mac14-clang21-release #1 1 FAILURE
PR31378-arm-alma8-clang21-release #1 1 Okay
PR31378-alma8-gcc12-fastdebug #1 1 Okay
PR31378-alma9-clang21-asan #1 1 Okay

🔨 DB Build/Test Job Summary

Build Total Passed Failed Failed After Retries
PR31378-mac14-clang21-release 1 0 1 1
PR31378-alma8-clang21-release 1 0 1 1
PR31378-ubuntu22.04-clang21-debug 1 0 1 1
PR31378-alma8-clang21-tsan 1 0 1 1
PR31378-arm-mac14-clang21-release 1 0 1 1
PR31378-arm-alma8-clang21-release 1 0 1 1
PR31378-alma8-gcc12-fastdebug 1 0 1 1
PR31378-alma9-clang21-asan 1 0 1 1

JenkinsBot

@jasonyb

jasonyb commented May 5, 2026

Copy link
Copy Markdown
Contributor

#31378 (comment):

[2026-05-05T21:41:23.518Z] Rebasing (1/6)
[2026-05-05T21:41:23.518Z] Rebasing (2/6)
[2026-05-05T21:41:23.518Z] Rebasing (3/6)
[2026-05-05T21:41:23.518Z] Auto-merging src/yb/master/catalog_entity_info.h
[2026-05-05T21:41:23.518Z] Auto-merging src/yb/master/catalog_manager.cc
[2026-05-05T21:41:23.518Z] Auto-merging src/yb/master/ysql_ddl_verification_task.cc
[2026-05-05T21:41:23.518Z] CONFLICT (content): Merge conflict in src/yb/master/ysql_ddl_verification_task.cc
[2026-05-05T21:41:23.518Z] Auto-merging src/yb/master/ysql_ddl_verification_task.h
[2026-05-05T21:41:23.518Z] error: could not apply 028994f138... Stop index backfill when backend is terminated
[2026-05-05T21:41:23.518Z] hint: Resolve all conflicts manually, mark them as resolved with
[2026-05-05T21:41:23.518Z] hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
[2026-05-05T21:41:23.518Z] hint: You can instead skip this commit: run "git rebase --skip".
[2026-05-05T21:41:23.518Z] hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
[2026-05-05T21:41:23.518Z] Could not apply 028994f138... Stop index backfill when backend is terminated

It failed because of a clear infra-side issue: the build takes each of your commits and rebases them onto newest master. If you resolve merge conflicts in a later commit (such as f5f5f28), it will not help when rebasing an earlier commit that is the source of conflict (such as 028994f). The correct infra approach would be to either

  • squash the PR's commits into a single commit then rebase that onto latest master
  • merge the PR's branch to latest master

Both cases avoid the issue of merge conflicts on intermediate commits of the PR's branch.

Workaround while this infra issue is in place: squash your changes to a single local commit and force push that for the PR.

cc: @hari90

@jasonyb

jasonyb commented May 6, 2026

Copy link
Copy Markdown
Contributor

It seems to be a more serious issue with timing in YBCAbortTransaction when DDL transactions are not aborted cleanly and it's independent from this PR.

I dug into the root cause of these test failures. Here's what's happening:

The claim that this is independent from this PR is partially correct — the root cause is pre-existing, but this PR's tests are uniquely sensitive to it.

Root Cause

When pg_terminate_backend sends SIGTERM, the die() signal handler calls YBCInterruptPgGate(), which signals the interrupter thread to shut down the RPC messenger (messenger_.Shutdown() in pggate.cc:592). This happens asynchronously, but the code path to the abort RPC is long enough that the messenger is effectively always shut down by the time it fires.

The shutdown sequence involves two FATALs:

  1. FATAL-1: ProcessInterrupts() raises ereport(FATAL, "terminating connection"). Unlike ERROR (which longjmps to the error handler), FATAL calls proc_exit(1) directly. During proc_exit, the ShutdownPostgres callback calls AbortOutOfAnyTransaction()AbortTransaction()YBCAbortTransaction()YBCPgClearSeparateDdlTxnMode()FinishTransaction(Abort). The abort RPC fails because the messenger is shut down.

  2. FATAL-2: The RPC failure triggers elog(FATAL, "Failed to abort DDL transaction: Shutdown connection") at pg_yb_utils.c:1552.

The DDL transaction is left in PENDING state on the coordinator. It stays PENDING until the heartbeat timeout expires: transaction_heartbeat_usec × transaction_max_missed_heartbeat_periods = 0.5s × 30 = 15 seconds in release builds, 45 seconds in TSAN.

Why this PR's tests fail

DdlRequesterLivenessTask polls transaction status and calls callbacks_.abort_() only when it sees ABORTED. Since the abort RPC never succeeded, the transaction stays PENDING for 15-45s, and the liveness task keeps reporting "still pending" during that window. The tests' wait period is shorter than this, so they see continued backfill RPCs and fail.

Why existing DDL verification tasks are unaffected

TableSchemaVerificationTask and NamespaceVerificationTask ignore the aborted parameter entirely (bool /*aborted*/) — they compare against the PG schema to determine the actual outcome. They just poll longer. No correctness issue.

Fix for this PR

Neither FATAL-1 nor FATAL-2 causes these test failures. The backend is going to exit regardless. The tests fail because the abort RPC itself fails (messenger already shut down), leaving the transaction PENDING regardless of log severity.

A fix is to reduce transaction_max_missed_heartbeat_periods in the test fixture to shorten the coordinator's expiration window. A value of 10 gives ~5s in release (10 × 0.5s) and ~15s in TSAN (10 × 1.5s) — fast enough for tests, with enough margin to avoid flakiness from normal heartbeat jitter. The test wait time and flags should then be adjusted to exceed this timeout.

This is purely a test-side configuration; the production code in DdlRequesterLivenessTask does not need changes — waiting longer for the coordinator to expire the transaction is acceptable in production.

Separate issue (independent, does not affect test pass/fail): the pre-existing FATAL-2 during SIGTERM

I filed #31439 for the pre-existing bug where YBCAbortTransaction produces FATAL-2 (and on debug/fastdebug builds, a TRAP assertion at pgstat.c:586) when the backend is killed via pg_terminate_backend. FATAL-1 ("terminating connection") is the expected behavior of pg_terminate_backend and is not a bug. The fix for FATAL-2 is to detect the shutdown path (proc_exit_inprogress) and downgrade FATAL-2 to WARNING. The abort RPC is still attempted (so it can succeed in the rare case the messenger hasn't shut down yet), but a failure no longer triggers a nested FATAL. This is independent from this PR and does not affect whether these tests pass or fail.

@jasonyb jasonyb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spent a lot of time on forming/understanding issue #31439, so again did not get to review the whole thing.

Comment thread src/yb/master/backfill_index.cc Outdated
Comment thread src/yb/master/ysql_ddl_verification_task.cc Outdated
@egladysh

egladysh commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

@jasonyb Yeah, it looks correct: #31439. I can open a separate PR for this issue b/c this one depends on it?

@jasonyb

jasonyb commented May 13, 2026

Copy link
Copy Markdown
Contributor

Did not get a chance to look today.

Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
@jasonyb jasonyb changed the title [#31263] YSQL: Stop index backfill when the CREATE INDEX session is terminated [#26918] YSQL: Stop index backfill when the CREATE INDEX session is terminated May 13, 2026
@jasonyb

jasonyb commented May 15, 2026

Copy link
Copy Markdown
Contributor

Given https://yugabyte.atlassian.net/browse/DEVOPS-3749 "PR support - diff builds doing rebase to release branch should do it via merge rather than rebase" is still pending, as a workaround, please update with a squashed commit so that we can trigger build/test on that.

@egladysh

Copy link
Copy Markdown
Collaborator Author

@jasonyb before we can run the tests, I am still waiting for a response from @iSignal . The issue that he raised has to be fixed but we'd need converge on a solution. After everything is done I'll squash the thing.

Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc Outdated
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc
@egladysh egladysh force-pushed the query_cancellation_for_index_backfills branch 2 times, most recently from f90b0e8 to 102a41a Compare May 19, 2026 15:59
@egladysh egladysh requested a review from iSignal May 19, 2026 22:22

@jasonyb jasonyb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For parts I reviewed, seems good. We need to run tests, but will wait till the commits are squashed and updated to latest master

Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc
Comment thread src/yb/yql/pgwrapper/pg_index_backfill-test.cc
As per review, added DCHECK, fixed comments, modifed transaction_rpc_timeout_ms

Deduplicate the test code, replace deprecated FetchFormat with FetchRow, sort kDdlRequesterLiveness

lint fixes

as per comments fixed comment formatting

Fixed comments

Removed defaulted nullopt and changed to VERIFY_RESULT

Style formatting

Update src/yb/master/backfill_index.cc

Co-authored-by: jasonyb <93959687+jasonyb@users.noreply.github.com>

Update src/yb/master/backfill_index.cc

Co-authored-by: jasonyb <93959687+jasonyb@users.noreply.github.com>

Lint fixes

as per discussion, revert the changes around VERIFY_RESULT

Address review comments: log bad status, fix non-ASCII chars, use conn_

Added liveness flags to Abort(), pass req.use_regular_transaction_block(), test fixes and impovements

changed liveness_task_ to weak_ptr

sanity check of time settings, check CREATE INDEX status, check rpcs_before < kExpectedTotalBackfillRpcs, removed early-kill tests

added some comments

enable the tests in release only

reverted the last commit

Added backfill_aborted metric, restructured the tests

Update src/yb/yql/pgwrapper/pg_index_backfill-test.cc

Co-authored-by: jasonyb <93959687+jasonyb@users.noreply.github.com>

Update src/yb/yql/pgwrapper/pg_index_backfill-test.cc

Co-authored-by: jasonyb <93959687+jasonyb@users.noreply.github.com>

Update src/yb/yql/pgwrapper/pg_index_backfill-test.cc

Co-authored-by: jasonyb <93959687+jasonyb@users.noreply.github.com>

fixed comments

fixed merge conflict and CAS on done_
@egladysh egladysh force-pushed the query_cancellation_for_index_backfills branch from 9f886a1 to e6a0215 Compare May 20, 2026 03:55
@egladysh

Copy link
Copy Markdown
Collaborator Author

@jasonyb squashed it

@iSignal

iSignal commented May 20, 2026

Copy link
Copy Markdown
Contributor

trigger jenkins

@hari90

hari90 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Jenkins build has been triggered. Results will be posted once it completes. CSI


JenkinsBot

@egladysh

Copy link
Copy Markdown
Collaborator Author

@jasonyb, @iSignal I don't have access to yb-csi/multi-build-failures. I'd appreciate any help guys with the build and Jenkins.

@iSignal

iSignal commented May 22, 2026

Copy link
Copy Markdown
Contributor

@jasonyb, @iSignal I don't have access to yb-csi/multi-build-failures. I'd appreciate any help guys with the build and Jenkins.

This is what it shows, can you try running that test locally? if it does not repro, I can help investigate.

PgIndexBackfillCancellationTest - BackfillStopsAfterBackendKill/1
PR31378-alma9-clang21-asan #2 / C++ - CSI-Web Details
PR31378-alma8-gcc15-fastdebug #1 / C++ - CSI-Web Details
PR31378-alma8-clang21-release #2 / C++ - CSI-Web Details
PR31378-alma8-clang21-tsan #2 / C++ - CSI-Web Details

These two tests are a bit flaky even earlier but might be worth checking by running a few times if there is some new failure here we are introducing

PgIndexBackfillClientDeadline - DropAfterFail/1

org.yb.pgsql.TestPgRegressIndex - schedule

@iSignal

iSignal commented May 22, 2026

Copy link
Copy Markdown
Contributor

@hari90 : Do we plan to automatically post here on the actual multi build failures? The new github integration looks pretty cool, btw.

@egladysh

Copy link
Copy Markdown
Collaborator Author

The tests are flaky due to independent race issue, #31866. On my osx/clang21 the race is resolved in favor of the test but not in CI.

cc: @jasonyb @iSignal

…_expiration_ms into account during txn cancellation
@egladysh

Copy link
Copy Markdown
Collaborator Author

I adjusted some timeouts in the tests. Do you mind running them again?

@jasonyb

jasonyb commented May 26, 2026

Copy link
Copy Markdown
Contributor

trigger jenkins

@yb-agentk-dev

yb-agentk-dev Bot commented May 26, 2026

Copy link
Copy Markdown

Jenkins build has been triggered. Results will be available in the CI checks. CSI

@iSignal

iSignal commented May 27, 2026

Copy link
Copy Markdown
Contributor

Looks good to me, thanks for addressing the code comments like changing to state_ enum, weak_ptr etc. @jaki

@jasonyb jasonyb merged commit b51a5c9 into yugabyte:master May 27, 2026
22 checks passed
jasonyb pushed a commit that referenced this pull request Jun 4, 2026
…NDEX session is terminated (#31378) (#32003)

## Summary

Add DdlRequesterLivenessTask, a master-side task that polls the
transaction
status of the DDL transaction held open by the CREATE INDEX CONCURRENTLY
backend. If the transaction is aborted (e.g. because the backend was
killed
via pg_terminate_backend), the task calls BackfillTable::Abort() to stop
the in-progress backfill.

Original commit: b51a5c9 / #31378

## Test plan

- PgIndexBackfillCancellationTest.BackfillStopsAfterBackendKill --
asserts
  that no new backfill RPCs are issued after the backend is killed.
-

PgIndexBackfillCancellationWithoutFixTest.BackfillContinuesAfterBackendKill
-- asserts the old behavior (backfill continues) when the liveness
monitor is
  disabled, serving as a regression baseline.
-

PgIndexBackfillCancellationEarlyKillTest.BackfillStopsAfterEarlyBackendKill
  -- same as above but the backend is killed before backfill starts.

## Upgrade / Rollback Safety
Upgrade safety: Safe.
Rollback safety: Safe.

No special procedures are required.

[CSI](<https://csiweb.dev.yugabyte.com/pull/31378/>)
Jira: [DB-16358](https://yugabyte.atlassian.net/browse/DB-16358)

[DB-16358]:

https://yugabyte.atlassian.net/browse/DB-16358?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

[DB-16358]:
https://yugabyte.atlassian.net/browse/DB-16358?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants