cockroachdb / cockroachdb/cockroach

bulk: synchronous statements surface the lease-relocation marker to the client

Open
#173,620 3 comments 0 reactions 0 assignees View on GitHub
A-disaster-recovery C-enhancement O-agent T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Summary:**
When a synchronous bulk statement with an execution-locality filter is issued
from a gateway that doesn't match the filter, the coordinator relocates and the
job's `Resume` returns the lease-relocation marker (`jobs.IsLeaseRelocationError`).
On the synchronous path this marker is returned to the client as an error even
though the job continues and completes on the destination node — the statement
appears to fail while actually succeeding.

**Background:**
IMPORT now waits through this: on the marker it calls `JobRegistry.WaitForJobs`
and reports results from the job's persisted progress. BACKUP/RESTORE still return
the marker to the client (`backup_planning.go`, `restore_planning.go` — same
`AwaitCompletion` -> return err pattern).

**Proposed work:**
- [ ] Apply the same wait-through to synchronous BACKUP/RESTORE.
- [ ] Persist IMPORT's INSPECT job ID so the relocation path can report a
non-NULL `inspect_job_id` (currently NULL there, since the INSPECT job runs
on the destination and its ID isn't persisted on the import job).

Epic CRDB-65504

Jira issue: CRDB-66931

Contributor guide

Open the contributing guide

Research direction

Read backup_planning.go and restore_planning.go around the synchronous AwaitCompletion-to-return-err path, then compare it with IMPORT's JobRegistry.WaitForJobs handling. Done means synchronous BACKUP/RESTORE wait through lease relocation instead of surfacing the marker, and the relocation path persists IMPORT's INSPECT job ID rather than reporting NULL.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.