Skip to content

8.0: Fix sc segfault #5112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions db/osqlcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5977,14 +5977,16 @@ static int _process_partitioned_table_merge(struct ireq *iq)
sc->kind = SC_ADDTABLE;

rc = start_schema_change_tran(iq, NULL);
iq->sc->sc_next = iq->sc_pending;
iq->sc_pending = iq->sc;

if (rc != SC_COMMIT_PENDING) {
if (rc != SC_MASTER_DOWNGRADE)
iq->osql_flags |= OSQL_FLAGS_SCDONE;
return ERR_SC;
}

arg.indx = -1; /* see timepart_foreach_shardname NOTE */
iq->sc->sc_next = iq->sc_pending;
iq->sc_pending = iq->sc;
} else {
/*
* use the fast shard as the destination, after first altering it
Expand All @@ -5995,13 +5997,15 @@ static int _process_partitioned_table_merge(struct ireq *iq)
strncpy(sc->tablename, first_shard->tablename, sizeof(sc->tablename));

rc = start_schema_change_tran(iq, NULL);
iq->sc->sc_next = iq->sc_pending;
iq->sc_pending = iq->sc;
if (rc != SC_COMMIT_PENDING) {
if (rc != SC_MASTER_DOWNGRADE)
iq->osql_flags |= OSQL_FLAGS_SCDONE;
return ERR_SC;
}

iq->sc->sc_next = iq->sc_pending;
iq->sc_pending = iq->sc;

arg.check_extra_shard = 1;
strncpy(sc->newtable, sc->tablename, sizeof(sc->newtable)); /* piggyback a rename with alter */
arg.indx = 0; /* see timepart_foreach_shardname NOTE */
Expand Down
21 changes: 17 additions & 4 deletions tests/timepart_trunc.test/runit
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,26 @@ $cmd "select * from t14 order by 1" >> $OUT

timepart_stats 0

echo $cmd "ALTER TABLE t14 PARTITIONED BY NONE"
$cmd "ALTER TABLE t14 PARTITIONED BY NONE"
if (( $? != 0 )) ; then
echo "FAILURE to remote partitioning for t14"
$cmdm "exec procedure sys.cmd.send('convert_record_sleep 1')"

echo $cmd "ALTER TABLE t14 PARTITIONED BY NONE &"
$cmd "ALTER TABLE t14 PARTITIONED BY NONE" &
waitpid=$!

sleep 1

if $cmd "ALTER TABLE t14 PARTITIONED BY NONE"; then
echo "FAILURE to block concurrent schema change"
exit 1
fi

if ! wait $waitpid; then
echo "FAILURE to remove partitioning for t14"
exit 1
fi

$cmdm "exec procedure sys.cmd.send('convert_record_sleep 0')"

echo $cmd "select * from t14 order by 1"
echo $cmd "select * from t14 order by 1" >> $OUT
$cmd "select * from t14 order by 1" >> $OUT
Expand Down