Commit 3d3d366d authored by unknown's avatar unknown

bug#18040 - ndb online index build

parent d56ca9c7
...@@ -1319,13 +1319,11 @@ int ha_ndbcluster::drop_indexes(Ndb *ndb, TABLE *tab) ...@@ -1319,13 +1319,11 @@ int ha_ndbcluster::drop_indexes(Ndb *ndb, TABLE *tab)
int error= 0; int error= 0;
const char *index_name; const char *index_name;
KEY* key_info= tab->key_info; KEY* key_info= tab->key_info;
const char **key_name= tab->s->keynames.type_names;
NDBDICT *dict= ndb->getDictionary(); NDBDICT *dict= ndb->getDictionary();
DBUG_ENTER("ha_ndbcluster::drop_indexes"); DBUG_ENTER("ha_ndbcluster::drop_indexes");
for (i= 0; i < tab->s->keys; i++, key_info++, key_name++) for (i= 0; i < tab->s->keys; i++, key_info++)
{ {
index_name= *key_name;
NDB_INDEX_TYPE idx_type= get_index_type_from_table(i); NDB_INDEX_TYPE idx_type= get_index_type_from_table(i);
m_index[i].type= idx_type; m_index[i].type= idx_type;
if (m_index[i].status == TO_BE_DROPPED) if (m_index[i].status == TO_BE_DROPPED)
...@@ -1346,8 +1344,8 @@ int ha_ndbcluster::drop_indexes(Ndb *ndb, TABLE *tab) ...@@ -1346,8 +1344,8 @@ int ha_ndbcluster::drop_indexes(Ndb *ndb, TABLE *tab)
m_index[i].index= NULL; m_index[i].index= NULL;
if (!error && unique_index) if (!error && unique_index)
{ {
index_name= index->getName(); index_name= unique_index->getName();
DBUG_PRINT("info", ("Dropping index %u: %s", i, index_name)); DBUG_PRINT("info", ("Dropping unique index %u: %s", i, index_name));
// Drop unique index from ndb // Drop unique index from ndb
error= drop_ndb_index(index_name); error= drop_ndb_index(index_name);
} }
......
...@@ -1092,6 +1092,7 @@ Suma::execSUB_CREATE_REQ(Signal* signal) ...@@ -1092,6 +1092,7 @@ Suma::execSUB_CREATE_REQ(Signal* signal)
subPtr.p->m_table_ptrI = RNIL; subPtr.p->m_table_ptrI = RNIL;
subPtr.p->m_state = Subscription::DEFINED; subPtr.p->m_state = Subscription::DEFINED;
subPtr.p->n_subscribers = 0; subPtr.p->n_subscribers = 0;
subPtr.p->m_current_sync_ptrI = RNIL;
fprintf(stderr, "table %d options %x\n", subPtr.p->m_tableId, subPtr.p->m_options); fprintf(stderr, "table %d options %x\n", subPtr.p->m_tableId, subPtr.p->m_options);
DBUG_PRINT("info",("Added: key.m_subscriptionId: %u, key.m_subscriptionKey: %u", DBUG_PRINT("info",("Added: key.m_subscriptionId: %u, key.m_subscriptionKey: %u",
...@@ -1163,13 +1164,15 @@ Suma::execSUB_SYNC_REQ(Signal* signal) ...@@ -1163,13 +1164,15 @@ Suma::execSUB_SYNC_REQ(Signal* signal)
DBUG_PRINT("info",("c_syncPool size: %d free: %d", DBUG_PRINT("info",("c_syncPool size: %d free: %d",
c_syncPool.getSize(), c_syncPool.getSize(),
c_syncPool.getNoOfFree())); c_syncPool.getNoOfFree()));
new (syncPtr.p) Ptr<SyncRecord>;
syncPtr.p->m_senderRef = req->senderRef; syncPtr.p->m_senderRef = req->senderRef;
syncPtr.p->m_senderData = req->senderData; syncPtr.p->m_senderData = req->senderData;
syncPtr.p->m_subscriptionPtrI = subPtr.i; syncPtr.p->m_subscriptionPtrI = subPtr.i;
syncPtr.p->ptrI = syncPtr.i; syncPtr.p->ptrI = syncPtr.i;
syncPtr.p->m_error = 0; syncPtr.p->m_error = 0;
subPtr.p->m_current_sync_ptrI = syncPtr.i;
{ {
jam(); jam();
syncPtr.p->m_tableList.append(&subPtr.p->m_tableId, 1); syncPtr.p->m_tableList.append(&subPtr.p->m_tableId, 1);
...@@ -2059,7 +2062,7 @@ Suma::execSUB_SYNC_CONTINUE_CONF(Signal* signal){ ...@@ -2059,7 +2062,7 @@ Suma::execSUB_SYNC_CONTINUE_CONF(Signal* signal){
ndbrequire(c_subscriptions.find(subPtr, key)); ndbrequire(c_subscriptions.find(subPtr, key));
ScanFragNextReq * req = (ScanFragNextReq *)signal->getDataPtrSend(); ScanFragNextReq * req = (ScanFragNextReq *)signal->getDataPtrSend();
req->senderData = subPtr.i; req->senderData = subPtr.p->m_current_sync_ptrI;
req->closeFlag = 0; req->closeFlag = 0;
req->transId1 = 0; req->transId1 = 0;
req->transId2 = (SUMA << 20) + (getOwnNodeId() << 8); req->transId2 = (SUMA << 20) + (getOwnNodeId() << 8);
...@@ -2098,6 +2101,12 @@ Suma::SyncRecord::completeScan(Signal* signal, int error) ...@@ -2098,6 +2101,12 @@ Suma::SyncRecord::completeScan(Signal* signal, int error)
#endif #endif
release(); release();
Ptr<Subscription> subPtr;
suma.c_subscriptions.getPtr(subPtr, m_subscriptionPtrI);
ndbrequire(subPtr.p->m_current_sync_ptrI == ptrI);
subPtr.p->m_current_sync_ptrI = RNIL;
suma.c_syncPool.release(ptrI); suma.c_syncPool.release(ptrI);
DBUG_PRINT("info",("c_syncPool size: %d free: %d", DBUG_PRINT("info",("c_syncPool size: %d free: %d",
suma.c_syncPool.getSize(), suma.c_syncPool.getSize(),
......
...@@ -189,6 +189,7 @@ public: ...@@ -189,6 +189,7 @@ public:
*/ */
Uint32 m_tableId; Uint32 m_tableId;
Uint32 m_table_ptrI; Uint32 m_table_ptrI;
Uint32 m_current_sync_ptrI;
}; };
typedef Ptr<Subscription> SubscriptionPtr; typedef Ptr<Subscription> SubscriptionPtr;
...@@ -239,7 +240,8 @@ public: ...@@ -239,7 +240,8 @@ public:
suma.progError(line, cause, extra); suma.progError(line, cause, extra);
} }
union { Uint32 nextPool; Uint32 nextList; Uint32 prevList; Uint32 ptrI; }; Uint32 prevList; Uint32 ptrI;
union { Uint32 nextPool; Uint32 nextList; };
}; };
friend struct SyncRecord; friend struct SyncRecord;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment