fixed mvcc hints bug

This commit is contained in:
Dominik Tomičević 2016-03-12 10:39:10 +01:00
parent f9765d61af
commit a5fb18533e
2 changed files with 11 additions and 16 deletions

View File

@ -92,6 +92,12 @@ public:
template <class U>
bool committed(U& hints, const Id& id, const tx::Transaction& t)
{
// you certainly can't see the transaction with id greater than yours
// as that means it started after this transaction and if it committed,
// it committed after this transaction had started.
if(id > t.id)
return false;
auto hint_bits = hints.load();
// if hints are set, return if xid is committed

View File

@ -17,6 +17,7 @@ class VersionList : public LazyGC<VersionList<T>>
public:
using uptr = std::unique_ptr<VersionList<T>>;
using item_t = T;
class Accessor
{
@ -72,7 +73,7 @@ public:
const Id& id() const
{
return vlist.identifier;
return vlist.id;
}
private:
@ -80,14 +81,14 @@ public:
VersionList<T>& vlist;
};
VersionList() = default;
VersionList(Id id) : id(id) {}
VersionList(const VersionList&) = delete;
/* @brief Move constructs the version list
* Note: use only at the beginning of the "other's" lifecycle since this
* constructor doesn't move the RecordLock, but only the head pointer
*/
VersionList(VersionList&& other)
VersionList(VersionList&& other) : id(other.id)
{
this->head = other.head.load();
this->identifier = other.id();
@ -130,22 +131,12 @@ public:
}
const Id& id() const
{
return identifier;
}
void id(const Id& identifier)
{
this->identifier = identifier;
}
const Id id;
private:
std::atomic<T*> head {nullptr};
RecordLock lock;
Id identifier;
//static Recycler recycler;
T* find(const tx::Transaction& t)
@ -172,8 +163,6 @@ private:
{
assert(head == nullptr);
// this->id = id;
// create a first version of the record
// TODO replace 'new' with something better
auto v1 = new T();