MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:pekka Date:March 6 2006 10:15am
Subject:bk commit into 5.1 tree (pekka:1.2145) BUG#17761
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2145 06/03/06 11:15:23 pekka@stripped +6 -0
  ndb - bug#17761 blob tables patch 3b [closes the bug]

  storage/ndb/src/ndbapi/ndberror.c
    1.52 06/03/06 11:13:55 pekka@stripped +3 -2
    allow NDB API programs direct access to blob tables via main table or by name (hack)

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
    1.54 06/03/06 11:13:55 pekka@stripped +25 -7
    allow NDB API programs direct access to blob tables via main table or by name (hack)

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.114 06/03/06 11:13:55 pekka@stripped +40 -5
    allow NDB API programs direct access to blob tables via main table or by name (hack)

  storage/ndb/src/ndbapi/NdbDictionary.cpp
    1.54 06/03/06 11:13:55 pekka@stripped +19 -0
    allow NDB API programs direct access to blob tables via main table or by name (hack)

  storage/ndb/include/ndbapi/NdbDictionary.hpp
    1.71 06/03/06 11:13:55 pekka@stripped +6 -0
    allow NDB API programs direct access to blob tables via main table or by name (hack)

  storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp
    1.13 06/03/06 11:11:15 pekka@stripped +2 -2
    oops (but did not affect previous patch)

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	pekka
# Host:	orca.ndb.mysql.com
# Root:	/space/pekka/ndb/version/my51-dict

