Commit 9899df36 authored by tomas@whalegate.ndb.mysql.com's avatar tomas@whalegate.ndb.mysql.com

Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-telco-gca-single-user

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-gca-single-user
parents 3d882032 29ac950b
......@@ -140,6 +140,8 @@ public:
RowGCIFlag = 150,
RowChecksumFlag = 151,
SingleUserMode = 152,
TableEnd = 999,
AttributeName = 1000, // String, Mandatory
......@@ -344,6 +346,7 @@ public:
Uint32 RowGCIFlag;
Uint32 RowChecksumFlag;
Uint32 SingleUserMode;
Table() {}
void init();
......
......@@ -89,5 +89,12 @@
*/
#define NDB_TEMP_TAB_PERMANENT 0
#define NDB_TEMP_TAB_TEMPORARY 1
/*
* Table single user mode
*/
#define NDB_SUM_LOCKED 0
#define NDB_SUM_READONLY 1
#define NDB_SUM_READ_WRITE 2
#endif
......@@ -576,6 +576,15 @@ public:
*/
class Table : public Object {
public:
/*
* Single user mode specifies access rights to table during single user mode
*/
enum SingleUserMode {
SingleUserModeLocked = NDB_SUM_LOCKED,
SingleUserModeReadOnly = NDB_SUM_READONLY,
SingleUserModeReadWrite = NDB_SUM_READ_WRITE
};
/**
* @name General
* @{
......@@ -895,6 +904,13 @@ public:
void setMinRows(Uint64 minRows);
Uint64 getMinRows() const;
/**
* Set/Get SingleUserMode
*/
void setSingleUserMode(enum SingleUserMode);
enum SingleUserMode getSingleUserMode() const;
/** @} *******************************************************************/
/**
......
......@@ -66,6 +66,7 @@ DictTabInfo::TableMapping[] = {
DTIMAP(Table, MaxRowsHigh, MaxRowsHigh),
DTIMAP(Table, MinRowsLow, MinRowsLow),
DTIMAP(Table, MinRowsHigh, MinRowsHigh),
DTIMAP(Table, SingleUserMode, SingleUserMode),
DTIBREAK(AttributeName)
};
......@@ -164,6 +165,8 @@ DictTabInfo::Table::init(){
MaxRowsHigh = 0;
MinRowsLow = 0;
MinRowsHigh = 0;
SingleUserMode = 0;
}
void
......
......@@ -462,6 +462,7 @@ Dbdict::packTableIntoPages(SimpleProperties::Writer & w,
w.add(DictTabInfo::FragmentCount, tablePtr.p->fragmentCount);
w.add(DictTabInfo::MinRowsLow, tablePtr.p->minRowsLow);
w.add(DictTabInfo::MinRowsHigh, tablePtr.p->minRowsHigh);
w.add(DictTabInfo::SingleUserMode, tablePtr.p->singleUserMode);
if(signal)
{
......@@ -1873,6 +1874,7 @@ void Dbdict::initialiseTableRecord(TableRecordPtr tablePtr)
tablePtr.p->m_bits = 0;
tablePtr.p->minRowsLow = 0;
tablePtr.p->minRowsHigh = 0;
tablePtr.p->singleUserMode = 0;
tablePtr.p->tableType = DictTabInfo::UserTable;
tablePtr.p->primaryTableId = RNIL;
// volatile elements
......@@ -5706,7 +5708,9 @@ Dbdict::execTAB_COMMITCONF(Signal* signal){
signal->theData[4] = (Uint32)tabPtr.p->tableType;
signal->theData[5] = createTabPtr.p->key;
signal->theData[6] = (Uint32)tabPtr.p->noOfPrimkey;
sendSignal(DBTC_REF, GSN_TC_SCHVERREQ, signal, 7, JBB);
signal->theData[7] = (Uint32)tabPtr.p->singleUserMode;
sendSignal(DBTC_REF, GSN_TC_SCHVERREQ, signal, 8, JBB);
return;
}
......@@ -6136,6 +6140,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
tablePtr.p->minRowsHigh = c_tableDesc.MinRowsHigh;
tablePtr.p->defaultNoPartFlag = c_tableDesc.DefaultNoPartFlag;
tablePtr.p->linearHashFlag = c_tableDesc.LinearHashFlag;
tablePtr.p->singleUserMode = tableDesc.SingleUserMode;
Uint64 maxRows =
(((Uint64)tablePtr.p->maxRowsHigh) << 32) + tablePtr.p->maxRowsLow;
......
......@@ -375,6 +375,11 @@ public:
Uint32 fragmentCount;
Uint32 m_tablespace_id;
/*
* Access rights to table during single user mode
*/
Uint8 singleUserMode;
};
typedef Ptr<TableRecord> TableRecordPtr;
......
......@@ -709,6 +709,7 @@ public:
Uint8 tckeyrec; // ndrad frn R
Uint8 tcindxrec;
Uint8 apiFailState; // ndrad frn R
Uint8 singleUserMode;
ReturnSignal returnsignal;
Uint8 timeOutCounter;
......@@ -959,10 +960,21 @@ public:
/********************************************************/
struct TableRecord {
Uint32 currentSchemaVersion;
Uint8 enabled;
Uint8 dropping;
Uint16 m_flags;
Uint8 tableType;
Uint8 storedTable;
Uint8 singleUserMode;
enum {
TR_ENABLED = 1 << 0,
TR_DROPPING = 1 << 1,
TR_STORED_TABLE = 1 << 2
};
Uint8 get_enabled() const { return (m_flags & TR_ENABLED) != 0; }
Uint8 get_dropping() const { return (m_flags & TR_DROPPING) != 0; }
Uint8 get_storedTable() const { return (m_flags & TR_STORED_TABLE) != 0; }
void set_enabled(Uint8 f) { f ? m_flags |= (Uint16)TR_ENABLED : m_flags &= ~(Uint16)TR_ENABLED; }
void set_dropping(Uint8 f) { f ? m_flags |= (Uint16)TR_DROPPING : m_flags &= ~(Uint16)TR_DROPPING; }
void set_storedTable(Uint8 f) { f ? m_flags |= (Uint16)TR_STORED_TABLE : m_flags &= ~(Uint16)TR_STORED_TABLE; }
Uint8 noOfKeyAttr;
Uint8 hasCharAttr;
......@@ -970,7 +982,7 @@ public:
Uint8 hasVarKeys;
bool checkTable(Uint32 schemaVersion) const {
return enabled && !dropping &&
return get_enabled() && !get_dropping() &&
(table_version_major(schemaVersion) == table_version_major(currentSchemaVersion));
}
......@@ -1837,10 +1849,10 @@ private:
Uint32 transid2);
void removeMarkerForFailedAPI(Signal* signal, Uint32 nodeId, Uint32 bucket);
bool getAllowStartTransaction(Uint32 nodeId) const {
bool getAllowStartTransaction(Uint32 nodeId, Uint32 table_single_user_mode) const {
if (unlikely(getNodeState().getSingleUserMode()))
{
if (getNodeState().getSingleUserApi() == nodeId)
if (getNodeState().getSingleUserApi() == nodeId || table_single_user_mode)
return true;
else
return false;
......
......@@ -1685,6 +1685,7 @@ void Ndbcntr::createSystableLab(Signal* signal, unsigned index)
//w.add(DictTabInfo::NoOfVariable, (Uint32)0);
//w.add(DictTabInfo::KeyLength, 1);
w.add(DictTabInfo::TableTypeVal, (Uint32)table.tableType);
w.add(DictTabInfo::SingleUserMode, (Uint32)NDB_SUM_READ_WRITE);
for (unsigned i = 0; i < table.columnCount; i++) {
const SysColumn& column = table.columnList[i];
......
......@@ -495,6 +495,18 @@ NdbDictionary::Table::getFrmLength() const {
return m_impl.getFrmLength();
}
enum NdbDictionary::Table::SingleUserMode
NdbDictionary::Table::getSingleUserMode() const
{
return (enum SingleUserMode)m_impl.m_single_user_mode;
}
void
NdbDictionary::Table::setSingleUserMode(enum NdbDictionary::Table::SingleUserMode mode)
{
m_impl.m_single_user_mode = (Uint8)mode;
}
void
NdbDictionary::Table::setTablespaceNames(const void *data, Uint32 len)
{
......
......@@ -470,6 +470,7 @@ NdbTableImpl::init(){
m_tablespace_name.clear();
m_tablespace_id = ~0;
m_tablespace_version = ~0;
m_single_user_mode = 0;
}
bool
......@@ -663,6 +664,15 @@ NdbTableImpl::equal(const NdbTableImpl& obj) const
DBUG_RETURN(false);
}
}
if(m_single_user_mode != obj.m_single_user_mode)
{
DBUG_PRINT("info",("m_single_user_mode %d != %d",
(int32)m_single_user_mode,
(int32)obj.m_single_user_mode));
DBUG_RETURN(false);
}
DBUG_RETURN(true);
}
......@@ -726,6 +736,8 @@ NdbTableImpl::assign(const NdbTableImpl& org)
m_keyLenInWords = org.m_keyLenInWords;
m_fragmentCount = org.m_fragmentCount;
m_single_user_mode = org.m_single_user_mode;
if (m_index != 0)
delete m_index;
m_index = org.m_index;
......@@ -2101,6 +2113,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
impl->m_kvalue = tableDesc->TableKValue;
impl->m_minLoadFactor = tableDesc->MinLoadFactor;
impl->m_maxLoadFactor = tableDesc->MaxLoadFactor;
impl->m_single_user_mode = tableDesc->SingleUserMode;
impl->m_indexType = (NdbDictionary::Object::Type)
getApiConstant(tableDesc->TableType,
......@@ -2562,6 +2575,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
tmpTab->MinRowsLow = (Uint32)(impl.m_min_rows & 0xFFFFFFFF);
tmpTab->DefaultNoPartFlag = impl.m_default_no_part_flag;
tmpTab->LinearHashFlag = impl.m_linear_flag;
tmpTab->SingleUserMode = impl.m_single_user_mode;
if (impl.m_ts_name.length())
{
......
......@@ -204,6 +204,7 @@ public:
int m_maxLoadFactor;
Uint16 m_keyLenInWords;
Uint16 m_fragmentCount;
Uint8 m_single_user_mode;
NdbIndexImpl * m_index;
NdbColumnImpl * getColumn(unsigned attrId);
......
......@@ -33,7 +33,7 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
ndbout << "Length of frm data: " << tab.getFrmLength() << endl;
ndbout << "Row Checksum: " << tab.getRowChecksumIndicator() << endl;
ndbout << "Row GCI: " << tab.getRowGCIIndicator() << endl;
ndbout << "SingleUserMode: " << tab.getSingleUserMode() << endl;
//<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <<endl;
ndbout << "TableStatus: ";
......
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