Skip to content

Commit a32fb9f

Browse files
committed
Partition collapse now resumes properly.
Signed-off-by: Dorin Hogea <dhogea@bloomberg.net>
1 parent 8e9d474 commit a32fb9f

27 files changed

Lines changed: 1386 additions & 296 deletions

bdb/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6106,7 +6106,8 @@ static bdb_state_type *bdb_open_int(int envonly, const char name[], const char d
61066106
if (rc != 0) {
61076107
if (bdb_state->parent) {
61086108
free(bdb_state);
6109-
logmsg(LOGMSG_INFO, "%s failing with bdberr_misc at line %d\n", __func__, __LINE__);
6109+
logmsg(LOGMSG_INFO, "%s failing with bdberr_misc at line %d rc %d bdberr %d\n", __func__, __LINE__, rc,
6110+
*bdberr);
61106111
return NULL;
61116112
} else {
61126113
logmsg(LOGMSG_FATAL, "error opening parent\n");

csc2/dynschemaload.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ enum dyns_cnst {
3737
char *dyns_field_option_text(int option);
3838
void dyns_init_globals();
3939
void dyns_cleanup_globals();
40-
int dyns_load_schema_string(char *schematxt, char *dbname, char *tablename);
41-
int dyns_load_schema(char *filename, char *dbname, char *tblname);
40+
int dyns_load_schema_string(char *schematxt, char *dbname, const char *tablename);
41+
int dyns_load_schema(char *filename, char *dbname, const char *tblname);
4242
int dyns_form_key(int index, char *record, int recsz, char *key, int keysize);
4343
int dyns_is_idx_dup(int index);
4444
int dyns_is_idx_recnum(int index);

csc2/macc_so.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,8 +2626,7 @@ int macc_ferror(FILE *fh)
26262626
* in order to initialize the global structure on which this and other dyns_
26272627
* functions rely.
26282628
*/
2629-
static int dyns_load_schema_int(char *filename, char *schematxt, char *dbname,
2630-
char *tablename)
2629+
static int dyns_load_schema_int(char *filename, char *schematxt, char *dbname, const char *tablename)
26312630
{
26322631
int fhopen = 0;
26332632
extern FILE *yyin; /* lexer's input file */
@@ -2681,12 +2680,12 @@ static int dyns_load_schema_int(char *filename, char *schematxt, char *dbname,
26812680
return 0;
26822681
}
26832682

2684-
int dyns_load_schema_string(char *schematxt, char *dbname, char *tablename)
2683+
int dyns_load_schema_string(char *schematxt, char *dbname, const char *tablename)
26852684
{
26862685
return dyns_load_schema_int(NULL, schematxt, dbname, tablename);
26872686
}
26882687

2689-
int dyns_load_schema(char *filename, char *dbname, char *tablename)
2688+
int dyns_load_schema(char *filename, char *dbname, const char *tablename)
26902689
{
26912690
return dyns_load_schema_int(filename, NULL, dbname, tablename);
26922691
}

db/comdb2.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ struct osql_sess {
12911291

12921292
int verify_retries; /* how many times we verify retried this one */
12931293
blocksql_tran_t *tran;
1294-
LISTC_T(struct schema_change_type) scs; /* schema changes in session */
1294+
LISTC_T(struct schema_change_type) scs; /* schema changes in this transaction */
12951295
int is_tptlock; /* needs tpt locking */
12961296
int is_cancelled; /* 1 if session is cancelled */
12971297

@@ -1439,8 +1439,8 @@ struct ireq {
14391439
tran_type *sc_tran;
14401440
tran_type *sc_close_tran;
14411441
struct schema_change_type *sc_pending;
1442-
LISTC_T(struct schema_change_type) scs; /* all schema changes in this txn */
14431442
uuid_t scs_uuid; /* on resume, there is no sorese, but we need to know uuid for scs */
1443+
LISTC_T(struct schema_change_status) scs_status; /* status of schema changes in this transaction */
14441444
double cost;
14451445
uint64_t sc_seed;
14461446
uint32_t sc_host;
@@ -3647,6 +3647,7 @@ int cmp_index_int(struct schema *oldix, struct schema *newix, char *descr,
36473647
int get_dbtable_idx_by_name(const char *tablename);
36483648
int open_temp_db_resume(struct ireq *iq, struct dbtable *db, char *tablename, int resume);
36493649
int open_temp_newdb_resume(struct ireq *iq, struct dbtable *db, int resume);
3650+
void *open_temp_db_resume_early(struct dbtable *db, char *tablename);
36503651
int find_constraint(struct dbtable *db, constraint_t *ct);
36513652

36523653
/* END OF SCHEMACHANGE DECLARATIONS*/

db/glue.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ void init_fake_ireq(struct dbenv *dbenv, struct ireq *iq)
254254
iq->dbenv = dbenv;
255255
iq->is_fake = 1;
256256
iq->helper_thread = -1;
257+
listc_init(&iq->scs_status, offsetof(struct schema_change_status, lnk));
257258
}
258259

259260
void set_tran_verify_updateid(tran_type *tran)

db/macc_glue.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "dynschematypes.h"
2020
#include "dynschemaload.h"
2121

22-
static dbtable *newdb_from_schema(struct dbenv *env, char *tblname, int dbnum);
22+
static dbtable *newdb_from_schema(struct dbenv *env, const char *tblname, int dbnum);
2323
static int init_check_constraints(dbtable *tbl);
2424
static int add_cmacc_stmt(dbtable *db, int alt, int allow_ull,
2525
int no_side_effects, struct errstat *err);
@@ -28,10 +28,8 @@ extern int gbl_max_key_size_new;
2828

2929
char gbl_ver_temp_table[] = ".COMDB2.TEMP.VER.";
3030

31-
struct dbtable *create_new_dbtable(struct dbenv *dbenv, char *tablename,
32-
char *csc2, int dbnum, int sc_alt_tablename,
33-
int allow_ull, int no_side_effects,
34-
struct errstat *err)
31+
struct dbtable *create_new_dbtable(struct dbenv *dbenv, const char *tablename, char *csc2, int dbnum,
32+
int sc_alt_tablename, int allow_ull, int no_side_effects, struct errstat *err)
3533
{
3634
struct dbtable *newtable = NULL;
3735
int rc;
@@ -123,7 +121,7 @@ int populate_db_with_alt_schema(struct dbenv *dbenv, struct dbtable *db,
123121
return rc;
124122
}
125123

126-
static dbtable *newdb_from_schema(struct dbenv *env, char *tblname, int dbnum)
124+
static dbtable *newdb_from_schema(struct dbenv *env, const char *tblname, int dbnum)
127125
{
128126
dbtable *tbl;
129127
int ii;

db/macc_glue.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
#include "comdb2.h"
2121

2222
/* create a dbtable with the provided schema "csc2" */
23-
struct dbtable *create_new_dbtable(struct dbenv *dbenv, char *tablename,
24-
char *csc2, int dbnum, int sc_alt_tablename,
25-
int allow_ull, int no_sideeffects,
26-
struct errstat *err);
23+
struct dbtable *create_new_dbtable(struct dbenv *dbenv, const char *tablename, char *csc2, int dbnum,
24+
int sc_alt_tablename, int allow_ull, int no_sideeffects, struct errstat *err);
2725

2826
/* populate an existing db with .NEW tags for provided schema "csc2" */
2927
int populate_db_with_alt_schema(struct dbenv *dbenv, struct dbtable *db,

0 commit comments

Comments
 (0)