Removed atomics in metadata (lead to crashes on aarch64)
This commit is contained in:
parent
f566edc642
commit
e35ec43ad8
|
@ -54,8 +54,8 @@ class Metadata
|
||||||
: _original_record_identifier(other._original_record_identifier), _begin_timestamp(timestamp::make_infinity()),
|
: _original_record_identifier(other._original_record_identifier), _begin_timestamp(timestamp::make_infinity()),
|
||||||
_end_timestamp(timestamp::make_infinity())
|
_end_timestamp(timestamp::make_infinity())
|
||||||
{
|
{
|
||||||
_begin_timestamp.store(other._begin_timestamp.load());
|
_begin_timestamp = other._begin_timestamp;
|
||||||
_end_timestamp.store(other._end_timestamp.load());
|
_end_timestamp = other._end_timestamp;
|
||||||
_next_in_version_chain = other._next_in_version_chain;
|
_next_in_version_chain = other._next_in_version_chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class Metadata
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] timestamp begin_timestamp() const
|
[[nodiscard]] timestamp begin_timestamp() const
|
||||||
{
|
{
|
||||||
return _begin_timestamp.load();
|
return _begin_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +75,7 @@ class Metadata
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] timestamp end_timestamp() const
|
[[nodiscard]] timestamp end_timestamp() const
|
||||||
{
|
{
|
||||||
return _end_timestamp.load();
|
return _end_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +92,7 @@ class Metadata
|
||||||
*/
|
*/
|
||||||
void begin_timestamp(const timestamp timestamp)
|
void begin_timestamp(const timestamp timestamp)
|
||||||
{
|
{
|
||||||
_begin_timestamp.store(timestamp);
|
_begin_timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +105,11 @@ class Metadata
|
||||||
*/
|
*/
|
||||||
bool try_begin_timestamp(timestamp old_timestamp, const timestamp timestamp)
|
bool try_begin_timestamp(timestamp old_timestamp, const timestamp timestamp)
|
||||||
{
|
{
|
||||||
return _begin_timestamp.compare_exchange_strong(old_timestamp, timestamp);
|
if (_begin_timestamp == old_timestamp){
|
||||||
|
_begin_timestamp = timestamp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,7 +118,7 @@ class Metadata
|
||||||
*/
|
*/
|
||||||
void end_timestamp(const timestamp timestamp)
|
void end_timestamp(const timestamp timestamp)
|
||||||
{
|
{
|
||||||
_end_timestamp.store(timestamp);
|
_end_timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +131,11 @@ class Metadata
|
||||||
*/
|
*/
|
||||||
bool try_end_timestamp(timestamp old_timestamp, const timestamp timestamp)
|
bool try_end_timestamp(timestamp old_timestamp, const timestamp timestamp)
|
||||||
{
|
{
|
||||||
return _end_timestamp.compare_exchange_strong(old_timestamp, timestamp);
|
if (_end_timestamp == old_timestamp){
|
||||||
|
_end_timestamp = timestamp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,15 +155,14 @@ class Metadata
|
||||||
return _original_record_identifier;
|
return _original_record_identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
// Pointer to the record in the table space.
|
// Pointer to the record in the table space.
|
||||||
storage::RecordIdentifier _original_record_identifier;
|
storage::RecordIdentifier _original_record_identifier;
|
||||||
|
|
||||||
// Timestamp the record begins living.
|
// Timestamp the record begins living.
|
||||||
std::atomic<timestamp> _begin_timestamp;
|
timestamp _begin_timestamp;
|
||||||
|
|
||||||
// Timestamp the record dies.
|
// Timestamp the record dies.
|
||||||
std::atomic<timestamp> _end_timestamp;
|
timestamp _end_timestamp;
|
||||||
|
|
||||||
// Pointer to the next record in version chain.
|
// Pointer to the next record in version chain.
|
||||||
storage::RecordIdentifier _next_in_version_chain;
|
storage::RecordIdentifier _next_in_version_chain;
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace beedb::concurrency
|
||||||
*
|
*
|
||||||
* The time "0" in combination with the set committed flag indicates "infinity".
|
* The time "0" in combination with the set committed flag indicates "infinity".
|
||||||
*/
|
*/
|
||||||
class alignas(64) timestamp
|
class timestamp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using timestamp_t = std::uint64_t;
|
using timestamp_t = std::uint64_t;
|
||||||
|
|
Reference in New Issue