Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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.1924 05/06/02 19:10:10 joreland@stripped +3 -0
wl1445 - ndb - events during NF
fix bugs discovered on ndb cluster
add generic listen_event program for easier testing
storage/ndb/test/tools/listen.cpp
1.1 05/06/02 19:10:02 joreland@stripped +169 -0
storage/ndb/test/tools/listen.cpp
1.0 05/06/02 19:10:02 joreland@stripped +0 -0
BitKeeper file /home/jonas/src/mysql-5.1-wl2325/storage/ndb/test/tools/listen.cpp
storage/ndb/test/tools/Makefile.am
1.14 05/06/02 19:10:02 joreland@stripped +2 -1
Add generic listen_event program
storage/ndb/src/kernel/blocks/suma/Suma.cpp
1.45 05/06/02 19:10:02 joreland@stripped +8 -6
Fix init buffer_head to make sure new page will be allocated
Reset m_last_gci when clearing page
# 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: joreland
# Host: eel.ndb.mysql.com.ndb.mysql.com
# Root: /home/jonas/src/mysql-5.1-wl2325
--- New file ---
+++ storage/ndb/test/tools/listen.cpp 05/06/02 19:10:02
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NdbSleep.h>
#include <NDBT.hpp>
#include <HugoTransactions.hpp>
#include <getarg.h>
int
main(int argc, const char** argv){
ndb_init();
int _help = 0;
const char* db = 0;
struct getargs args[] = {
{ "database", 'd', arg_string, &db, "Database", "" },
{ "usage", '?', arg_flag, &_help, "Print help", "" }
};
int num_args = sizeof(args) / sizeof(args[0]);
int optind = 0, i;
char desc[] =
"<tabname>+ \nThis program listen to events on specified tables\n";
if(getarg(args, num_args, argc, argv, &optind) ||
argv[optind] == NULL || _help) {
arg_printusage(args, num_args, argv[0], desc);
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
// Connect to Ndb
Ndb_cluster_connection con;
if(con.connect(12, 5, 1) != 0)
{
return NDBT_ProgramExit(NDBT_FAILED);
}
Ndb MyNdb( &con, db ? db : "TEST_DB" );
if(MyNdb.init() != 0){
ERR(MyNdb.getNdbError());
return NDBT_ProgramExit(NDBT_FAILED);
}
// Connect to Ndb and wait for it to become ready
while(MyNdb.waitUntilReady() != 0)
ndbout << "Waiting for ndb to become ready..." << endl;
int result = 0;
Uint64 last_gci= 0, cnt= 0;
NdbDictionary::Dictionary *myDict = MyNdb.getDictionary();
Vector<NdbDictionary::Event*> events;
Vector<NdbEventOperation*> event_ops;
for(i= optind; i<argc; i++)
{
const NdbDictionary::Table* table= myDict->getTable(argv[i]);
if(!table)
{
ndbout_c("Could not find table: %s, skipping", argv[i]);
continue;
}
BaseString name;
name.appfmt("EV-%s", argv[i]);
NdbDictionary::Event *myEvent= new NdbDictionary::Event(name.c_str());
myEvent->setTable(table->getName());
myEvent->addTableEvent(NdbDictionary::Event::TE_ALL);
for(int a = 0; a < table->getNoOfColumns(); a++){
myEvent->addEventColumn(a);
}
if (myDict->createEvent(* myEvent))
{
if(myDict->getNdbError().classification == NdbError::SchemaObjectExists)
{
g_info << "Event creation failed event exists\n";
if (myDict->dropEvent(name.c_str()))
{
g_err << "Failed to drop event: " << myDict->getNdbError() << endl;
result = 1;
goto end;
}
// try again
if (myDict->createEvent(* myEvent))
{
g_err << "Failed to create event: " << myDict->getNdbError() << endl;
result = 1;
goto end;
}
}
else
{
g_err << "Failed to create event: " << myDict->getNdbError() << endl;
result = 1;
goto end;
}
}
events.push_back(myEvent);
NdbEventOperation* pOp = MyNdb.createEventOperation(name.c_str(), 100);
if ( pOp == NULL ) {
g_err << "Event operation creation failed" << endl;
result = 1;
goto end;
}
for (int a = 0; a < table->getNoOfColumns(); a++)
{
pOp->getValue(table->getColumn(a)->getName());
pOp->getPreValue(table->getColumn(a)->getName());
}
event_ops.push_back(pOp);
}
for(i= 0; i<(int)event_ops.size(); i++)
{
if (event_ops[i]->execute())
{
g_err << "operation execution failed: " << event_ops[i]->getNdbError()
<< endl;
result = 1;
goto end;
}
}
while(true)
{
while(MyNdb.pollEvents(100) == 0);
NdbEventOperation* pOp;
while((pOp= MyNdb.nextEvent()) != 0)
{
if(pOp->getGCI() != last_gci)
{
if(cnt) ndbout_c("GCI: %lld events: %lld", last_gci, cnt);
cnt= 1;
last_gci= pOp->getGCI();
}
else
{
cnt++;
}
}
}
end:
return NDBT_ProgramExit(NDBT_OK);
}
template class Vector<NdbDictionary::Event*>;
template class Vector<NdbEventOperation*>;
--- 1.44/storage/ndb/src/kernel/blocks/suma/Suma.cpp Thu Jun 2 13:27:14 2005
+++ 1.45/storage/ndb/src/kernel/blocks/suma/Suma.cpp Thu Jun 2 19:10:02 2005
@@ -3100,7 +3100,7 @@
page->m_next_page = RNIL;
memset(&bucket->m_buffer_head, 0, sizeof(bucket->m_buffer_head));
bucket->m_buffer_head.m_page_id = RNIL;
- bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS;
+ bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS + 1;
m_active_buckets.set(i);
c_buckets[i].m_state &= ~(Uint32)Bucket::BUCKET_TAKEOVER;
@@ -4135,7 +4135,7 @@
* Clear head
*/
bucket->m_buffer_head.m_page_id = RNIL;
- bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS;
+ bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS + 1;
buck++;
if(buck != c_no_of_buckets)
@@ -4246,6 +4246,7 @@
jam();
head.m_page_pos = 0;
head.m_max_gci = gci;
+ head.m_last_gci = 0;
bucket->m_buffer_head = head;
}
return;
@@ -4314,7 +4315,7 @@
if(min > max)
{
- ndbrequire(pos.m_page_pos == 0);
+ ndbrequire(pos.m_page_pos <= 2);
ndbrequire(pos.m_page_id == bucket->m_buffer_tail);
m_active_buckets.set(buck);
m_gcp_complete_rep_count ++;
@@ -4385,9 +4386,6 @@
printf("\n");
#endif
- if(pos == 0)
- ndbrequire(((* ptr) >> 16) == 0);
-
while(ptr < end)
{
Uint32 *src = ptr;
@@ -4400,6 +4398,10 @@
{
sz--;
last_gci = * src ++;
+ }
+ else
+ {
+ ndbrequire(ptr - sz > page->m_data);
}
if(last_gci < min_gci)
--- 1.13/storage/ndb/test/tools/Makefile.am Wed Apr 27 04:04:32 2005
+++ 1.14/storage/ndb/test/tools/Makefile.am Thu Jun 2 19:10:02 2005
@@ -1,5 +1,5 @@
-ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc
+ndbtest_PROGRAMS = hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc listen_event
# transproxy
@@ -18,6 +18,7 @@
copy_tab_SOURCES = copy_tab.cpp
create_index_SOURCES = create_index.cpp
ndb_cpcc_SOURCES = cpcc.cpp
+listen_event_SOURCES = listen.cpp
include $(top_srcdir)/storage/ndb/config/common.mk.am
include $(top_srcdir)/storage/ndb/config/type_ndbapitest.mk.am
| Thread |
|---|
| • bk commit into 5.1 tree (joreland:1.1924) | jonas.oreland | 2 Jun |