summaryrefslogtreecommitdiffstats
path: root/include/framework/structure/MutableBuffer.h
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <dbr4@psu.edu>2024-05-14 16:31:05 -0400
committerGitHub <noreply@github.com>2024-05-14 16:31:05 -0400
commit47916da2ba5ed5bee2dda3cbcc58d39e1e931bfc (patch)
treeee5613ce182b2c9caa228d3abeb65dc27fef2db3 /include/framework/structure/MutableBuffer.h
parent4a834497d5f82c817d634925250158d85ca825c2 (diff)
parent8643fe194dec05b4e3f3ea31e162ac0b2b00e162 (diff)
downloaddynamic-extension-47916da2ba5ed5bee2dda3cbcc58d39e1e931bfc.tar.gz
Merge pull request #4 from dbrumbaugh/master
Updates for VLDB revision
Diffstat (limited to 'include/framework/structure/MutableBuffer.h')
-rw-r--r--include/framework/structure/MutableBuffer.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/framework/structure/MutableBuffer.h b/include/framework/structure/MutableBuffer.h
index 415c95a..7db3980 100644
--- a/include/framework/structure/MutableBuffer.h
+++ b/include/framework/structure/MutableBuffer.h
@@ -50,18 +50,19 @@ public:
, m_tail(0)
, m_head({0, 0})
, m_old_head({high_watermark, 0})
- , m_data((Wrapped<R> *) psudb::sf_aligned_alloc(CACHELINE_SIZE, m_cap * sizeof(Wrapped<R>)))
+ //, m_data((Wrapped<R> *) psudb::sf_aligned_alloc(CACHELINE_SIZE, m_cap * sizeof(Wrapped<R>)))
+ , m_data(new Wrapped<R>[m_cap]())
, m_tombstone_filter(new psudb::BloomFilter<R>(BF_FPR, m_hwm, BF_HASH_FUNCS))
, m_tscnt(0)
, m_old_tscnt(0)
, m_active_head_advance(false)
{
assert(m_cap > m_hwm);
- assert(m_hwm > m_lwm);
+ assert(m_hwm >= m_lwm);
}
~MutableBuffer() {
- free(m_data);
+ delete[] m_data;
delete m_tombstone_filter;
}
@@ -76,16 +77,20 @@ public:
wrec.header = 0;
if (tombstone) wrec.set_tombstone();
+ // FIXME: because of the mod, it isn't correct to use `pos`
+ // as the ordering timestamp in the header anymore.
size_t pos = tail % m_cap;
m_data[pos] = wrec;
- m_data[pos].header |= (pos << 2);
+ m_data[pos].set_timestamp(pos);
if (tombstone) {
m_tscnt.fetch_add(1);
if (m_tombstone_filter) m_tombstone_filter->insert(rec);
}
+ m_data[pos].set_visible();
+
return 1;
}