20 #include <NDBT_Test.hpp>
32 for(
size_t i = 0;
i < attriblist.size();
i++){
51 ExecuteScanWithOutOpenScan,
53 OnlyOneOpBeforeOpenScan,
56 CheckInactivityTimeOut,
57 CheckInactivityBeforeClose ,
63 int scanReadFunctions(
Ndb* pNdb,
75 ScanFunctions::scanReadFunctions(
Ndb* pNdb,
81 const int retryMax = 100;
88 if (retryAttempt >= retryMax){
89 g_err <<
"ERROR: has retried this operation " << retryAttempt
90 <<
" times, failing!" << endl;
99 NdbSleep_MilliSleep(50);
124 if (action == OnlyOpenScanOnce){
126 if( pOp->
readTuples(NdbScanOperation::LM_Read) ) {
133 if (action==EqualAfterOpenScan){
150 check = pTrans->
execute(NoCommit);
157 int abortCount = records / 10;
158 bool abortTrans = (action==CloseWithoutStop);
166 if (abortCount == rows && abortTrans ==
true){
167 g_info <<
"Scan is aborted after "<<abortCount<<
" rows" << endl;
169 if (action != CloseWithoutStop){
184 if(action == CheckInactivityTimeOut){
185 if ((rows % (records / 10)) == 0){
189 g_info <<
"Sleeping "<<sleepTime<<
" secs " << endl;
190 NdbSleep_SecSleep(sleepTime);
203 for(
int i=0;
i<10;
i++){
206 g_err <<
"nextScanResult returned eof = " << eof << endl
207 <<
" That is an error when there are no more records" << endl;
214 NdbSleep_MilliSleep(50);
216 g_info <<
"Starting over" << endl;
220 if ((action == CheckInactivityTimeOut) &&
231 if (action == NextScanWhenNoMore){
232 g_info <<
"Calling nextScanresult when there are no more records" << endl;
233 for(
int i=0;
i<10;
i++){
236 g_err <<
"nextScanResult returned eof = " << eof << endl
237 <<
" That is an error when there are no more records" << endl;
243 if(action == CheckInactivityBeforeClose){
245 g_info <<
"NdbSleep_SecSleep(5) before close transaction" << endl;
246 NdbSleep_SecSleep(5);
248 if(action == NoCloseTransaction)
249 g_info <<
"Forgetting to close transaction" << endl;
253 g_info << rows <<
" rows have been read" << endl;
254 if (records != 0 && rows != records){
255 g_err <<
"Check expected number of records failed" << endl
256 <<
" expected=" << records <<
", " << endl
257 <<
" read=" << rows << endl;
277 attr->numAttribs = 0;
278 attriblist.push_back(attr);
282 attr->numAttribs =
i;
283 for(
int a = 0; a<
i; a++)
284 attr->attribs[a] = a;
285 attriblist.push_back(attr);
289 attr->numAttribs =
i;
290 for(
int a = 0; a<
i; a++)
291 attr->attribs[a] = a;
292 attriblist.push_back(attr);
299 attriblist.push_back(attr);
306 attriblist.push_back(attr);
310 attr->numAttribs = 2;
311 for(
int a = 0; a<2; a++){
314 attriblist.push_back(attr);
319 attr->numAttribs = 1;
321 attriblist.push_back(attr);
325 attr->numAttribs = 2;
327 attr->attribs[1] = 0;
328 attriblist.push_back(attr);
332 attr->numAttribs = 2;
333 attr->attribs[0] = 0;
335 attriblist.push_back(attr);
338 for(
size_t j = 0; j < attriblist.size(); j++){
340 g_info << attriblist[j]->numAttribs <<
": " ;
341 for(
int a = 0; a < attriblist[j]->numAttribs; a++)
342 g_info << attriblist[j]->attribs[a] <<
", ";