Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
123458: roachprod: fix `start.sh` profile check r=herkolategan a=herkolategan

Previously, multiple entries would be created in "${HOME}/.profile" since the check for "${HOME}/.profile-cockroach" would always fail. This updates the check to look for the correct file based on the virtual cluster label.

Fixes: #121267

Epic: None
Release Note: None

123630: streamingest: prevent starting duplicate replication r=dt a=dt

If a tenant is in data set add or drop, another job is already actively writing (or removing) its content, such as another replication job or a restore. In such cases we should not allow another replication job to be started writing to the same tenant.

Release note: none.
Epic: none.

Co-authored-by: Herko Lategan <herko@cockroachlabs.com>
Co-authored-by: David Taylor <tinystatemachine@gmail.com>
  • Loading branch information
3 people committed May 7, 2024
3 parents eaae192 + 3d58c70 + 621b0f6 commit 53ba87e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pkg/ccl/streamingccl/streamingest/alter_replication_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ func alterTenantRestartReplication(
)
}

if tenInfo.DataState != mtinfopb.DataStateReady {
return errors.Newf("cannot start replication for tenant %q (%s) in state %s (is replication or a restore already running?)",
tenInfo.Name,
dstTenantID,
tenInfo.DataState,
)
}

if alterTenantStmt.Options.ExpirationWindowSet() {
return CannotSetExpirationWindowErr
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func TestAlterTenantCompleteToLatest(t *testing.T) {
c.DestSysSQL.Exec(c.T, `ALTER TENANT $1 START REPLICATION OF $2 ON $3`,
args.DestTenantName, args.SrcTenantName, c.SrcURL.String())

c.DestSysSQL.ExpectErr(c.T, `is replication or a restore already running`,
`ALTER TENANT $1 START REPLICATION OF $2 ON $3`,
args.DestTenantName, args.SrcTenantName, c.SrcURL.String())

// Wait for the resumed replication to advance.
_, ingestionJobID = replicationtestutils.GetStreamJobIds(t, ctx, c.DestSysSQL, args.DestTenantName)
targetReplicatedTime = c.SrcCluster.Server(0).Clock().Now()
Expand Down
2 changes: 1 addition & 1 deletion pkg/roachprod/install/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sudo systemctl reset-failed "${VIRTUAL_CLUSTER_LABEL}" 2>/dev/null || true

# The first time we run, install a small script that shows some helpful
# information when we ssh in.
if [ ! -e "${HOME}/.profile-cockroach" ]; then
if [ ! -e "${HOME}/.profile-${VIRTUAL_CLUSTER_LABEL}" ]; then
cat > "${HOME}/.profile-${VIRTUAL_CLUSTER_LABEL}" <<EOQ
echo ""
if systemctl is-active -q ${VIRTUAL_CLUSTER_LABEL}; then
Expand Down

0 comments on commit 53ba87e

Please sign in to comment.