1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@@ -15,7 +15,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "TruncateTask.h"
#include <errno.h>
#include "messageFormat.h"
@@ -25,7 +24,6 @@ using namespace std;
namespace storagemanager
{
TruncateTask::TruncateTask(int sock, uint len) : PosixTask(sock, len)
{
}
@@ -35,51 +33,52 @@ TruncateTask::~TruncateTask()
}
#define check_error(msg, ret) \
if (success<0) \
{ \
handleError(msg, errno); \
return ret; \
}
if (success < 0) \
{ \
handleError(msg, errno); \
return ret; \
}
bool TruncateTask::run()
{
SMLogging* logger = SMLogging::get();
int success;
uint8_t buf[1024] = {0};
if (getLength() > 1023) {
handleError("TruncateTask read", ENAMETOOLONG);
return false;
}
success = read(buf, getLength());
check_error("TruncateTask read", false);
truncate_cmd *cmd = (truncate_cmd *) buf;
#ifdef SM_TRACE
logger->log(LOG_DEBUG,"truncate %s newlength %i.",cmd->filename,cmd->length);
#endif
int err;
try
{
err = ioc->truncate(cmd->filename, cmd->length);
}
catch (exception &e)
{
logger->log(LOG_ERR, "TruncateTask: caught '%s'", e.what());
errno = EIO;
err = -1;
}
if (err)
{
handleError("TruncateTask truncate", errno);
return true;
}
sm_response *resp = (sm_response *) buf;
resp->returnCode = 0;
return write(*resp, 0);
SMLogging* logger = SMLogging::get();
int success;
uint8_t buf[1024] = {0};
if (getLength() > 1023)
{
handleError("TruncateTask read", ENAMETOOLONG);
return false;
}
success = read(buf, getLength());
check_error("TruncateTask read", false);
truncate_cmd* cmd = (truncate_cmd*)buf;
#ifdef SM_TRACE
logger->log(LOG_DEBUG, "truncate %s newlength %i.", cmd->filename, cmd->length);
#endif
int err;
try
{
err = ioc->truncate(cmd->filename, cmd->length);
}
catch (exception& e)
{
logger->log(LOG_ERR, "TruncateTask: caught '%s'", e.what());
errno = EIO;
err = -1;
}
if (err)
{
handleError("TruncateTask truncate", errno);
return true;
}
sm_response* resp = (sm_response*)buf;
resp->returnCode = 0;
return write(*resp, 0);
}
}
} // namespace storagemanager