Skip to content

Commit

Permalink
Merge pull request #571 from mronstro/RONDB-761
Browse files Browse the repository at this point in the history
RONDB-671: Fix of STR_TO_INT64 instruction
  • Loading branch information
mronstro authored Nov 15, 2024
2 parents 6784758 + a5f3504 commit bede2ae
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
#endif

//#define TRACE_INTERPRETER
//#define TRACE_INTERPRETER_REGISTERS

/* For debugging */
static void dump_hex(const Uint32 *p, Uint32 len) {
Expand Down Expand Up @@ -4034,6 +4035,10 @@ Dbtup::checkNullAttributes(KeyReqStruct * req_struct,
*
* XXX remove or fix
*/
g_eventLogger->info("changeMask: %s, tabMask: %s",
BaseString::getPrettyText(req_struct->changeMask).c_str(),
BaseString::getPrettyText(regTabPtr->notNullAttributeMask).c_str());

attributeMask.clear();
attributeMask.bitOR(req_struct->changeMask);
if (unlikely(is_refresh)) {
Expand Down Expand Up @@ -4585,6 +4590,34 @@ int Dbtup::interpreterNextLab(Signal* signal,
instance(), RnoOfInstructions, TprogramCounter,
Interpreter::getOpCode(theInstruction));
#endif

#ifdef TRACE_INTERPRETER_REGISTERS
g_eventLogger->info(
"REG0: %lld NULL: %u\n"
"REG1: %lld NULL: %u\n"
"REG2: %lld NULL: %u\n"
"REG3: %lld NULL: %u\n"
"REG4: %lld NULL: %u\n"
"REG5: %lld NULL: %u\n"
"REG6: %lld NULL: %u\n"
"REG7: %lld NULL: %u\n",
*(Int64*)(TregMemBuffer + 2),
TregMemBuffer[0],
*(Int64*)(TregMemBuffer + 6),
TregMemBuffer[4],
*(Int64*)(TregMemBuffer + 10),
TregMemBuffer[8],
*(Int64*)(TregMemBuffer + 14),
TregMemBuffer[12],
*(Int64*)(TregMemBuffer + 18),
TregMemBuffer[16],
*(Int64*)(TregMemBuffer + 22),
TregMemBuffer[20],
*(Int64*)(TregMemBuffer + 26),
TregMemBuffer[24],
*(Int64*)(TregMemBuffer + 30),
TregMemBuffer[28]);
#endif
if (TprogramCounter < TcurrentSize) {
TprogramCounter++;
Uint32 opCode = Interpreter::getOpCode(theInstruction);
Expand Down Expand Up @@ -5546,10 +5579,19 @@ int Dbtup::interpreterNextLab(Signal* signal,
return TUPKEY_abort(req_struct, ZMEMORY_OFFSET_ERROR);
}
{
char local_heap[MAX_LONG_LONG_STRING + 1];
char *memory_start = &TheapMemoryChar[memoryOffset];
char *memory_end = memory_start + size;
memcpy(&local_heap[0], memory_start, size);
char *memory_end = &local_heap[size];
/**
* The byte after the array is uninitialised at this point, set it
* to 0 to avoid going into undefined territory.
* We use a local array to avoid writing into the heap in
* area possibly used by someone else.
*/
memory_end[0] = 0;
char *end_ptr = nullptr;
Int64 val = strtoll(memory_start,
Int64 val = strtoll(&local_heap[0],
&end_ptr,
10);
if (unlikely(errno == ERANGE || end_ptr != memory_end)) {
Expand Down

0 comments on commit bede2ae

Please sign in to comment.