--- 1.70/storage/ndb/include/ndbapi/NdbDictionary.hpp	2006-02-25 19:35:09 +01:00
+++ 1.71/storage/ndb/include/ndbapi/NdbDictionary.hpp	2006-03-06 11:13:55 +01:00
@@ -1602,6 +1602,12 @@
     const Table * getTable(const char * name) const;
 
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+    /**
+     * Given main table, get blob table.
+     */
+    const Table * getBlobTable(const Table *, const char * col_name);
+    const Table * getBlobTable(const Table *, Uint32 col_no);
+
     /*
      * Save a table definition in dictionary cache
      * @param table Object to put into cache

--- 1.12/storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp	2006-03-05 22:36:15 +01:00
+++ 1.13/storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp	2006-03-06 11:11:15 +01:00
@@ -274,13 +274,13 @@
   s += strlen(prefix);
   uint i, n;
   for (i = 0, n = 0; '0' <= s[i] && s[i] <= '9'; i++)
-    n += 10 * n + (s[i] - '0');
+    n = 10 * n + (s[i] - '0');
   if (i == 0 || s[i] != '_')
     return false;
   const uint tab_id = n;
   s = &s[i + 1];
   for (i = 0, n = 0; '0' <= s[i] && s[i] <= '9'; i++)
-    n += 10 * n + (s[i] - '0');
+    n = 10 * n + (s[i] - '0');
   if (i == 0 || s[i] != 0)
     return false;
   const uint col_no = n;

--- 1.53/storage/ndb/src/ndbapi/NdbDictionary.cpp	2006-02-21 13:50:11 +01:00
+++ 1.54/storage/ndb/src/ndbapi/NdbDictionary.cpp	2006-03-06 11:13:55 +01:00
@@ -1367,6 +1367,25 @@
   return getTable(name, 0);
 }
 
+const NdbDictionary::Table *
+NdbDictionary::Dictionary::getBlobTable(const NdbDictionary::Table* table,
+                                        const char* col_name)
+{
+  const NdbDictionary::Column* col = table->getColumn(col_name);
+  if (col == NULL) {
+    m_impl.m_error.code = 4318;
+    return NULL;
+  }
+  return getBlobTable(table, col->getColumnNo());
+}
+
+const NdbDictionary::Table *
+NdbDictionary::Dictionary::getBlobTable(const NdbDictionary::Table* table,
+                                        Uint32 col_no)
+{
+  return m_impl.getBlobTable(NdbTableImpl::getImpl(*table), col_no);
+}
+
 void
 NdbDictionary::Dictionary::invalidateTable(const char * name){
   DBUG_ENTER("NdbDictionaryImpl::invalidateTable");

--- 1.113/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-03-05 22:46:18 +01:00
+++ 1.114/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-03-06 11:13:55 +01:00
@@ -50,9 +50,9 @@
 extern Uint64 g_latest_trans_gci;
 
 bool
-is_ndb_blob_table(const char* name)
+is_ndb_blob_table(const char* name, Uint32* ptab_id, Uint32* pcol_no)
 {
-  return DictTabInfo::isBlobTableName(name);
+  return DictTabInfo::isBlobTableName(name, ptab_id, pcol_no);
 }
 
 bool
@@ -1383,6 +1383,43 @@
   DBUG_RETURN(0); 
 }
 
+NdbTableImpl*
+NdbDictionaryImpl::getBlobTable(const NdbTableImpl& tab, uint col_no)
+{
+  if (col_no < tab.m_columns.size()) {
+    NdbColumnImpl* col = tab.m_columns[col_no];
+    if (col != NULL) {
+      NdbTableImpl* bt = col->m_blobTable;
+      if (bt != NULL)
+        return bt;
+      else
+        m_error.code = 4273; // No blob table..
+    } else
+      m_error.code = 4249; // Invalid table..
+  } else
+    m_error.code = 4318; // Invalid attribute..
+  return NULL;
+}
+
+NdbTableImpl*
+NdbDictionaryImpl::getBlobTable(uint tab_id, uint col_no)
+{
+  DBUG_ENTER("NdbDictionaryImpl::getBlobTable");
+  DBUG_PRINT("enter", ("tab_id: %u col_no %u", tab_id, col_no));
+
+  NdbTableImpl* tab = m_receiver.getTable(tab_id,
+                                          m_ndb.usingFullyQualifiedNames());
+  if (tab == NULL)
+    DBUG_RETURN(NULL);
+  Ndb_local_table_info* info =
+    get_local_table_info(tab->m_internalName);
+  delete tab;
+  if (info == NULL)
+    DBUG_RETURN(NULL);
+  NdbTableImpl* bt = getBlobTable(*info->m_table_impl, col_no);
+  DBUG_RETURN(bt);
+}
+
 #if 0
 bool
 NdbDictionaryImpl::setTransporter(class TransporterFacade * tf)
@@ -1697,7 +1734,7 @@
   }
   DBUG_RETURN(-1);
 }
-#if 0
+
 /*
   Get dictionary information for a table using table id as reference
 
@@ -1721,8 +1758,6 @@
 
   return getTable(&tSignal, 0, 0, fullyQualifiedNames);
 }
-#endif
-
 
 /*
   Get dictionary information for a table using table name as the reference

--- 1.53/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-03-05 22:46:18 +01:00
+++ 1.54/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-03-06 11:13:55 +01:00
@@ -30,8 +30,10 @@
 #include "NdbWaiter.hpp"
 #include "DictCache.hpp"
 
-bool is_ndb_blob_table(const char* name);
-bool is_ndb_blob_table(const class NdbTableImpl* t);
+bool
+is_ndb_blob_table(const char* name, Uint32* ptab_id = 0, Uint32* pcol_no = 0);
+bool
+is_ndb_blob_table(const class NdbTableImpl* t);
 
 class NdbDictObjectImpl {
 public:
@@ -440,7 +442,7 @@
   int listObjects(NdbDictionary::Dictionary::List& list, Uint32 requestData, bool fullyQualifiedNames);
   int listObjects(NdbApiSignal* signal);
   
-/*  NdbTableImpl * getTable(int tableId, bool fullyQualifiedNames); */
+  NdbTableImpl * getTable(int tableId, bool fullyQualifiedNames);
   NdbTableImpl * getTable(const BaseString& name, bool fullyQualifiedNames);
   NdbTableImpl * getTable(class NdbApiSignal * signal, 
 			  LinearSectionPtr ptr[3],
@@ -574,6 +576,8 @@
   int listIndexes(List& list, Uint32 indexId);
 
   NdbTableImpl * getTable(const char * tableName, void **data= 0);
+  NdbTableImpl * getBlobTable(const NdbTableImpl&, uint col_no);
+  NdbTableImpl * getBlobTable(uint tab_id, uint col_no);
   void putTable(NdbTableImpl *impl);
   int getBlobTables(NdbTableImpl &);
   Ndb_local_table_info*
@@ -849,28 +853,42 @@
 NdbTableImpl *
 NdbDictionaryImpl::getTable(const char * table_name, void **data)
 {
+  DBUG_ENTER("NdbDictionaryImpl::getTable");
+  DBUG_PRINT("enter", ("table: %s", table_name));
+
+  if (unlikely(strchr(table_name, '$') != 0)) {
+    Uint32 tab_id, col_no;
+    if (is_ndb_blob_table(table_name, &tab_id, &col_no)) {
+      NdbTableImpl* t = getBlobTable(tab_id, col_no);
+      DBUG_RETURN(t);
+    }
+  }
+
   const BaseString internal_tabname(m_ndb.internalize_table_name(table_name));
   Ndb_local_table_info *info=
     get_local_table_info(internal_tabname);
   if (info == 0)
-    return 0;
+    DBUG_RETURN(0);
   if (data)
     *data= info->m_local_data;
-  return info->m_table_impl;
+  DBUG_RETURN(info->m_table_impl);
 }
 
 inline
 Ndb_local_table_info * 
 NdbDictionaryImpl::get_local_table_info(const BaseString& internalTableName)
 {
+  DBUG_ENTER("NdbDictionaryImpl::get_local_table_info");
+  DBUG_PRINT("enter", ("table: %s", internalTableName.c_str()));
+
   Ndb_local_table_info *info= m_localHash.get(internalTableName.c_str());
   if (info == 0) {
     info= fetchGlobalTableImpl(internalTableName);
     if (info == 0) {
-      return 0;
+      DBUG_RETURN(0);
     }
   }
-  return info; // autoincrement already initialized
+  DBUG_RETURN(info); // autoincrement already initialized
 }
 
 inline

--- 1.51/storage/ndb/src/ndbapi/ndberror.c	2006-02-28 17:00:31 +01:00
+++ 1.52/storage/ndb/src/ndbapi/ndberror.c	2006-03-06 11:13:55 +01:00
@@ -506,7 +506,7 @@
   { 4315, DMEC, AE, "No more key attributes allowed after defining variable length key attribute" },
   { 4316, DMEC, AE, "Key attributes are not allowed to be NULL attributes" },
   { 4317, DMEC, AE, "Too many primary keys defined in table" },
-  { 4318, DMEC, AE, "Invalid attribute name" },
+  { 4318, DMEC, AE, "Invalid attribute name or number" },
   { 4319, DMEC, AE, "createAttribute called at erroneus place" },
   { 4322, DMEC, AE, "Attempt to define distribution key when not prepared to" },
   { 4323, DMEC, AE, "Distribution Key set on table but not defined on first attribute" },
@@ -598,7 +598,8 @@
   { 4335, DMEC, AE, "Only one autoincrement column allowed per table. Having a table without primary key uses an autoincremented hidden key, i.e. a table without a primary key can not have an autoincremented column" },
   { 4336, DMEC, AE, "Auto-increment value set below current value" },
   { 4271, DMEC, AE, "Invalid index object, not retrieved via getIndex()" },
-  { 4272, DMEC, AE, "Table definition has undefined column" }
+  { 4272, DMEC, AE, "Table definition has undefined column" },
+  { 4273, DMEC, IE, "No blob table in dict cache" }
 };
 
 static
Thread
bk commit into 5.1 tree (pekka:1.2145) BUG#17761pekka6 Mar