4870 magnus.blaudd@stripped 2012-03-05
ndb
- remove dependency on function from mysys/sha1.h since they no longer exist
in the future. Instead use our "standard" md5 function to create
a human readable digest which pgman may print to the
log file in debug compile.
- remove two unecessary include of md5_hash.hpp
modified:
storage/ndb/src/kernel/blocks/pgman.cpp
storage/ndb/src/ndbapi/NdbOperationSearch.cpp
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
4869 magnus.blaudd@stripped 2012-03-05 [merge]
Merge in fix for bug#13428853
modified:
storage/ndb/src/mgmsrv/ConfigManager.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/test/ndbapi/testMgmd.cpp
4868 jonas oreland 2012-02-21
ndb - run upgrade tests with ndbmtd, set SE to myisam, as 5.5 otherwise chokes on skip-innodb
modified:
storage/ndb/test/run-test/conf-upgrade.cnf
=== modified file 'storage/ndb/src/kernel/blocks/pgman.cpp'
--- a/storage/ndb/src/kernel/blocks/pgman.cpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/kernel/blocks/pgman.cpp 2012-03-05 12:53:12 +0000
@@ -27,7 +27,7 @@
#include <dbtup/Dbtup.hpp>
#include <DebuggerNames.hpp>
-#include <sha1.h>
+#include <md5_hash.hpp>
/**
* Requests that make page dirty
@@ -2629,21 +2629,13 @@ operator<<(NdbOut& out, Ptr<Pgman::Page_
if (pe.m_state & Pgman::Page_entry::MAPPED) {
Ptr<GlobalPage> gptr;
pe.m_this->m_global_page_pool.getPtr(gptr, pe.m_real_page_i);
- SHA1_CONTEXT c;
- uint8 digest[SHA1_HASH_SIZE];
- mysql_sha1_reset(&c);
- mysql_sha1_input(&c, (uchar*)gptr.p->data, sizeof(gptr.p->data));
- mysql_sha1_result(&c, digest);
- char buf[100];
- int i;
- for (i = 0; i < 20; i++) {
- const char* const hexdigit = "0123456789abcdef";
- uint8 x = digest[i];
- buf[2*i + 0] = hexdigit[x >> 4];
- buf[2*i + 1] = hexdigit[x & 0xF];
- }
- buf[2*i] = 0;
- out << " sha1=" << buf;
+ Uint32 hash_result[4];
+ /* NOTE: Assuming "data" is 64 bit aligned as required by 'md5_hash' */
+ md5_hash(hash_result,
+ (Uint64*)gptr.p->data, sizeof(gptr.p->data)/sizeof(Uint32));
+ out.print(" md5=%08x%08x%08x%08x",
+ hash_result[0], hash_result[1],
+ hash_result[2], hash_result[3]);
}
#endif
}
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp 2011-02-22 13:17:24 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp 2012-03-05 10:17:53 +0000
@@ -123,7 +123,8 @@ ConfigManager::find_nodeid_from_configdi
BaseString config_name;
NdbDir::Iterator iter;
- if (iter.open(m_configdir) != 0)
+ if (!m_configdir ||
+ iter.open(m_configdir) != 0)
return 0;
const char* name;
@@ -2102,8 +2103,9 @@ ConfigManager::delete_saved_configs(void
{
NdbDir::Iterator iter;
- if (iter.open(m_configdir) != 0)
- return false;
+ if (!m_configdir ||
+ iter.open(m_configdir) != 0)
+ return 0;
bool result = true;
const char* name;
@@ -2144,8 +2146,9 @@ ConfigManager::saved_config_exists(BaseS
{
NdbDir::Iterator iter;
- if (iter.open(m_configdir) != 0)
- return false;
+ if (!m_configdir ||
+ iter.open(m_configdir) != 0)
+ return 0;
const char* name;
unsigned nodeid;
@@ -2182,8 +2185,9 @@ ConfigManager::failed_config_change_exis
{
NdbDir::Iterator iter;
- if (iter.open(m_configdir) != 0)
- return false;
+ if (!m_configdir ||
+ iter.open(m_configdir) != 0)
+ return 0;
const char* name;
char tmp;
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-12-15 10:00:05 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2012-03-05 12:29:10 +0000
@@ -333,8 +333,18 @@ MgmtSrvr::init()
DBUG_ENTER("MgmtSrvr::init");
const char* configdir;
- if (!(configdir= check_configdir()))
- DBUG_RETURN(false);
+
+ if (!m_opts.config_cache)
+ {
+ g_eventLogger->info("Skipping check of config directory since "
+ "config cache is disabled.");
+ configdir = NULL;
+ }
+ else
+ {
+ if (!(configdir= check_configdir()))
+ DBUG_RETURN(false);
+ }
if (!(m_config_manager= new ConfigManager(m_opts, configdir)))
{
@@ -4311,6 +4321,7 @@ MgmtSrvr::show_variables(NdbOut& out)
out << "no_nodeid_checks: " << yes_no(m_opts.no_nodeid_checks) << endl;
out << "print_full_config: " << yes_no(m_opts.print_full_config) << endl;
out << "configdir: " << str_null(m_opts.configdir) << endl;
+ out << "config_cache: " << yes_no(m_opts.config_cache) << endl;
out << "verbose: " << yes_no(m_opts.verbose) << endl;
out << "reload: " << yes_no(m_opts.reload) << endl;
=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp 2012-03-05 12:53:12 +0000
@@ -34,7 +34,6 @@ Adjust: 971022 UABMNST First version
#include <AttributeHeader.hpp>
#include <signaldata/TcKeyReq.hpp>
#include <signaldata/KeyInfo.hpp>
-#include <md5_hash.hpp>
/******************************************************************************
CondIdType equal(const char* anAttrName, char* aValue, Uint32 aVarKeylen);
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2011-09-19 12:08:00 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2012-03-05 12:53:12 +0000
@@ -29,7 +29,6 @@
#include <ndb_version.h>
#include <mgmapi_debug.h>
#include <mgmapi_internal.h>
-#include <md5_hash.hpp>
#include "NdbImpl.hpp"
#include "NdbDictionaryImpl.hpp"
=== modified file 'storage/ndb/test/ndbapi/testMgmd.cpp'
--- a/storage/ndb/test/ndbapi/testMgmd.cpp 2011-07-04 13:37:56 +0000
+++ b/storage/ndb/test/ndbapi/testMgmd.cpp 2012-03-05 10:17:53 +0000
@@ -662,7 +662,41 @@ int runTestNoConfigCache(NDBT_Context* c
"ndb_1_config.bin.1",
NULL).c_str());
CHECK(bin_conf_file == false);
-
+
+ mgmd->stop();
+ return NDBT_OK;
+}
+
+
+/* Test for BUG#13428853 */
+int runTestNoConfigCache_DontCreateConfigDir(NDBT_Context* ctx, NDBT_Step* step)
+{
+ NDBT_Workingdir wd("test_mgmd"); // temporary working directory
+
+ g_err << "** Create config.ini" << endl;
+ Properties config = ConfigFactory::create();
+ CHECK(ConfigFactory::write_config_ini(config,
+ path(wd.path(),
+ "config.ini",
+ NULL).c_str()));
+
+ // Start ndb_mgmd from config.ini
+ Mgmd* mgmd = new Mgmd(1);
+ CHECK(mgmd->start_from_config_ini(wd.path(),
+ "--skip-config-cache",
+ "--config-dir=dir37",
+ NULL));
+
+ // Connect the ndb_mgmd(s)
+ CHECK(mgmd->connect(config));
+
+ // wait for confirmed config
+ CHECK(mgmd->wait_confirmed_config());
+
+ // Check configdir not created
+ bool conf_dir_exist = file_exists(path(wd.path(), "dir37", NULL).c_str());
+ CHECK(conf_dir_exist == false);
+
mgmd->stop();
return NDBT_OK;
}
@@ -1185,7 +1219,13 @@ TESTCASE("NoCfgCache",
{
INITIALIZER(runTestNoConfigCache);
}
-
+TESTCASE("NoCfgCacheOrConfigDir",
+ "Test that when an mgmd is started with --skip-config-cache, "
+ "no ndb_xx_config.xx.bin file is created, but you can "
+ "connect to the mgm node and retrieve the config.")
+{
+ INITIALIZER(runTestNoConfigCache_DontCreateConfigDir);
+}
TESTCASE("Bug45495",
"Test that mgmd can be restarted in any order")
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4868 to 4870) | magnus.blaudd | 5 Mar |