Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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@stripped, 2007-06-11 17:51:40+02:00, tomas@stripped +9 -0
WL#3920 - ndb_restore reporting
storage/ndb/config/type_ndbapitools.mk.am@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +3 -1
WL#3920 - ndb_restore reporting
storage/ndb/include/mgmapi/ndb_logevent.h@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +37 -1
WL#3920 - ndb_restore reporting
storage/ndb/src/common/debugger/EventLogger.cpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +32 -1
WL#3920 - ndb_restore reporting
storage/ndb/src/mgmapi/ndb_logevent.cpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +22 -0
WL#3920 - ndb_restore reporting
storage/ndb/src/ndbapi/ndb_internal.hpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +1 -0
WL#3920 - ndb_restore reporting
storage/ndb/tools/restore/consumer.hpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +7 -0
WL#3920 - ndb_restore reporting
storage/ndb/tools/restore/consumer_restore.cpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +79 -0
WL#3920 - ndb_restore reporting
storage/ndb/tools/restore/consumer_restore.hpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +21 -0
WL#3920 - ndb_restore reporting
storage/ndb/tools/restore/restore_main.cpp@stripped, 2007-06-11 17:51:37+02:00, tomas@stripped +22 -1
WL#3920 - ndb_restore reporting
# 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: tomas
# Host: whalegate.ndb.mysql.com
# Root: /home/tomas/mysql-5.1-telco
--- 1.47/storage/ndb/src/common/debugger/EventLogger.cpp 2007-05-21 11:03:16 +02:00
+++ 1.48/storage/ndb/src/common/debugger/EventLogger.cpp 2007-06-11 17:51:37 +02:00
@@ -844,6 +844,34 @@
refToNode(theData[1]),
theData[3]);
}
+void getTextRestoreMetaData(QQQQ)
+{
+ BaseString::snprintf(m_text, m_text_len,
+ "Restore meta data: backup %u from node %u "
+ "#Tables: %u\n"
+ " #Tablespaces: %u #Logfilegroups %u "
+ "#datafiles: %u #undofiles: %u",
+ theData[1], theData[2], theData[3],
+ theData[4], theData[5], theData[6], theData[7]);
+}
+void getTextRestoreData(QQQQ)
+{
+ BaseString::snprintf(m_text, m_text_len,
+ "Restore data: backup %u from node %u "
+ "#Records: %llu Data: %llu bytes",
+ theData[1], theData[2],
+ make_uint64(theData[3], theData[4]),
+ make_uint64(theData[5], theData[6]));
+}
+void getTextRestoreLog(QQQQ)
+{
+ BaseString::snprintf(m_text, m_text_len,
+ "Restore log: backup %u from node %u "
+ "#Records: %llu Data: %llu bytes",
+ theData[1], theData[2],
+ make_uint64(theData[3], theData[4]),
+ make_uint64(theData[5], theData[6]));
+}
void getTextSingleUser(QQQQ) {
switch (theData[1])
@@ -1045,7 +1073,10 @@
ROW(BackupStatus, LogLevel::llBackup, 7, Logger::LL_INFO ),
ROW(BackupCompleted, LogLevel::llBackup, 7, Logger::LL_INFO ),
ROW(BackupFailedToStart, LogLevel::llBackup, 7, Logger::LL_ALERT),
- ROW(BackupAborted, LogLevel::llBackup, 7, Logger::LL_ALERT )
+ ROW(BackupAborted, LogLevel::llBackup, 7, Logger::LL_ALERT),
+ ROW(RestoreMetaData, LogLevel::llBackup, 7, Logger::LL_INFO ),
+ ROW(RestoreData, LogLevel::llBackup, 7, Logger::LL_INFO ),
+ ROW(RestoreLog, LogLevel::llBackup, 7, Logger::LL_INFO )
};
const Uint32 EventLoggerBase::matrixSize=
--- 1.60/storage/ndb/tools/restore/restore_main.cpp 2007-05-19 22:35:27 +02:00
+++ 1.61/storage/ndb/tools/restore/restore_main.cpp 2007-06-11 17:51:37 +02:00
@@ -870,6 +870,11 @@
err << "Restore: Failed while closing tables" << endl;
exitHandler(NDBT_FAILED);
}
+ /* report to clusterlog if applicable */
+ for(i= 0; i < g_consumers.size(); i++)
+ {
+ g_consumers[i]->report_meta_data(ga_backupId, ga_nodeId);
+ }
debug << "Iterate over data" << endl;
if (ga_restore || ga_print)
{
@@ -942,6 +947,12 @@
for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfTuples();
+
+ /* report to clusterlog if applicable */
+ for(i= 0; i < g_consumers.size(); i++)
+ {
+ g_consumers[i]->report_data(ga_backupId, ga_nodeId);
+ }
}
if(_restore_data || _print_log)
@@ -975,6 +986,12 @@
logIter.validateFooter(); //not implemented
for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfLogEntrys();
+
+ /* report to clusterlog if applicable */
+ for(i= 0; i < g_consumers.size(); i++)
+ {
+ g_consumers[i]->report_log(ga_backupId, ga_nodeId);
+ }
}
if(_restore_data)
@@ -1005,7 +1022,8 @@
}
}
- for(Uint32 j= 0; j < g_consumers.size(); j++)
+ unsigned j;
+ for(j= 0; j < g_consumers.size(); j++)
{
if (g_consumers[j]->has_temp_error())
{
@@ -1027,6 +1045,9 @@
table_output[i] = NULL;
}
}
+
+ for (j = 0; j < g_consumers.size(); j++)
+ g_consumers[j]->report_done();
if (opt_verbose)
return NDBT_ProgramExit(NDBT_OK);
--- 1.15/storage/ndb/tools/restore/consumer.hpp 2007-02-15 09:27:16 +01:00
+++ 1.16/storage/ndb/tools/restore/consumer.hpp 2007-06-11 17:51:37 +02:00
@@ -38,6 +38,13 @@
virtual bool finalize_table(const TableS &){return true;}
virtual bool createSystable(const TableS &){ return true;}
virtual bool update_apply_status(const RestoreMetaData &metaData){return true;}
+ virtual bool report_meta_data(unsigned backup_id, unsigned node_id)
+ {return true;}
+ virtual bool report_data(unsigned backup_id, unsigned node_id)
+ {return true;}
+ virtual bool report_log(unsigned backup_id, unsigned node_id)
+ {return true;}
+ virtual bool report_done(){return true;}
NODE_GROUP_MAP *m_nodegroup_map;
uint m_nodegroup_map_len;
virtual bool has_temp_error() {return false;}
--- 1.50/storage/ndb/tools/restore/consumer_restore.cpp 2007-05-19 22:35:26 +02:00
+++ 1.51/storage/ndb/tools/restore/consumer_restore.cpp 2007-06-11 17:51:37 +02:00
@@ -18,6 +18,9 @@
#include <my_sys.h>
#include <NdbSleep.h>
+#include <ndb_internal.hpp>
+#include <ndb_logevent.h>
+
extern my_bool opt_core;
extern FilteredNdbOut err;
@@ -503,6 +506,7 @@
debug << "Retreived tablespace: " << currptr->getName()
<< " oldid: " << id << " newid: " << currptr->getObjectId()
<< " " << (void*)currptr << endl;
+ m_n_tablespace++;
return true;
}
@@ -543,6 +547,7 @@
debug << "Retreived logfile group: " << currptr->getName()
<< " oldid: " << id << " newid: " << currptr->getObjectId()
<< " " << (void*)currptr << endl;
+ m_n_logfilegroup++;
return true;
}
@@ -573,6 +578,7 @@
return false;
}
info << "done" << endl;
+ m_n_datafile++;
}
return true;
break;
@@ -599,6 +605,7 @@
return false;
}
info << "done" << endl;
+ m_n_undofile++;
}
return true;
break;
@@ -703,6 +710,66 @@
}
bool
+BackupRestore::report_meta_data(unsigned backup_id, unsigned node_id)
+{
+ if (m_ndb)
+ {
+ Uint32 data[8];
+ data[0]= NDB_LE_RestoreMetaData;
+ data[1]= backup_id;
+ data[2]= node_id;
+ data[3]= m_n_tables;
+ data[4]= m_n_tablespace;
+ data[5]= m_n_logfilegroup;
+ data[6]= m_n_datafile;
+ data[7]= m_n_undofile;
+ Ndb_internal().send_event_report(m_ndb, data, 8);
+ }
+ return true;
+}
+bool
+BackupRestore::report_data(unsigned backup_id, unsigned node_id)
+{
+ if (m_ndb)
+ {
+ Uint32 data[7];
+ data[0]= NDB_LE_RestoreData;
+ data[1]= backup_id;
+ data[2]= node_id;
+ data[3]= m_dataCount & 0xFFFFFFFF;
+ data[4]= 0;
+ data[5]= m_dataBytes & 0xFFFFFFFF;
+ data[6]= (m_dataBytes >> 32) & 0xFFFFFFFF;
+ Ndb_internal().send_event_report(m_ndb, data, 7);
+ }
+ return true;
+}
+
+bool
+BackupRestore::report_log(unsigned backup_id, unsigned node_id)
+{
+ if (m_ndb)
+ {
+ Uint32 data[7];
+ data[0]= NDB_LE_RestoreLog;
+ data[1]= backup_id;
+ data[2]= node_id;
+ data[3]= m_logCount & 0xFFFFFFFF;
+ data[4]= 0;
+ data[5]= m_logBytes & 0xFFFFFFFF;
+ data[6]= (m_logBytes >> 32) & 0xFFFFFFFF;
+ Ndb_internal().send_event_report(m_ndb, data, 7);
+ }
+ return true;
+}
+
+bool
+BackupRestore::report_done()
+{
+ return true;
+}
+
+bool
BackupRestore::table_equal(const TableS &tableS)
{
if (!m_restore)
@@ -987,6 +1054,9 @@
const NdbDictionary::Table* null = 0;
m_new_tables.fill(table.m_dictTable->getTableId(), null);
m_new_tables[table.m_dictTable->getTableId()] = tab;
+
+ m_n_tables++;
+
return true;
}
@@ -1083,6 +1153,7 @@
void BackupRestore::tuple_a(restore_callback_t *cb)
{
Uint32 partition_id = cb->fragId;
+ Uint32 n_bytes;
while (cb->retries < 10)
{
/**
@@ -1121,6 +1192,8 @@
exitHandler();
} // if
+ n_bytes= 0;
+
if (table->getFragmentType() == NdbDictionary::Object::UserDefined)
{
if (table->getDefaultNoPartitionsFlag())
@@ -1196,6 +1269,7 @@
size, arraySize, length);
break;
}
+ n_bytes+= length;
}
if (ret < 0)
break;
@@ -1209,6 +1283,7 @@
}
// Prepare transaction (the transaction is NOT yet sent to NDB)
+ cb->n_bytes= n_bytes;
cb->connection->executeAsynchPrepare(NdbTransaction::Commit,
&callback, cb);
m_transactions++;
@@ -1246,6 +1321,7 @@
cb->connection= 0;
cb->next= m_free_callback;
m_free_callback= cb;
+ m_dataBytes+= cb->n_bytes;
m_dataCount++;
}
}
@@ -1423,6 +1499,7 @@
}
Bitmask<4096> keys;
+ Uint32 n_bytes= 0;
for (Uint32 i= 0; i < tup.size(); i++)
{
const AttributeS * attr = tup[i];
@@ -1434,6 +1511,7 @@
tup.m_table->update_max_auto_val(dataPtr,size*arraySize);
const Uint32 length = (size / 8) * arraySize;
+ n_bytes+= length;
if (attr->Desc->m_column->getPrimaryKey())
{
if(!keys.get(attr->Desc->attrId))
@@ -1482,6 +1560,7 @@
}
m_ndb->closeTransaction(trans);
+ m_logBytes+= n_bytes;
m_logCount++;
}
--- 1.18/storage/ndb/tools/restore/consumer_restore.hpp 2007-04-24 03:45:13 +02:00
+++ 1.19/storage/ndb/tools/restore/consumer_restore.hpp 2007-06-11 17:51:37 +02:00
@@ -27,6 +27,7 @@
int retries;
int error_code;
Uint32 fragId;
+ Uint32 n_bytes;
restore_callback_t *next;
};
@@ -42,6 +43,12 @@
m_cluster_connection = 0;
m_nodegroup_map = ng_map;
m_nodegroup_map_len = ng_map_len;
+ m_n_tablespace = 0;
+ m_n_logfilegroup = 0;
+ m_n_datafile = 0;
+ m_n_undofile = 0;
+ m_n_tables = 0;
+ m_logBytes = m_dataBytes = 0;
m_logCount = m_dataCount = 0;
m_restore = false;
m_restore_meta = false;
@@ -76,6 +83,10 @@
virtual bool createSystable(const TableS & table);
virtual bool table_equal(const TableS & table);
virtual bool update_apply_status(const RestoreMetaData &metaData);
+ virtual bool report_meta_data(unsigned node_id, unsigned backup_id);
+ virtual bool report_data(unsigned node_id, unsigned backup_id);
+ virtual bool report_log(unsigned node_id, unsigned backup_id);
+ virtual bool report_done();
void connectToMysql();
bool map_in_frm(char *new_data, const char *data,
uint data_len, uint *new_data_len);
@@ -93,6 +104,16 @@
bool m_no_restore_disk;
bool m_restore_epoch;
bool m_no_upgrade; // for upgrade ArrayType from 5.0 backup file.
+
+ Uint32 m_n_tablespace;
+ Uint32 m_n_logfilegroup;
+ Uint32 m_n_datafile;
+ Uint32 m_n_undofile;
+ Uint32 m_n_tables;
+
+ Uint64 m_logBytes;
+ Uint64 m_dataBytes;
+
Uint32 m_logCount;
Uint32 m_dataCount;
--- 1.15/storage/ndb/config/type_ndbapitools.mk.am 2006-12-31 01:06:41 +01:00
+++ 1.16/storage/ndb/config/type_ndbapitools.mk.am 2007-06-11 17:51:37 +02:00
@@ -29,4 +29,6 @@
-I$(top_srcdir)/storage/ndb/include/portlib \
-I$(top_srcdir)/storage/ndb/test/include \
-I$(top_srcdir)/storage/ndb/include/mgmapi \
- -I$(top_srcdir)/storage/ndb/include/kernel
+ -I$(top_srcdir)/storage/ndb/include/kernel \
+ -I$(top_srcdir)/storage/ndb/src/ndbapi \
+ -I$(top_srcdir)/storage/ndb/include/debugger
--- 1.10/storage/ndb/include/mgmapi/ndb_logevent.h 2007-05-21 11:03:16 +02:00
+++ 1.11/storage/ndb/include/mgmapi/ndb_logevent.h 2007-06-11 17:51:37 +02:00
@@ -168,6 +168,12 @@
NDB_LE_BackupCompleted = 56,
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
NDB_LE_BackupAborted = 57,
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_RestoreMetaData = 63,
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_RestoreData = 64,
+ /** NDB_MGM_EVENT_CATEGORY_BACKUP */
+ NDB_LE_RestoreLog = 65,
/** NDB_MGM_EVENT_CATEGORY_INFO */
NDB_LE_EventBufferStatus = 58,
@@ -179,7 +185,9 @@
/* 61 unused */
/* 62 used */
- /* 63 unused */
+ /* 63 used */
+ /* 64 used */
+ /* 65 unused */
};
@@ -654,6 +662,34 @@
unsigned backup_id;
unsigned error;
} BackupAborted;
+ /** Log event data @ref NDB_LE_RestoreMetaData */
+ struct {
+ unsigned backup_id;
+ unsigned node_id;
+ unsigned n_tables;
+ unsigned n_tablespaces;
+ unsigned n_logfilegroups;
+ unsigned n_datafiles;
+ unsigned n_undofiles;
+ } RestoreMetaData;
+ /** Log event data @ref NDB_LE_RestoreData */
+ struct {
+ unsigned backup_id;
+ unsigned node_id;
+ unsigned n_records_lo;
+ unsigned n_records_hi;
+ unsigned n_bytes_lo;
+ unsigned n_bytes_hi;
+ } RestoreData;
+ /** Log event data @ref NDB_LE_RestoreLog */
+ struct {
+ unsigned backup_id;
+ unsigned node_id;
+ unsigned n_records_lo;
+ unsigned n_records_hi;
+ unsigned n_bytes_lo;
+ unsigned n_bytes_hi;
+ } RestoreLog;
/** Log event data @ref NDB_LE_SingleUser */
struct {
unsigned type;
--- 1.13/storage/ndb/src/mgmapi/ndb_logevent.cpp 2007-05-21 11:03:16 +02:00
+++ 1.14/storage/ndb/src/mgmapi/ndb_logevent.cpp 2007-06-11 17:51:37 +02:00
@@ -328,6 +328,28 @@
ROW( BackupAborted, "backup_id", 2, backup_id),
ROW( BackupAborted, "error", 3, error),
+ ROW( RestoreMetaData, "backup_id", 1, backup_id),
+ ROW( RestoreMetaData, "node_id", 2, node_id),
+ ROW( RestoreMetaData, "n_tables", 3, n_tables),
+ ROW( RestoreMetaData, "n_tablespaces", 4, n_tablespaces),
+ ROW( RestoreMetaData, "n_logfilegroups", 5, n_logfilegroups),
+ ROW( RestoreMetaData, "n_datafiles", 6, n_datafiles),
+ ROW( RestoreMetaData, "n_undofiles", 7, n_undofiles),
+
+ ROW( RestoreData, "backup_id", 1, backup_id),
+ ROW( RestoreData, "node_id", 2, node_id),
+ ROW( RestoreData, "n_records_lo", 3, n_records_lo),
+ ROW( RestoreData, "n_records_hi", 4, n_records_hi),
+ ROW( RestoreData, "n_bytes_lo", 5, n_bytes_lo),
+ ROW( RestoreData, "n_bytes_hi", 6, n_bytes_hi),
+
+ ROW( RestoreLog, "backup_id", 1, backup_id),
+ ROW( RestoreLog, "node_id", 2, node_id),
+ ROW( RestoreLog, "n_records_lo", 3, n_records_lo),
+ ROW( RestoreLog, "n_records_hi", 4, n_records_hi),
+ ROW( RestoreLog, "n_bytes_lo", 5, n_bytes_lo),
+ ROW( RestoreLog, "n_bytes_hi", 6, n_bytes_hi),
+
ROW( SingleUser, "type", 1, type),
ROW( SingleUser, "node_id", 2, node_id),
{ NDB_LE_ILLEGAL_TYPE, 0, 0, 0, 0, 0}
--- 1.2/storage/ndb/src/ndbapi/ndb_internal.hpp 2007-06-11 17:28:50 +02:00
+++ 1.3/storage/ndb/src/ndbapi/ndb_internal.hpp 2007-06-11 17:51:37 +02:00
@@ -19,6 +19,7 @@
{
private:
friend class NdbEventBuffer;
+ friend class BackupRestore;
Ndb_internal() {}
virtual ~Ndb_internal() {}
int send_event_report(Ndb *ndb, Uint32 *data, Uint32 length)
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2525) | tomas | 11 Jun |