Commit c5508dd4 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2361], no longer assume that 3.0.x tables may be used with 3.1.0

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@17715 c7de825b-a66e-492c-adef-691d508d4ae1
parent dea05395
...@@ -3241,7 +3241,7 @@ int ha_tokudb::write_row(uchar * record) { ...@@ -3241,7 +3241,7 @@ int ha_tokudb::write_row(uchar * record) {
if (error) { goto cleanup; } if (error) { goto cleanup; }
} }
if (curr_num_DBs == 1 || share->version <= 2) { if (curr_num_DBs == 1) {
error = insert_rows_to_dictionaries(record,&prim_key, &row, txn); error = insert_rows_to_dictionaries(record,&prim_key, &row, txn);
if (error) { goto cleanup; } if (error) { goto cleanup; }
} }
...@@ -3320,7 +3320,6 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -3320,7 +3320,6 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
DBT key_dbts[MAX_KEY + 1]; DBT key_dbts[MAX_KEY + 1];
DBT rec_dbts[MAX_KEY + 1]; DBT rec_dbts[MAX_KEY + 1];
u_int32_t curr_db_index; u_int32_t curr_db_index;
bool use_put_multiple = share->version > 2;
ulonglong wait_lock_time = get_write_lock_wait_time(thd); ulonglong wait_lock_time = get_write_lock_wait_time(thd);
LINT_INIT(error); LINT_INIT(error);
...@@ -3365,7 +3364,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -3365,7 +3364,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
if (error) { if (error) {
goto cleanup; goto cleanup;
} }
} }
txn = using_ignore ? sub_trans : transaction; txn = using_ignore ? sub_trans : transaction;
...@@ -3397,20 +3396,11 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -3397,20 +3396,11 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
if (error) { goto cleanup; } if (error) { goto cleanup; }
if (use_put_multiple) { dbs[0] = share->key_file[primary_key];
dbs[0] = share->key_file[primary_key]; key_dbts[0] = prim_key;
key_dbts[0] = prim_key; rec_dbts[0] = prim_row;
rec_dbts[0] = prim_row; mult_put_flags[0] = primary_key_changed ? DB_NOOVERWRITE : DB_YESOVERWRITE;
mult_put_flags[0] = primary_key_changed ? DB_NOOVERWRITE : DB_YESOVERWRITE;
}
else {
u_int32_t put_flags = primary_key_changed ? DB_NOOVERWRITE : DB_YESOVERWRITE;
error = share->file->put(share->file, txn, &prim_key, &prim_row, put_flags);
if (error) {
last_dup_key = primary_key;
goto cleanup;
}
}
curr_db_index = 1; curr_db_index = 1;
// Update all other keys // Update all other keys
for (uint keynr = 0; keynr < table_share->keys; keynr++) { for (uint keynr = 0; keynr < table_share->keys; keynr++) {
...@@ -3452,67 +3442,28 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -3452,67 +3442,28 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
} }
} }
if (!use_put_multiple) { dbs[curr_db_index] = share->key_file[keynr];
u_int32_t put_flags; key_dbts[curr_db_index] = mult_key_dbt[keynr];
put_flags = DB_YESOVERWRITE; rec_dbts[curr_db_index] = mult_rec_dbt[keynr];
create_dbt_key_from_table(&key, keynr, key_buff2, new_row, &has_null); curr_db_index++;
if (table->key_info[keynr].flags & HA_CLUSTERING) {
error = pack_row(&row, (const uchar *) new_row, keynr);
if (error){ goto cleanup; }
}
else {
bzero((void *) &row, sizeof(row));
}
//
// make sure that for clustering keys, we are using DB_YESOVERWRITE,
// therefore making this put an overwrite if the key has not changed
//
lockretryN(wait_lock_time){
error = share->key_file[keynr]->put(
share->key_file[keynr],
txn,
&key,
&row,
put_flags
);
lockretry_wait;
}
//
// We break if we hit an error, unless it is a dup key error
// and MySQL told us to ignore duplicate key errors
//
if (error) {
last_dup_key = keynr;
goto cleanup;
}
}
else {
dbs[curr_db_index] = share->key_file[keynr];
key_dbts[curr_db_index] = mult_key_dbt[keynr];
rec_dbts[curr_db_index] = mult_rec_dbt[keynr];
curr_db_index++;
}
} }
} }
if (use_put_multiple) { lockretryN(wait_lock_time){
lockretryN(wait_lock_time){ error = db_env->put_multiple(
error = db_env->put_multiple( db_env,
db_env, NULL,
NULL, txn,
txn, &prim_key,
&prim_key, &prim_row,
&prim_row, curr_db_index,
curr_db_index, dbs,
dbs, key_dbts,
key_dbts, rec_dbts,
rec_dbts, mult_put_flags,
mult_put_flags, NULL
NULL );
); lockretry_wait;
lockretry_wait;
}
} }
if (!error) { if (!error) {
trx->stmt_progress.updated++; trx->stmt_progress.updated++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment