1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -28,7 +28,7 @@ using namespace std;
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
namespace bi=boost::interprocess;
namespace bi = boost::interprocess;
#include "IDBPolicy.h"
#include "blockresolutionmanager.h"
@ -40,84 +40,94 @@ namespace
void usage()
{
cout << "usage: load_brm [-fh] prefix" << endl << endl;
cout << " -h display this help" << endl;
cout << " -f possibly fix a corrupted Free List" << endl;
cout << "usage: load_brm [-fh] prefix" << endl << endl;
cout << " -h display this help" << endl;
cout << " -f possibly fix a corrupted Free List" << endl;
}
struct CtlShmImage
{
bi::interprocess_mutex controlFifoMutex;
bi::interprocess_mutex controlFifoMutex;
};
}
int main(int argc, char **argv)
int main(int argc, char** argv)
{
opterr = 0;
bool fflg = false;
opterr = 0;
bool fflg = false;
int c;
while ((c = getopt(argc, argv, "fh")) != EOF)
switch (c)
{
case 'f':
fflg = true;
break;
case 'h':
case '?':
default:
usage();
return (c == 'h' ? 0 : 1);
break;
}
int c;
if ((argc - optind) != 1)
{
usage();
return 1;
}
while ((c = getopt(argc, argv, "fh")) != EOF)
switch (c)
{
case 'f':
fflg = true;
break;
idbdatafile::IDBPolicy::configIDBPolicy();
case 'h':
case '?':
default:
usage();
return (c == 'h' ? 0 : 1);
break;
}
BlockResolutionManager brm;
int err;
string prefix;
if ((argc - optind) != 1)
{
usage();
return 1;
}
prefix = argv[optind];
err = brm.loadState(prefix, fflg);
if (err != 0) {
cout << "Loading BRM snapshot failed (" << prefix << ")\n";
return 1;
}
idbdatafile::IDBPolicy::configIDBPolicy();
err = brm.replayJournal(prefix);
if (err < 0) {
cout << "Could not load BRM journal file\n";
return 1;
}
BlockResolutionManager brm;
int err;
string prefix;
ShmKeys shmkeys;
string key_name = ShmKeys::keyToName(shmkeys.DECOMSVRMUTEX_SYSVKEY);
bi::shared_memory_object::remove(key_name.c_str());
bi::permissions perms;
perms.set_unrestricted();
try {
bi::shared_memory_object shm(bi::create_only, key_name.c_str(), bi::read_write, perms);
shm.truncate(sizeof(CtlShmImage));
bi::mapped_region region(shm, bi::read_write);
(void)new (region.get_address()) CtlShmImage;
} catch (...) {
//Hmm...we just deleted it above, but the create failed...just bail out
throw runtime_error("couldn't create DecomSvr shm");
}
prefix = argv[optind];
err = brm.loadState(prefix, fflg);
/* An OAM friendly success msg */
cout << "OK.\n";
cout << "Successfully loaded BRM snapshot\n";
cout << "Successfully replayed " << err << " BRM transactions\n";
if (err != 0)
{
cout << "Loading BRM snapshot failed (" << prefix << ")\n";
return 1;
}
return 0;
err = brm.replayJournal(prefix);
if (err < 0)
{
cout << "Could not load BRM journal file\n";
return 1;
}
ShmKeys shmkeys;
string key_name = ShmKeys::keyToName(shmkeys.DECOMSVRMUTEX_SYSVKEY);
bi::shared_memory_object::remove(key_name.c_str());
bi::permissions perms;
perms.set_unrestricted();
try
{
bi::shared_memory_object shm(bi::create_only, key_name.c_str(), bi::read_write, perms);
shm.truncate(sizeof(CtlShmImage));
bi::mapped_region region(shm, bi::read_write);
(void)new (region.get_address()) CtlShmImage;
}
catch (...)
{
//Hmm...we just deleted it above, but the create failed...just bail out
throw runtime_error("couldn't create DecomSvr shm");
}
/* An OAM friendly success msg */
cout << "OK.\n";
cout << "Successfully loaded BRM snapshot\n";
cout << "Successfully replayed " << err << " BRM transactions\n";
return 0;
}
// vim:ts=4 sw=4: