Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
29ac950b
Commit
29ac950b
authored
Mar 23, 2007
by
tomas@whalegate.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes
parent
47f37fb3
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
143 additions
and
46 deletions
+143
-46
ndb/include/kernel/signaldata/DictTabInfo.hpp
ndb/include/kernel/signaldata/DictTabInfo.hpp
+4
-1
ndb/include/ndb_constants.h
ndb/include/ndb_constants.h
+7
-0
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+16
-0
ndb/src/common/debugger/signaldata/DictTabInfo.cpp
ndb/src/common/debugger/signaldata/DictTabInfo.cpp
+3
-0
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+6
-3
ndb/src/kernel/blocks/dbdict/Dbdict.hpp
ndb/src/kernel/blocks/dbdict/Dbdict.hpp
+5
-0
ndb/src/kernel/blocks/dbtc/Dbtc.hpp
ndb/src/kernel/blocks/dbtc/Dbtc.hpp
+18
-6
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+54
-33
ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
+1
-0
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+12
-0
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+15
-2
ndb/src/ndbapi/NdbDictionaryImpl.hpp
ndb/src/ndbapi/NdbDictionaryImpl.hpp
+1
-0
ndb/test/src/NDBT_Table.cpp
ndb/test/src/NDBT_Table.cpp
+1
-1
No files found.
ndb/include/kernel/signaldata/DictTabInfo.hpp
View file @
29ac950b
...
...
@@ -126,6 +126,8 @@ public:
MinRowsLow
=
143
,
MinRowsHigh
=
144
,
SingleUserMode
=
152
,
TableEnd
=
999
,
AttributeName
=
1000
,
// String, Mandatory
...
...
@@ -273,7 +275,8 @@ public:
Uint32
MaxRowsHigh
;
Uint32
MinRowsLow
;
Uint32
MinRowsHigh
;
Uint32
SingleUserMode
;
void
init
();
};
...
...
ndb/include/ndb_constants.h
View file @
29ac950b
...
...
@@ -68,4 +68,11 @@
#define NDB_TYPE_MAX 31
/*
* Table single user mode
*/
#define NDB_SUM_LOCKED 0
#define NDB_SUM_READONLY 1
#define NDB_SUM_READ_WRITE 2
#endif
ndb/include/ndbapi/NdbDictionary.hpp
View file @
29ac950b
...
...
@@ -497,6 +497,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
* @{
...
...
@@ -735,6 +744,13 @@ public:
void
setMinRows
(
Uint64
minRows
);
Uint64
getMinRows
()
const
;
/**
* Set/Get SingleUserMode
*/
void
setSingleUserMode
(
enum
SingleUserMode
);
enum
SingleUserMode
getSingleUserMode
()
const
;
/** @} *******************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
...
...
ndb/src/common/debugger/signaldata/DictTabInfo.cpp
View file @
29ac950b
...
...
@@ -51,6 +51,7 @@ DictTabInfo::TableMapping[] = {
DTIMAP
(
Table
,
MaxRowsHigh
,
MaxRowsHigh
),
DTIMAP
(
Table
,
MinRowsLow
,
MinRowsLow
),
DTIMAP
(
Table
,
MinRowsHigh
,
MinRowsHigh
),
DTIMAP
(
Table
,
SingleUserMode
,
SingleUserMode
),
DTIBREAK
(
AttributeName
)
};
...
...
@@ -131,6 +132,8 @@ DictTabInfo::Table::init(){
MaxRowsHigh
=
0
;
MinRowsLow
=
0
;
MinRowsHigh
=
0
;
SingleUserMode
=
0
;
}
void
...
...
ndb/src/kernel/blocks/dbdict/Dbdict.cpp
View file @
29ac950b
...
...
@@ -289,7 +289,7 @@ Dbdict::packTableIntoPagesImpl(SimpleProperties::Writer & w,
w
.
add
(
DictTabInfo
::
MaxRowsHigh
,
tablePtr
.
p
->
maxRowsHigh
);
w
.
add
(
DictTabInfo
::
MinRowsLow
,
tablePtr
.
p
->
minRowsLow
);
w
.
add
(
DictTabInfo
::
MinRowsHigh
,
tablePtr
.
p
->
minRowsHigh
);
w
.
add
(
DictTabInfo
::
SingleUserMode
,
tablePtr
.
p
->
singleUserMode
);
if
(
!
signal
)
{
w
.
add
(
DictTabInfo
::
FragmentCount
,
tablePtr
.
p
->
fragmentCount
);
...
...
@@ -1500,6 +1500,7 @@ void Dbdict::initialiseTableRecord(TableRecordPtr tablePtr)
tablePtr
.
p
->
maxRowsHigh
=
0
;
tablePtr
.
p
->
minRowsLow
=
0
;
tablePtr
.
p
->
minRowsHigh
=
0
;
tablePtr
.
p
->
singleUserMode
=
0
;
tablePtr
.
p
->
storedTable
=
true
;
tablePtr
.
p
->
tableType
=
DictTabInfo
::
UserTable
;
tablePtr
.
p
->
primaryTableId
=
RNIL
;
...
...
@@ -4718,8 +4719,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
;
}
...
...
@@ -5084,6 +5086,7 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it,
tablePtr
.
p
->
maxRowsHigh
=
tableDesc
.
MaxRowsHigh
;
tablePtr
.
p
->
minRowsLow
=
tableDesc
.
MinRowsLow
;
tablePtr
.
p
->
minRowsHigh
=
tableDesc
.
MinRowsHigh
;
tablePtr
.
p
->
singleUserMode
=
tableDesc
.
SingleUserMode
;
Uint64
maxRows
=
(((
Uint64
)
tablePtr
.
p
->
maxRowsHigh
)
<<
32
)
+
tablePtr
.
p
->
maxRowsLow
;
...
...
ndb/src/kernel/blocks/dbdict/Dbdict.hpp
View file @
29ac950b
...
...
@@ -237,6 +237,11 @@ public:
char
frmData
[
MAX_FRM_DATA_SIZE
];
Uint32
fragmentCount
;
/*
* Access rights to table during single user mode
*/
Uint8
singleUserMode
;
};
typedef
Ptr
<
TableRecord
>
TableRecordPtr
;
...
...
ndb/src/kernel/blocks/dbtc/Dbtc.hpp
View file @
29ac950b
...
...
@@ -702,6 +702,7 @@ public:
Uint8
tckeyrec
;
// ndrad frn R
Uint8
tcindxrec
;
Uint8
apiFailState
;
// ndrad frn R
Uint8
singleUserMode
;
ReturnSignal
returnsignal
;
Uint8
timeOutCounter
;
...
...
@@ -957,17 +958,28 @@ 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
;
Uint8
noOfDistrKeys
;
bool
checkTable
(
Uint32
schemaVersion
)
const
{
return
enabled
&&
!
dropping
&&
return
get_enabled
()
&&
!
get_dropping
()
&&
(
table_version_major
(
schemaVersion
)
==
table_version_major
(
currentSchemaVersion
));
}
...
...
@@ -1835,10 +1847,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
;
...
...
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
View file @
29ac950b
This diff is collapsed.
Click to expand it.
ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
View file @
29ac950b
...
...
@@ -1645,6 +1645,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
];
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
29ac950b
...
...
@@ -430,6 +430,18 @@ NdbDictionary::Table::getFrmLength() const {
return
m_impl
.
m_frm
.
length
();
}
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
::
setFrm
(
const
void
*
data
,
Uint32
len
){
m_impl
.
m_frm
.
assign
(
data
,
len
);
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
29ac950b
...
...
@@ -318,6 +318,7 @@ NdbTableImpl::init(){
m_replicaCount
=
0
;
m_min_rows
=
0
;
m_max_rows
=
0
;
m_single_user_mode
=
0
;
}
bool
...
...
@@ -378,6 +379,14 @@ 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
);
}
...
...
@@ -403,7 +412,8 @@ NdbTableImpl::assign(const NdbTableImpl& org)
m_kvalue
=
org
.
m_kvalue
;
m_minLoadFactor
=
org
.
m_minLoadFactor
;
m_maxLoadFactor
=
org
.
m_maxLoadFactor
;
m_single_user_mode
=
org
.
m_single_user_mode
;
if
(
m_index
!=
0
)
delete
m_index
;
m_index
=
org
.
m_index
;
...
...
@@ -1191,6 +1201,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
::
Index
::
Type
)
getApiConstant
(
tableDesc
.
TableType
,
...
...
@@ -1519,12 +1530,14 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
tmpTab
.
MaxRowsLow
=
(
Uint32
)(
impl
.
m_max_rows
&
0xFFFFFFFF
);
tmpTab
.
MinRowsHigh
=
(
Uint32
)(
impl
.
m_min_rows
>>
32
);
tmpTab
.
MinRowsLow
=
(
Uint32
)(
impl
.
m_min_rows
&
0xFFFFFFFF
);
Uint64
maxRows
=
(((
Uint64
)
tmpTab
.
MaxRowsHigh
)
<<
32
)
+
tmpTab
.
MaxRowsLow
;
Uint64
minRows
=
(((
Uint64
)
tmpTab
.
MinRowsHigh
)
<<
32
)
+
tmpTab
.
MinRowsLow
;
tmpTab
.
SingleUserMode
=
impl
.
m_single_user_mode
;
tmpTab
.
FragmentType
=
getKernelConstant
(
impl
.
m_fragmentType
,
fragmentTypeMapping
,
DictTabInfo
::
AllNodesSmallTable
);
...
...
ndb/src/ndbapi/NdbDictionaryImpl.hpp
View file @
29ac950b
...
...
@@ -138,6 +138,7 @@ public:
int
m_maxLoadFactor
;
Uint16
m_keyLenInWords
;
Uint16
m_fragmentCount
;
Uint8
m_single_user_mode
;
NdbDictionaryImpl
*
m_dictionary
;
NdbIndexImpl
*
m_index
;
...
...
ndb/test/src/NDBT_Table.cpp
View file @
29ac950b
...
...
@@ -31,7 +31,7 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
ndbout
<<
"Number of attributes: "
<<
tab
.
getNoOfColumns
()
<<
endl
;
ndbout
<<
"Number of primary keys: "
<<
tab
.
getNoOfPrimaryKeys
()
<<
endl
;
ndbout
<<
"Length of frm data: "
<<
tab
.
getFrmLength
()
<<
endl
;
ndbout
<<
"SingleUserMode: "
<<
tab
.
getSingleUserMode
()
<<
endl
;
//<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <<endl;
ndbout
<<
"TableStatus: "
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment