Fix errors introduced in D298

Reviewers: florijan, mislav.bradac, mferencevic, buda

Reviewed By: florijan

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D326
This commit is contained in:
Teon Banek 2017-04-28 10:33:46 +02:00
parent e6191eadb4
commit 3b9d13f1e1
7 changed files with 22 additions and 37 deletions

View File

@ -1,14 +0,0 @@
#pragma once
#include "utils/exceptions/basic_exception.hpp"
class SerializationError : public BasicException {
static constexpr const char* default_message =
"Can't serialize due to\
concurrent operation(s)";
public:
SerializationError() : BasicException(default_message) {}
SerializationError(const std::string& message) : BasicException(message) {}
};

View File

@ -2,16 +2,25 @@
#include <shared_mutex>
#include "memory/lazy_gc.hpp"
#include "storage/locking/record_lock.hpp"
#include "threading/sync/lockable.hpp"
#include "transactions/transaction.hpp"
#include "memory/lazy_gc.hpp"
#include "mvcc/serialization_error.hpp"
#include "storage/locking/record_lock.hpp"
#include "utils/assert.hpp"
#include "utils/exceptions.hpp"
namespace mvcc {
class SerializationError : public utils::BasicException {
static constexpr const char* default_message =
"Can't serialize due to\
concurrent operation(s)";
public:
using utils::BasicException::BasicException;
SerializationError() : BasicException(default_message) {}
};
template <class T>
class VersionList {
public:

View File

@ -8,7 +8,8 @@
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include "lock_timeout_error.hpp"
#include "threading/sync/lock_timeout_exception.hpp"
#include "utils/cpu_relax.hpp"
namespace sys {
@ -90,7 +91,7 @@ class Futex {
// check if we woke up because of a timeout
if (status == -1 && errno == ETIMEDOUT)
throw LockTimeoutError("Lock timeout");
throw LockTimeoutException("Lock timeout");
}
}

View File

@ -1,11 +0,0 @@
//
// Created by buda on 18/02/17.
//
#pragma once
#include "utils/exceptions/basic_exception.hpp"
class LockTimeoutError : public BasicException {
public:
using BasicException::BasicException;
};

View File

@ -5,7 +5,7 @@
#include <chrono>
#include <stdexcept>
#include "lock_timeout_exception.hpp"
#include "threading/sync/lock_timeout_exception.hpp"
template <size_t microseconds = 250>
class TimedSpinLock {

View File

@ -10,13 +10,13 @@
#include "transactions/transaction.hpp"
#include "transactions/transaction_store.hpp"
#include "utils/counters/simple_counter.hpp"
#include "utils/exceptions/basic_exception.hpp"
#include "utils/exceptions.hpp"
namespace tx {
class TransactionError : public BasicException {
class TransactionError : public utils::BasicException {
public:
using BasicException::BasicException;
using utils::BasicException::BasicException;
};
// max value that could be stored as a command id

View File

@ -23,7 +23,7 @@ TEST(MVCC, Case1Test3) {
auto t4 = engine.begin();
version_list.update(*t4);
t4->commit();
EXPECT_THROW(version_list.remove(*t3), SerializationError);
EXPECT_THROW(version_list.remove(*t3), mvcc::SerializationError);
}
TEST(MVCC, InSnapshotSerializationError) {
@ -37,7 +37,7 @@ TEST(MVCC, InSnapshotSerializationError) {
auto t3 = engine.begin(); // t2 is in snapshot of t3
t2->commit();
EXPECT_THROW(version_list.update(*t3), SerializationError);
EXPECT_THROW(version_list.update(*t3), mvcc::SerializationError);
}
// Check that we don't delete records when we re-link.