Bug #33552 ED_SESSION and ED_TEMPORARY documented but not available
Submitted: 28 Dec 2007 14:54 Modified: 7 Jan 2008 12:44
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:ndb-6.3.6, 5.1bk OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[28 Dec 2007 14:54] Hartmut Holzgraefe
Description:
http://dev.mysql.com/doc/ndbapi/en/class-event.html#class-event-eventdurability

lists four durability enum elements ED_UNDEFINED, ED_SESSION, ED_TEMPORARY and ED_PERMANENT, the enum definition in storage/ndb/include/ndbapi/NdbDictionary.hpp
also has all four entries, ED_SESSION and ED_TEMPORARY are commented out using 

  #if 0 // not supported

though

How to repeat:
I tried to implement a simple enum value to name resolution function like this:

  const char *durabilityName(NdbDictionary::Event::EventDurability d)
  {
    switch (d)
    {
    case NdbDictionary::Event::ED_UNDEFINED: return "undefined";
    case NdbDictionary::Event::ED_SESSION:   return "session";
    case NdbDictionary::Event::ED_TEMPORARY: return "temporary";
    case NdbDictionary::Event::ED_PERMANENT: return "permanent";
    default:           return "???";
    }
  }

based on the documentation but got the following compile errors:

  ndb_show_events.cc: In function ‘const char* durabilityName(NdbDictionary::Event::EventDurability)’:
  ndb_show_events.cc:106: error: ‘ED_SESSION’ is not a member of ‘NdbDictionary::Event’
  ndb_show_events.cc:107: error: ‘ED_TEMPORARY’ is not a member of ‘NdbDictionary::Event’

At first sight i even overlooked the '#if 0' when checking the header file so i wasted quite some time trying to figure out what was wrong

Suggested fix:
Do not disable enum values this way, have setDurability() check for valid / invalid values instead. Also document such not yet implemented values as such.
[28 Dec 2007 16:45] Hartmut Holzgraefe
Workaround: do not use the unused/undefined entries in application code, or protect use of these entries with configure tests
[7 Jan 2008 12:44] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

(NOTE: Per discussion with Hartmut and due to the fact that these values have never been available in NDB API apps, I've treated this as a Docs bug.)