Commit 125c41bd authored by unknown's avatar unknown

fixes for new key_map code

parent 249798d8
......@@ -884,12 +884,12 @@ int ha_berkeley::write_row(byte * record)
DBUG_PRINT("trans",("aborting subtransaction")); /* purecov: deadcode */
new_error=txn_abort(sub_trans); /* purecov: deadcode */
}
else if (changed_keys)
else if (!changed_keys.is_clear_all())
{
new_error = 0;
for (uint keynr=0; changed_keys; keynr++, changed_keys >>= 1)
for (uint keynr=0; keynr < changed_keys.length(); keynr++)
{
if (changed_keys & 1)
if (changed_keys.is_set(keynr))
{
if ((new_error = remove_key(sub_trans, keynr, record,
&prim_key)))
......@@ -1033,11 +1033,14 @@ int ha_berkeley::restore_keys(DB_TXN *trans, key_map changed_keys,
rolled back. The last key set in changed_keys is the one that
triggered the duplicate key error (it wasn't inserted), so for
that one just put back the old value. */
for (keynr=0; changed_keys; keynr++, changed_keys >>= 1)
if (!changed_keys.is_clear_all())
{
if (changed_keys & 1)
key_map map1(1);
for (keynr=0; keynr < changed_keys.length(); keynr++)
{
if (changed_keys != 1 &&
if (changed_keys.is_set(keynr))
{
if (changed_keys.is_subset(map1) &&
(error = remove_key(trans, keynr, new_row, new_key)))
break; /* purecov: inspected */
if ((error = key_file[keynr]->put(key_file[keynr], trans,
......@@ -1047,6 +1050,7 @@ int ha_berkeley::restore_keys(DB_TXN *trans, key_map changed_keys,
break; /* purecov: inspected */
}
}
}
err:
DBUG_ASSERT(error != DB_KEYEXIST);
......@@ -1146,7 +1150,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
DBUG_PRINT("trans",("aborting subtransaction")); /* purecov: deadcode */
new_error=txn_abort(sub_trans); /* purecov: deadcode */
}
else if (changed_keys)
else if (!changed_keys.is_clear_all())
new_error=restore_keys(transaction, changed_keys, primary_key,
old_row, &old_prim_key, new_row, &prim_key,
thd_options);
......@@ -1231,9 +1235,9 @@ int ha_berkeley::remove_keys(DB_TXN *trans, const byte *record,
DBT *new_record, DBT *prim_key, key_map keys)
{
int result = 0;
for (uint keynr=0; keys; keynr++, keys>>=1)
for (uint keynr=0; keynr < keys.length(); keynr++)
{
if (keys & 1)
if (keys.is_set(keynr))
{
int new_error=remove_key(trans, keynr, record, prim_key);
if (new_error)
......
......@@ -107,7 +107,7 @@ class ha_berkeley: public handler
uint extra_rec_buf_length() { return BDB_HIDDEN_PRIMARY_KEY_LENGTH; }
ha_rows estimate_number_of_rows();
bool fast_key_read() { return 1;}
const key_map keys_to_use_for_scanning() { return key_map(~0); }
const key_map& keys_to_use_for_scanning() { return key_map_full; }
bool has_transactions() { return 1;}
int open(const char *name, int mode, uint test_if_locked);
......
......@@ -99,7 +99,7 @@ public:
template <> class Bitmap<64>
{
longlong map;
ulonglong map;
public:
Bitmap(uint prefix_to_set=0) { set_prefix(prefix_to_set); }
Bitmap<64>& init() { return *this; }
......
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