Skip to content

Commit 7b43e09

Browse files
author
Ole John Aske
committed
Bug #25702850 TOO LARGE RESULT SIZE REPORTED FROM TUP-BLOCK TO LQH
The pseudo_read instruction FLUSH_AI attrInfo is used to produce two TRANSID_AI result rows from the same row: One going to the SPJ block with keys for fuether lookups, and the other to the API containing the result row. The total length of both of these rows were reported in the TUPKEYCONF signal from TUP -> LQH. This could cause LQH to prematurely terminate scan batches as it believed that the total number of ScanBatch 'bytes' was about to be exhausted. This patch change this such that only the result row going to the API is reported as part of the 'read_length' being reported.
1 parent 05acac9 commit 7b43e09

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

mysql-test/suite/ndb/r/ndbinfo.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ tot_key_bytes_returned 4220
11981198
tot_frag_scans 56
11991199
tot_scan_rows_examined 306
12001200
tot_scan_rows_returned 215
1201-
tot_scan_bytes_returned 7116
1201+
tot_scan_bytes_returned 5564
12021202
tot_scan_prog_bytes 288
12031203
tot_scan_bound_bytes 0
12041204
tot_scan_inst_exec 305
@@ -1359,7 +1359,7 @@ new.log_tot_key_attrinfo_bytes - old.log_tot_key_attrinfo_bytes 2
13591359
new.tot_key_keyinfo_bytes - old.tot_key_keyinfo_bytes 20
13601360
new.tot_key_prog_bytes - old.tot_key_prog_bytes 168
13611361
new.tot_key_inst_exec - old.tot_key_inst_exec 7
1362-
new.tot_key_bytes_returned - old.tot_key_bytes_returned 88
1362+
new.tot_key_bytes_returned - old.tot_key_bytes_returned 56
13631363
new.tot_frag_scans - old.tot_frag_scans 0
13641364
new.tot_scan_rows_examined - old.tot_scan_rows_examined 0
13651365
new.tot_scan_rows_returned - old.tot_scan_rows_returned 0

storage/ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -206,6 +206,23 @@ void Dbtup::sendReadAttrinfo(Signal* signal,
206206
*/
207207
(nodeId == getOwnNodeId() && connectedToNode));
208208

209+
/**
210+
* If a previous read_pseudo executed a 'FLUSH_AI', we may
211+
* already have sent a TRANSID_AI signal with the result row
212+
* to the API node. The result size was then already recorded
213+
* in 'read_length' and we should not add the size of this
214+
* row as it is not part of the 'result' .
215+
*/
216+
if (req_struct->read_length != 0)
217+
{
218+
ndbassert(!is_api); // API result already FLUSH_AI'ed
219+
}
220+
else
221+
{
222+
// No API-result produced yet, record this
223+
req_struct->read_length = ToutBufIndex;
224+
}
225+
209226
if (connectedToNode){
210227
/**
211228
* Own node -> execute direct

storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,8 +1287,7 @@ int Dbtup::handleReadReq(Signal* signal,
12871287
// We have read all data into coutBuffer. Now send it to the API.
12881288
/* ------------------------------------------------------------------------- */
12891289
jam();
1290-
Uint32 TnoOfDataRead= (Uint32) ret;
1291-
req_struct->read_length += TnoOfDataRead;
1290+
const Uint32 TnoOfDataRead= (Uint32) ret;
12921291
sendReadAttrinfo(signal, req_struct, TnoOfDataRead);
12931292
return 0;
12941293
}
@@ -2861,7 +2860,6 @@ int Dbtup::interpreterStartLab(Signal* signal,
28612860
* This is used for ANYVALUE and interpreted delete.
28622861
*/
28632862
req_struct->log_size+= RlogSize;
2864-
req_struct->read_length += RattroutCounter;
28652863
sendReadAttrinfo(signal, req_struct, RattroutCounter);
28662864
if (RlogSize > 0) {
28672865
return sendLogAttrinfo(signal, req_struct, RlogSize, regOperPtr);

storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -2987,7 +2987,23 @@ Dbtup::flush_read_buffer(KeyReqStruct *req_struct,
29872987

29882988
req_struct->out_buf_index = 0; // Reset buffer
29892989
req_struct->out_buf_bits = 0;
2990-
req_struct->read_length += len;
2990+
2991+
const Uint32 type = getNodeInfo(destNode).m_type;
2992+
const bool is_api = (type >= NodeInfo::API && type <= NodeInfo::MGM);
2993+
2994+
/**
2995+
* flush_read_buffer() is used as part of a read_pseudo-FLUSH_AI.
2996+
* In these cases we are sending two TRANSID_AI results pr row:
2997+
* One goes to the API, the other to the SPJ node which (currently)
2998+
* is the only user of FLUSH_AI.
2999+
* 'read_length' is reported to LQH, which use it to control the
3000+
* 'batch_bytes_size' sent to the API. Thus, read_length should be
3001+
* counted when not 'is_api.
3002+
*/
3003+
if (is_api)
3004+
{
3005+
req_struct->read_length = len;
3006+
}
29913007
}
29923008

29933009
Uint32

0 commit comments

Comments
 (0)