mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Ndb.hpp, Ndb.cpp, ha_ndbcluster.cc:
Add a check if setting an auto_increment field will change it's next value before retrieving tuple_id_range lock. This avoids hitting locks when updating auto_increment values to a lower value than the current maximum. This is useful in loading a table with auto_increment where one loads the highest numbered pk's first and then proceeds backwards to the first. This can then be achieved with the same performance as a normal insert without auto_increment. ndb_restore.result: Updated result file mysql-test/suite/ndb/r/ndb_restore.result: Updated result file sql/ha_ndbcluster.cc: Add a check if setting an auto_increment field will change it's next value before retrieving tuple_id_range lock. This avoids hitting locks when updating auto_increment values to a lower value than the current maximum. This is useful in loading a table with auto_increment where one loads the highest numbered pk's first and then proceeds backwards to the first. This can then be achieved with the same performance as a normal insert without auto_increment. storage/ndb/include/ndbapi/Ndb.hpp: Add a check if setting an auto_increment field will change it's next value before retrieving tuple_id_range lock. This avoids hitting locks when updating auto_increment values to a lower value than the current maximum. This is useful in loading a table with auto_increment where one loads the highest numbered pk's first and then proceeds backwards to the first. This can then be achieved with the same performance as a normal insert without auto_increment. storage/ndb/src/ndbapi/Ndb.cpp: Add a check if setting an auto_increment field will change it's next value before retrieving tuple_id_range lock. This avoids hitting locks when updating auto_increment values to a lower value than the current maximum. This is useful in loading a table with auto_increment where one loads the highest numbered pk's first and then proceeds backwards to the first. This can then be achieved with the same performance as a normal insert without auto_increment.
This commit is contained in:
@ -1515,37 +1515,40 @@ public:
|
||||
TupleIdRange() {}
|
||||
Uint64 m_first_tuple_id;
|
||||
Uint64 m_last_tuple_id;
|
||||
Uint64 m_highest_seen;
|
||||
void reset() {
|
||||
m_first_tuple_id = ~(Uint64)0;
|
||||
m_last_tuple_id = ~(Uint64)0;
|
||||
m_highest_seen = 0;
|
||||
};
|
||||
};
|
||||
|
||||
int initAutoIncrement();
|
||||
|
||||
int getAutoIncrementValue(const char* aTableName,
|
||||
Uint64 & tupleId, Uint32 cacheSize,
|
||||
Uint64 & autoValue, Uint32 cacheSize,
|
||||
Uint64 step = 1, Uint64 start = 1);
|
||||
int getAutoIncrementValue(const NdbDictionary::Table * aTable,
|
||||
Uint64 & tupleId, Uint32 cacheSize,
|
||||
Uint64 & autoValue, Uint32 cacheSize,
|
||||
Uint64 step = 1, Uint64 start = 1);
|
||||
int getAutoIncrementValue(const NdbDictionary::Table * aTable,
|
||||
TupleIdRange & range, Uint64 & tupleId,
|
||||
TupleIdRange & range, Uint64 & autoValue,
|
||||
Uint32 cacheSize,
|
||||
Uint64 step = 1, Uint64 start = 1);
|
||||
int readAutoIncrementValue(const char* aTableName,
|
||||
Uint64 & tupleId);
|
||||
Uint64 & autoValue);
|
||||
int readAutoIncrementValue(const NdbDictionary::Table * aTable,
|
||||
Uint64 & tupleId);
|
||||
Uint64 & autoValue);
|
||||
int readAutoIncrementValue(const NdbDictionary::Table * aTable,
|
||||
TupleIdRange & range, Uint64 & tupleId);
|
||||
TupleIdRange & range, Uint64 & autoValue);
|
||||
int setAutoIncrementValue(const char* aTableName,
|
||||
Uint64 tupleId, bool modify);
|
||||
Uint64 autoValue, bool modify);
|
||||
int setAutoIncrementValue(const NdbDictionary::Table * aTable,
|
||||
Uint64 tupleId, bool modify);
|
||||
Uint64 autoValue, bool modify);
|
||||
int setAutoIncrementValue(const NdbDictionary::Table * aTable,
|
||||
TupleIdRange & range, Uint64 tupleId,
|
||||
TupleIdRange & range, Uint64 autoValue,
|
||||
bool modify);
|
||||
bool checkUpdateAutoIncrementValue(TupleIdRange & range, Uint64 autoValue);
|
||||
private:
|
||||
int getTupleIdFromNdb(const NdbTableImpl* table,
|
||||
TupleIdRange & range, Uint64 & tupleId,
|
||||
@ -1554,6 +1557,8 @@ private:
|
||||
TupleIdRange & range, Uint64 & tupleId);
|
||||
int setTupleIdInNdb(const NdbTableImpl* table,
|
||||
TupleIdRange & range, Uint64 tupleId, bool modify);
|
||||
int checkTupleIdInNdb(TupleIdRange & range,
|
||||
Uint64 tupleId);
|
||||
int opTupleIdOnNdb(const NdbTableImpl* table,
|
||||
TupleIdRange & range, Uint64 & opValue, Uint32 op);
|
||||
public:
|
||||
|
Reference in New Issue
Block a user