| Bug #40528 | NdbDictionaryImpl::setNull(), incorrect checking of 'isNullable' | ||
|---|---|---|---|
| Submitted: | 5 Nov 2008 12:33 | Modified: | 17 Mar 2009 19:09 |
| Reporter: | Ole John Aske | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S3 (Non-critical) |
| Version: | 5.1.29-ndb-6.4.0 | OS: | Any |
| Assigned to: | Frazer Clement | CPU Architecture: | Any |
[7 Nov 2008 9:21]
Frazer Clement
Bug is in implementation of new code which probably has few users. The null bit in a record can be set by other means. Little effort to fix.
[12 Mar 2009 12:06]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/69030 2867 Frazer Clement 2009-03-12 Bug#40528 : NdbDictionaryImpl::setNull() incorrect setting of isNullable. modified: storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
[16 Mar 2009 19:51]
Frazer Clement
Pushed to 6.2.18, 6.3.24, 7.0.4
[17 Mar 2009 19:09]
Jon Stephens
No user-visible changes; closed without taking further action.

Description: Encountered during code reading: ------------------------------------------------ The checking below for 'IsNullable' looks like a bug to me. 'IsNullable' is defined as a part of the 'enum ColFlags' which is used as part of the 'struct Attr' definition - Not the NdbRecord::flags as used below: Furthermore, Why is the entire NdbRecord::Attr copied (NdbRecord::Attr attr= record->columns[attrIdIndex];) This is correct code, but not particularly efficient - I Assume what you really want is to get a pointer or referrence to the Attr object. int NdbDictionaryImpl::setNull(const NdbRecord* record, char* row, Uint32 attrId, bool value) { if (attrId < record->m_attrId_indexes_length) { int attrIdIndex= record->m_attrId_indexes[attrId]; if (attrIdIndex != -1) { assert(attrIdIndex < (int)record->noOfColumns); NdbRecord::Attr attr= record->columns[attrIdIndex]; if (record->flags & NdbRecord::IsNullable) // BUG? Replace with 'attr.flags' ? { if (value) *(row + attr.nullbit_byte_offset) |= (1 << attr.nullbit_bit_in_byte); else *(row + attr.nullbit_byte_offset) &= ~(1 << attr.nullbit_bit_in_byte); return 0; } } } /* AttrId not part of this NdbRecord or is not nullable */ return -1; } How to repeat: Read the code. Suggested fix: Replace 'record.flag' with 'attr.flags'. Also change 'attr' to be a referrence to a NdbRecord::Attr.