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
3add897e
Commit
3add897e
authored
Jan 05, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed to using NdbTransaction scoped enums
and removed usage of Ndb::waitUntilReady()
parent
ae736acf
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
119 additions
and
75 deletions
+119
-75
ndb/examples/ndbapi_async_example/ndbapi_async.cpp
ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+1
-1
ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
+2
-1
ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
+2
-2
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+7
-7
ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
+4
-4
ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
...mples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
+5
-5
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+4
-1
ndb/include/ndbapi/NdbTransaction.hpp
ndb/include/ndbapi/NdbTransaction.hpp
+1
-1
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+14
-0
ndb/tools/delete_all.cpp
ndb/tools/delete_all.cpp
+10
-8
ndb/tools/desc.cpp
ndb/tools/desc.cpp
+13
-11
ndb/tools/drop_index.cpp
ndb/tools/drop_index.cpp
+6
-4
ndb/tools/drop_tab.cpp
ndb/tools/drop_tab.cpp
+7
-4
ndb/tools/listTables.cpp
ndb/tools/listTables.cpp
+7
-4
ndb/tools/restore/consumer_restore.cpp
ndb/tools/restore/consumer_restore.cpp
+4
-3
ndb/tools/select_all.cpp
ndb/tools/select_all.cpp
+8
-7
ndb/tools/select_count.cpp
ndb/tools/select_count.cpp
+8
-6
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+16
-6
No files found.
ndb/examples/ndbapi_async_example/ndbapi_async.cpp
View file @
3add897e
...
...
@@ -381,7 +381,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData)
}
/*Prepare transaction (the transaction is NOT yet sent to NDB)*/
transaction
[
current
].
conn
->
executeAsynchPrepare
(
Commit
,
transaction
[
current
].
conn
->
executeAsynchPrepare
(
NdbTransaction
::
Commit
,
&
callback
,
cb
);
/**
...
...
ndb/examples/ndbapi_async_example1/ndbapi_async1.cpp
View file @
3add897e
...
...
@@ -99,7 +99,8 @@ int main()
myNdbOperation
->
setValue
(
"ATTR2"
,
20
+
i
);
// Prepare transaction (the transaction is NOT yet sent to NDB)
myNdbTransaction
[
i
]
->
executeAsynchPrepare
(
Commit
,
&
callback
,
NULL
);
myNdbTransaction
[
i
]
->
executeAsynchPrepare
(
NdbTransaction
::
Commit
,
&
callback
,
NULL
);
}
// Send all transactions to NDB
...
...
ndb/examples/ndbapi_retries_example/ndbapi_retries.cpp
View file @
3add897e
...
...
@@ -104,7 +104,7 @@ int insert(int transactionId, NdbTransaction* myTransaction) {
exit
(
-
1
);
}
return
myTransaction
->
execute
(
NoCommit
);
return
myTransaction
->
execute
(
N
dbTransaction
::
N
oCommit
);
}
...
...
@@ -131,7 +131,7 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
result
=
-
1
;
// Failure
}
else
if
(
insert
(
transactionId
,
myTransaction
)
||
insert
(
10000
+
transactionId
,
myTransaction
)
||
myTransaction
->
execute
(
Commit
))
{
myTransaction
->
execute
(
NdbTransaction
::
Commit
))
{
TRANSERROR
(
myTransaction
);
ndberror
=
myTransaction
->
getNdbError
();
result
=
-
1
;
// Failure
...
...
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
View file @
3add897e
...
...
@@ -187,7 +187,7 @@ int populate(Ndb * myNdb)
myNdbOperation
->
setValue
(
"COLOR"
,
cars
[
i
].
color
);
}
int
check
=
myTrans
->
execute
(
Commit
);
int
check
=
myTrans
->
execute
(
NdbTransaction
::
Commit
);
myTrans
->
close
();
...
...
@@ -280,7 +280,7 @@ int scan_delete(Ndb* myNdb,
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
if
(
myTrans
->
execute
(
NoCommit
)
!=
0
){
if
(
myTrans
->
execute
(
N
dbTransaction
::
N
oCommit
)
!=
0
){
err
=
myTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
std
::
cout
<<
myTrans
->
getNdbError
().
message
<<
std
::
endl
;
...
...
@@ -322,7 +322,7 @@ int scan_delete(Ndb* myNdb,
*/
if
(
check
!=
-
1
)
{
check
=
myTrans
->
execute
(
Commit
);
check
=
myTrans
->
execute
(
NdbTransaction
::
Commit
);
}
if
(
check
==
-
1
)
...
...
@@ -453,7 +453,7 @@ int scan_update(Ndb* myNdb,
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
if
(
myTrans
->
execute
(
NoCommit
)
!=
0
)
if
(
myTrans
->
execute
(
N
dbTransaction
::
N
oCommit
)
!=
0
)
{
err
=
myTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
...
...
@@ -501,7 +501,7 @@ int scan_update(Ndb* myNdb,
*/
if
(
check
!=
-
1
)
{
check
=
myTrans
->
execute
(
NoCommit
);
check
=
myTrans
->
execute
(
N
dbTransaction
::
N
oCommit
);
}
/**
...
...
@@ -525,7 +525,7 @@ int scan_update(Ndb* myNdb,
/**
* Commit all prepared operations
*/
if
(
myTrans
->
execute
(
Commit
)
==
-
1
)
if
(
myTrans
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
{
if
(
err
.
status
==
NdbError
::
TemporaryError
){
std
::
cout
<<
myTrans
->
getNdbError
().
message
<<
std
::
endl
;
...
...
@@ -640,7 +640,7 @@ int scan_print(Ndb * myNdb)
/**
* Start scan (NoCommit since we are only reading at this stage);
*/
if
(
myTrans
->
execute
(
NoCommit
)
!=
0
){
if
(
myTrans
->
execute
(
N
dbTransaction
::
N
oCommit
)
!=
0
){
err
=
myTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
std
::
cout
<<
myTrans
->
getNdbError
().
message
<<
std
::
endl
;
...
...
ndb/examples/ndbapi_simple_example/ndbapi_simple.cpp
View file @
3add897e
...
...
@@ -170,7 +170,7 @@ static void do_insert(Ndb &myNdb)
myOperation
->
equal
(
"ATTR1"
,
i
+
5
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
5
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
.
closeTransaction
(
myTransaction
);
...
...
@@ -193,7 +193,7 @@ static void do_update(Ndb &myNdb)
myOperation
->
equal
(
"ATTR1"
,
i
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
10
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
.
closeTransaction
(
myTransaction
);
...
...
@@ -214,7 +214,7 @@ static void do_delete(Ndb &myNdb)
myOperation
->
deleteTuple
();
myOperation
->
equal
(
"ATTR1"
,
3
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
.
closeTransaction
(
myTransaction
);
...
...
@@ -240,7 +240,7 @@ static void do_read(Ndb &myNdb)
NdbRecAttr
*
myRecAttr
=
myOperation
->
getValue
(
"ATTR2"
,
NULL
);
if
(
myRecAttr
==
NULL
)
APIERROR
(
myTransaction
->
getNdbError
());
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
if
(
i
==
3
)
{
std
::
cout
<<
"Detected that deleted tuple doesn't exist!"
<<
std
::
endl
;
}
else
{
...
...
ndb/examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp
View file @
3add897e
...
...
@@ -127,7 +127,7 @@ int main()
myOperation
->
equal
(
"ATTR1"
,
i
+
5
);
myOperation
->
setValue
(
"ATTR2"
,
i
+
5
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
->
closeTransaction
(
myTransaction
);
...
...
@@ -152,7 +152,7 @@ int main()
NdbRecAttr
*
myRecAttr
=
myIndexOperation
->
getValue
(
"ATTR1"
,
NULL
);
if
(
myRecAttr
==
NULL
)
APIERROR
(
myTransaction
->
getNdbError
());
if
(
myTransaction
->
execute
(
Commit
)
!=
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
!=
-
1
)
printf
(
" %2d %2d
\n
"
,
myRecAttr
->
u_32_value
(),
i
);
myNdb
->
closeTransaction
(
myTransaction
);
...
...
@@ -173,7 +173,7 @@ int main()
myIndexOperation
->
equal
(
"ATTR2"
,
i
);
myIndexOperation
->
setValue
(
"ATTR2"
,
i
+
10
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
->
closeTransaction
(
myTransaction
);
...
...
@@ -193,7 +193,7 @@ int main()
myIndexOperation
->
deleteTuple
();
myIndexOperation
->
equal
(
"ATTR2"
,
3
);
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
APIERROR
(
myTransaction
->
getNdbError
());
myNdb
->
closeTransaction
(
myTransaction
);
...
...
@@ -218,7 +218,7 @@ int main()
NdbRecAttr
*
myRecAttr
=
myOperation
->
getValue
(
"ATTR2"
,
NULL
);
if
(
myRecAttr
==
NULL
)
APIERROR
(
myTransaction
->
getNdbError
());
if
(
myTransaction
->
execute
(
Commit
)
==
-
1
)
if
(
myTransaction
->
execute
(
NdbTransaction
::
Commit
)
==
-
1
)
if
(
i
==
3
)
{
std
::
cout
<<
"Detected that deleted tuple doesn't exist!
\n
"
;
}
else
{
...
...
ndb/include/ndbapi/NdbDictionary.hpp
View file @
3add897e
...
...
@@ -698,7 +698,7 @@ public:
/** @} *******************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_
DEPRECATED
#ifndef DOXYGEN_SHOULD_SKIP_
INTERNAL
void
setStoredTable
(
bool
x
)
{
setLogging
(
x
);
}
bool
getStoredTable
()
const
{
return
getLogging
();
}
...
...
@@ -1010,6 +1010,8 @@ public:
* Fetch list of all objects, optionally restricted to given type.
*/
int
listObjects
(
List
&
list
,
Object
::
Type
type
=
Object
::
TypeUndefined
);
int
listObjects
(
const
List
&
list
,
Object
::
Type
type
=
Object
::
TypeUndefined
)
const
;
/**
* Get the latest error
...
...
@@ -1048,6 +1050,7 @@ public:
* @return 0 if successful, otherwise -1
*/
int
listIndexes
(
List
&
list
,
const
char
*
tableName
);
int
listIndexes
(
const
List
&
list
,
const
char
*
tableName
)
const
;
/** @} *******************************************************************/
/**
...
...
ndb/include/ndbapi/NdbTransaction.hpp
View file @
3add897e
...
...
@@ -42,7 +42,7 @@ class NdbBlob;
typedef
void
(
*
NdbAsynchCallback
)(
int
,
NdbTransaction
*
,
void
*
);
#endif
#ifndef DOXYGEN_SHOULD_SKIP_
DEPRECATED
#ifndef DOXYGEN_SHOULD_SKIP_
INTERNAL
enum
AbortOption
{
CommitIfFailFree
=
0
,
TryCommit
=
0
,
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
3add897e
...
...
@@ -823,6 +823,13 @@ NdbDictionary::Dictionary::listObjects(List& list, Object::Type type)
return
m_impl
.
listObjects
(
list
,
type
);
}
int
NdbDictionary
::
Dictionary
::
listObjects
(
const
List
&
list
,
Object
::
Type
type
)
const
{
return
m_impl
.
listObjects
(
*
(
List
*
)
&
list
,
type
);
}
int
NdbDictionary
::
Dictionary
::
listIndexes
(
List
&
list
,
const
char
*
tableName
)
{
...
...
@@ -834,6 +841,13 @@ NdbDictionary::Dictionary::listIndexes(List& list, const char * tableName)
return
m_impl
.
listIndexes
(
list
,
tab
->
getTableId
());
}
int
NdbDictionary
::
Dictionary
::
listIndexes
(
const
List
&
list
,
const
char
*
tableName
)
const
{
return
listIndexes
(
*
(
List
*
)
&
list
,
tableName
);
}
const
struct
NdbError
&
NdbDictionary
::
Dictionary
::
getNdbError
()
const
{
return
m_impl
.
getNdbError
();
...
...
ndb/tools/delete_all.cpp
View file @
3add897e
...
...
@@ -80,19 +80,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection
con
(
opt_connect_str
);
if
(
con
.
connect
(
12
,
5
,
1
)
!=
0
)
{
ndbout
<<
"Unable to connect to management server."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
if
(
con
.
wait_until_ready
(
30
,
0
)
<
0
)
{
ndbout
<<
"Cluster nodes not ready in 30 seconds."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
MyNdb
(
&
con
,
_dbname
);
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
MyNdb
.
init
()
!=
0
){
ERR
(
MyNdb
.
getNdbError
());
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
// Connect to Ndb and wait for it to become ready
while
(
MyNdb
.
waitUntilReady
()
!=
0
)
ndbout
<<
"Waiting for ndb to become ready..."
<<
endl
;
// Check if table exists in db
int
res
=
NDBT_OK
;
for
(
int
i
=
0
;
i
<
argc
;
i
++
){
...
...
@@ -148,11 +150,11 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
goto
failed
;
}
if
(
pOp
->
readTuples
Exclusive
(
par
)
)
{
if
(
pOp
->
readTuples
(
NdbOperation
::
LM_Exclusive
,
par
)
)
{
goto
failed
;
}
if
(
pTrans
->
execute
(
NoCommit
)
!=
0
){
if
(
pTrans
->
execute
(
N
dbTransaction
::
N
oCommit
)
!=
0
){
err
=
pTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR
(
err
);
...
...
@@ -172,7 +174,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
}
while
((
check
=
pOp
->
nextResult
(
false
))
==
0
);
if
(
check
!=
-
1
){
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
NdbTransaction
::
Commit
);
pTrans
->
restart
();
}
...
...
ndb/tools/desc.cpp
View file @
3add897e
...
...
@@ -80,25 +80,28 @@ int main(int argc, char** argv){
Ndb_cluster_connection
con
(
opt_connect_str
);
if
(
con
.
connect
(
12
,
5
,
1
)
!=
0
)
{
ndbout
<<
"Unable to connect to management server."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
*
pMyNdb
=
new
Ndb
(
&
con
,
_dbname
);
pMyNdb
->
init
();
ndbout
<<
"Waiting..."
;
while
(
pMyNdb
->
waitUntilReady
()
!=
0
)
{
ndbout
<<
"..."
;
if
(
con
.
wait_until_ready
(
30
,
0
)
<
0
)
{
ndbout
<<
"Cluster nodes not ready in 30 seconds."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
ndbout
<<
endl
;
NdbDictionary
::
Dictionary
*
dict
=
pMyNdb
->
getDictionary
();
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
MyNdb
.
init
()
!=
0
){
ERR
(
MyNdb
.
getNdbError
());
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
const
NdbDictionary
::
Dictionary
*
dict
=
MyNdb
.
getDictionary
();
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
NDBT_Table
*
pTab
=
(
NDBT_Table
*
)
dict
->
getTable
(
argv
[
i
]);
if
(
pTab
!=
0
){
ndbout
<<
(
*
pTab
)
<<
endl
;
NdbDictionary
::
Dictionary
::
List
list
;
const
NdbDictionary
::
Dictionary
::
List
list
;
if
(
dict
->
listIndexes
(
list
,
argv
[
i
])
!=
0
){
ndbout
<<
argv
[
i
]
<<
": "
<<
dict
->
getNdbError
()
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
...
...
@@ -132,6 +135,5 @@ int main(int argc, char** argv){
ndbout
<<
argv
[
i
]
<<
": "
<<
dict
->
getNdbError
()
<<
endl
;
}
delete
pMyNdb
;
return
NDBT_ProgramExit
(
NDBT_OK
);
}
ndb/tools/drop_index.cpp
View file @
3add897e
...
...
@@ -83,16 +83,18 @@ int main(int argc, char** argv){
{
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
con
.
wait_until_ready
(
30
,
0
)
<
0
)
{
ndbout
<<
"Cluster nodes not ready in 30 seconds."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
MyNdb
.
init
()
!=
0
){
ERR
(
MyNdb
.
getNdbError
());
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
while
(
MyNdb
.
waitUntilReady
()
!=
0
)
ndbout
<<
"Waiting for ndb to become ready..."
<<
endl
;
int
res
=
0
;
for
(
int
i
=
0
;
i
<
argc
;
i
++
){
ndbout
<<
"Dropping index "
<<
argv
[
i
]
<<
"..."
;
...
...
ndb/tools/drop_tab.cpp
View file @
3add897e
...
...
@@ -81,18 +81,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection
con
(
opt_connect_str
);
if
(
con
.
connect
(
12
,
5
,
1
)
!=
0
)
{
ndbout
<<
"Unable to connect to management server."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
if
(
con
.
wait_until_ready
(
30
,
0
)
<
0
)
{
ndbout
<<
"Cluster nodes not ready in 30 seconds."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
MyNdb
(
&
con
,
_dbname
);
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
MyNdb
.
init
()
!=
0
){
ERR
(
MyNdb
.
getNdbError
());
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
while
(
MyNdb
.
waitUntilReady
()
!=
0
)
ndbout
<<
"Waiting for ndb to become ready..."
<<
endl
;
int
res
=
0
;
for
(
int
i
=
0
;
i
<
argc
;
i
++
){
ndbout
<<
"Dropping table "
<<
argv
[
i
]
<<
"..."
;
...
...
ndb/tools/listTables.cpp
View file @
3add897e
...
...
@@ -29,7 +29,7 @@
static
Ndb_cluster_connection
*
ndb_cluster_connection
=
0
;
static
Ndb
*
ndb
=
0
;
static
NdbDictionary
::
Dictionary
*
dic
=
0
;
static
NdbDictionary
::
Dictionary
*
dic
=
0
;
static
int
_unqualified
=
0
;
static
void
...
...
@@ -233,16 +233,19 @@ int main(int argc, char** argv){
ndb_cluster_connection
=
new
Ndb_cluster_connection
(
opt_connect_str
);
if
(
ndb_cluster_connection
->
connect
(
12
,
5
,
1
))
fatal
(
"unable to connect"
);
fatal
(
"Unable to connect to management server."
);
if
(
ndb_cluster_connection
->
wait_until_ready
(
30
,
0
)
<
0
)
fatal
(
"Cluster nodes not ready in 30 seconds."
);
ndb
=
new
Ndb
(
ndb_cluster_connection
,
_dbname
);
if
(
ndb
->
init
()
!=
0
)
fatal
(
"init"
);
if
(
ndb
->
waitUntilReady
(
30
)
<
0
)
fatal
(
"waitUntilReady"
);
dic
=
ndb
->
getDictionary
();
for
(
int
i
=
0
;
_loops
==
0
||
i
<
_loops
;
i
++
)
{
list
(
_tabname
,
(
NdbDictionary
::
Object
::
Type
)
_type
);
}
delete
ndb
;
delete
ndb_cluster_connection
;
return
NDBT_ProgramExit
(
NDBT_OK
);
}
...
...
ndb/tools/restore/consumer_restore.cpp
View file @
3add897e
...
...
@@ -375,7 +375,8 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
}
// Prepare transaction (the transaction is NOT yet sent to NDB)
cb
->
connection
->
executeAsynchPrepare
(
Commit
,
&
callback
,
cb
);
cb
->
connection
->
executeAsynchPrepare
(
NdbTransaction
::
Commit
,
&
callback
,
cb
);
m_transactions
++
;
return
;
}
...
...
@@ -543,7 +544,7 @@ BackupRestore::logEntry(const LogEntry & tup)
op
->
setValue
(
attr
->
Desc
->
attrId
,
dataPtr
,
length
);
}
const
int
ret
=
trans
->
execute
(
Commit
);
const
int
ret
=
trans
->
execute
(
NdbTransaction
::
Commit
);
if
(
ret
!=
0
)
{
// Both insert update and delete can fail during log running
...
...
@@ -654,7 +655,7 @@ BackupRestore::tuple(const TupleS & tup)
else
op->setValue(i, dataPtr, length);
}
int ret = trans->execute(Commit);
int ret = trans->execute(
NdbTransaction::
Commit);
if (ret != 0)
{
ndbout << "execute failed: ";
...
...
ndb/tools/select_all.cpp
View file @
3add897e
...
...
@@ -24,7 +24,6 @@
#include <NdbMain.h>
#include <NDBT.hpp>
#include <NdbSleep.h>
#include <NdbScanFilter.hpp>
int
scanReadRecords
(
Ndb
*
,
const
NdbDictionary
::
Table
*
,
...
...
@@ -127,19 +126,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection
con
(
opt_connect_str
);
if
(
con
.
connect
(
12
,
5
,
1
)
!=
0
)
{
ndbout
<<
"Unable to connect to management server."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
if
(
con
.
wait_until_ready
(
30
,
0
)
<
0
)
{
ndbout
<<
"Cluster nodes not ready in 30 seconds."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
MyNdb
(
&
con
,
_dbname
);
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
MyNdb
.
init
()
!=
0
){
ERR
(
MyNdb
.
getNdbError
());
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
// Connect to Ndb and wait for it to become ready
while
(
MyNdb
.
waitUntilReady
()
!=
0
)
ndbout
<<
"Waiting for ndb to become ready..."
<<
endl
;
// Check if table exists in db
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Table
::
discoverTableFromDb
(
&
MyNdb
,
_tabname
);
const
NdbDictionary
::
Index
*
pIdx
=
0
;
...
...
@@ -320,7 +321,7 @@ int scanReadRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
N
dbTransaction
::
N
oCommit
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
ndb/tools/select_count.cpp
View file @
3add897e
...
...
@@ -100,19 +100,21 @@ int main(int argc, char** argv){
Ndb_cluster_connection
con
(
opt_connect_str
);
if
(
con
.
connect
(
12
,
5
,
1
)
!=
0
)
{
ndbout
<<
"Unable to connect to management server."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
if
(
con
.
wait_until_ready
(
30
,
0
)
<
0
)
{
ndbout
<<
"Cluster nodes not ready in 30 seconds."
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
Ndb
MyNdb
(
&
con
,
_dbname
);
Ndb
MyNdb
(
&
con
,
_dbname
);
if
(
MyNdb
.
init
()
!=
0
){
ERR
(
MyNdb
.
getNdbError
());
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
// Connect to Ndb and wait for it to become ready
while
(
MyNdb
.
waitUntilReady
()
!=
0
)
ndbout
<<
"Waiting for ndb to become ready..."
<<
endl
;
for
(
int
i
=
0
;
i
<
argc
;
i
++
){
// Check if table exists in db
const
NdbDictionary
::
Table
*
pTab
=
NDBT_Table
::
discoverTableFromDb
(
&
MyNdb
,
argv
[
i
]);
...
...
@@ -189,7 +191,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
Uint32
row_size
;
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_COUNT
,
(
char
*
)
&
tmp
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_SIZE
,
(
char
*
)
&
row_size
);
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
N
dbTransaction
::
N
oCommit
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
...
...
sql/ha_ndbcluster.cc
View file @
3add897e
...
...
@@ -161,7 +161,9 @@ int execute_no_commit(ha_ndbcluster *h, NdbTransaction *trans)
if
(
m_batch_execute
)
return
0
;
#endif
return
trans
->
execute
(
NoCommit
,
AbortOnError
,
h
->
m_force_send
);
return
trans
->
execute
(
NdbTransaction
::
NoCommit
,
NdbTransaction
::
AbortOnError
,
h
->
m_force_send
);
}
inline
...
...
@@ -172,7 +174,9 @@ int execute_commit(ha_ndbcluster *h, NdbTransaction *trans)
if
(
m_batch_execute
)
return
0
;
#endif
return
trans
->
execute
(
Commit
,
AbortOnError
,
h
->
m_force_send
);
return
trans
->
execute
(
NdbTransaction
::
Commit
,
NdbTransaction
::
AbortOnError
,
h
->
m_force_send
);
}
inline
...
...
@@ -183,7 +187,9 @@ int execute_commit(THD *thd, NdbTransaction *trans)
if
(
m_batch_execute
)
return
0
;
#endif
return
trans
->
execute
(
Commit
,
AbortOnError
,
thd
->
variables
.
ndb_force_send
);
return
trans
->
execute
(
NdbTransaction
::
Commit
,
NdbTransaction
::
AbortOnError
,
thd
->
variables
.
ndb_force_send
);
}
inline
...
...
@@ -194,7 +200,9 @@ int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans)
if
(
m_batch_execute
)
return
0
;
#endif
return
trans
->
execute
(
NoCommit
,
AO_IgnoreError
,
h
->
m_force_send
);
return
trans
->
execute
(
NdbTransaction
::
NoCommit
,
NdbTransaction
::
AO_IgnoreError
,
h
->
m_force_send
);
}
/*
...
...
@@ -3345,7 +3353,7 @@ int ndbcluster_rollback(THD *thd, void *ndb_transaction)
"stmt"
:
"all"
));
DBUG_ASSERT
(
ndb
&&
trans
);
if
(
trans
->
execute
(
Rollback
)
!=
0
)
if
(
trans
->
execute
(
NdbTransaction
::
Rollback
)
!=
0
)
{
const
NdbError
err
=
trans
->
getNdbError
();
const
NdbOperation
*
error_op
=
trans
->
getNdbErrorOperation
();
...
...
@@ -4863,7 +4871,9 @@ ndb_get_table_statistics(Ndb* ndb, const char * table,
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_COUNT
,
(
char
*
)
&
rows
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
COMMIT_COUNT
,
(
char
*
)
&
commits
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
,
TRUE
);
check
=
pTrans
->
execute
(
NdbTransaction
::
NoCommit
,
NdbTransaction
::
AbortOnError
,
TRUE
);
if
(
check
==
-
1
)
break
;
...
...
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