1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-4347: catch exceptions during smcat/smls/smput/smrm on IOC::get()

This commit is contained in:
benthompson15
2020-10-14 11:02:42 -05:00
parent ac258dc94d
commit 8ff81e5d45
4 changed files with 107 additions and 80 deletions

View File

@@ -55,6 +55,8 @@ void catFileOffline(const char *filename, int prefixlen)
uint8_t data[8192]; uint8_t data[8192];
off_t offset = 0; off_t offset = 0;
int read_err, write_err, count; int read_err, write_err, count;
try
{
boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get()); boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get());
do { do {
@@ -79,6 +81,11 @@ void catFileOffline(const char *filename, int prefixlen)
} }
offset += read_err; offset += read_err;
} while (read_err > 0); } while (read_err > 0);
}
catch (exception &e)
{
cerr << "smcat catFileOffline FAIL: " << e.what() << endl;
}
} }
void catFileOnline(const char *filename, int prefixlen) void catFileOnline(const char *filename, int prefixlen)

View File

@@ -58,6 +58,8 @@ bool SMOnline()
void lsOffline(const char *path) void lsOffline(const char *path)
{ {
try
{
boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get()); boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get());
vector<string> listing; vector<string> listing;
@@ -94,6 +96,11 @@ void lsOffline(const char *path)
cout << right << "error" << left << " " << entry << endl; cout << right << "error" << left << " " << entry << endl;
} }
} }
}
catch (exception &e)
{
cerr << "smls lsOffline FAIL: " << e.what() << endl;
}
} }
void lsOnline(const char *path) void lsOnline(const char *path)

View File

@@ -57,7 +57,8 @@ void putOffline(const char *fname, int prefixlen)
uint8_t data[8192]; uint8_t data[8192];
int read_err, write_err; int read_err, write_err;
ssize_t count, offset = 0; ssize_t count, offset = 0;
try
{
boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get()); boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get());
struct stat _stat; struct stat _stat;
read_err = ioc->open(fname, O_CREAT | O_TRUNC | O_WRONLY, &_stat); read_err = ioc->open(fname, O_CREAT | O_TRUNC | O_WRONLY, &_stat);
@@ -93,6 +94,11 @@ void putOffline(const char *fname, int prefixlen)
} }
offset += read_err; offset += read_err;
} while (read_err > 0); } while (read_err > 0);
}
catch (exception &e)
{
cerr << "smput putOffline FAIL: " << e.what() << endl;
}
} }
void putOnline(const char *fname, int prefixlen) void putOnline(const char *fname, int prefixlen)

View File

@@ -54,6 +54,8 @@ bool SMOnline()
void rmOffline(int argCount, const char **args, const char *prefix, uint prefixlen) void rmOffline(int argCount, const char **args, const char *prefix, uint prefixlen)
{ {
try
{
boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get()); boost::scoped_ptr<IOCoordinator> ioc(IOCoordinator::get());
char buf[16384]; char buf[16384];
strncpy(buf, prefix, prefixlen); strncpy(buf, prefix, prefixlen);
@@ -63,6 +65,11 @@ void rmOffline(int argCount, const char **args, const char *prefix, uint prefixl
memcpy(&buf[prefixlen], args[i], min(16383 - prefixlen, strlen(args[i])) + 1); memcpy(&buf[prefixlen], args[i], min(16383 - prefixlen, strlen(args[i])) + 1);
ioc->unlink(buf); ioc->unlink(buf);
} }
}
catch (exception &e)
{
cerr << "smrm rmOffline FAIL: " << e.what() << endl;
}
} }
void rmOnline(int argCount, const char **args, const char *prefix, uint prefixlen) void rmOnline(int argCount, const char **args, const char *prefix, uint prefixlen)