Skip to content

Commit 86b914f

Browse files
committed
Fix genid bug
Signed-off-by: mdouglas47 <[email protected]>
1 parent 292d4f8 commit 86b914f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

schemachange/sc_alter_table.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ int do_alter_table(struct ireq *iq, struct schema_change_type *s,
591591

592592
/* set sc_genids, 0 them if we are starting a new schema change, or
593593
* restore them to their previous values if we are resuming */
594-
if (init_sc_genids(db, s)) {
594+
if (init_sc_genids(db, newdb, s)) {
595595
sc_errf(s, "failed initilizing sc_genids\n");
596596
delete_temp_table(iq, newdb);
597597
change_schemas_recover(s->tablename);
@@ -655,7 +655,7 @@ int do_alter_table(struct ireq *iq, struct schema_change_type *s,
655655
if (!s->live)
656656
gbl_readonly_sc = 1;
657657

658-
rc = convert_all_records(db, newdb, newdb->sc_genids, s);
658+
rc = convert_all_records(db, newdb, db->sc_genids, s);
659659
if (rc == 1) rc = 0;
660660
} else
661661
rc = 0;
@@ -1260,7 +1260,7 @@ int do_upgrade_table_int(struct schema_change_type *s)
12601260
sc_printf(s, "Starting FULL table upgrade.\n");
12611261
}
12621262

1263-
if (init_sc_genids(db, s)) {
1263+
if (init_sc_genids(db, db, s)) {
12641264
sc_errf(s, "failed initilizing sc_genids\n");
12651265
return SC_LLMETA_ERR;
12661266
}

schemachange/sc_records.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static inline void lkcounter_check(struct convert_record_data *data, int now)
192192
* stripe.
193193
* If the schema change is not resuming it sets them all to zero
194194
* If success it returns 0, if failure it returns <0 */
195-
int init_sc_genids(struct dbtable *db, struct schema_change_type *s)
195+
int init_sc_genids(struct dbtable *db, struct dbtable *newdb, struct schema_change_type *s)
196196
{
197197
void *rec;
198198
int orglen, bdberr, stripe;
@@ -238,8 +238,8 @@ int init_sc_genids(struct dbtable *db, struct schema_change_type *s)
238238
/* get this stripe's newest genid and store it in sc_genids,
239239
* if we have been rebuilding the data files we can grab the genids
240240
* straight from there, otherwise we look in the llmeta table */
241-
if (is_dta_being_rebuilt(db->plan)) {
242-
rc = bdb_find_newest_genid(db->handle, NULL, stripe, rec, &dtalen,
241+
if (is_dta_being_rebuilt(newdb->plan)) {
242+
rc = bdb_find_newest_genid(newdb->handle, NULL, stripe, rec, &dtalen,
243243
dtalen, &sc_genids[stripe], &ver,
244244
&bdberr);
245245
if (rc == 1)

schemachange/sc_records.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int upgrade_all_records(struct dbtable *db, unsigned long long *sc_genids,
9696

9797
void convert_record_data_cleanup(struct convert_record_data *data);
9898

99-
int init_sc_genids(struct dbtable *db, struct schema_change_type *s);
99+
int init_sc_genids(struct dbtable *db, struct dbtable *newdb, struct schema_change_type *s);
100100

101101
void live_sc_enter_exclusive_all(bdb_state_type *, tran_type *);
102102

0 commit comments

Comments
 (0)