diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-08-16 10:47:16 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-08-16 10:47:16 +0200 |
commit | 974ab9f8e02ce0393e263b96ce93798c97bfbe1e (patch) | |
tree | ea470929c2fd21454603d299ee5b4d5d97424070 /vespalib | |
parent | 7d4fb319737a4b27c4b37ab775109f579df91a1e (diff) |
Assert that compacting flag is not already set for buffer that
is candiate for compaction.
Use markCompacting() to mark buffer being compacted.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/datastore/datastorebase.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp index 85411c833b5..8cc0edd98c0 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp +++ b/vespalib/src/vespa/vespalib/datastore/datastorebase.cpp @@ -480,10 +480,7 @@ DataStoreBase::startCompactWorstBuffer(uint32_t typeId) assert(typeHandler->get_active_buffers_count() >= 1u); if (typeHandler->get_active_buffers_count() == 1u) { // Single active buffer for type, no need for scan - _states[buffer_id].setCompacting(); - _states[buffer_id].disableElemHoldList(); - disableFreeList(buffer_id); - switch_primary_buffer(typeId, 0u); + markCompacting(buffer_id); return buffer_id; } // Multiple active buffers for type, must perform full scan @@ -500,6 +497,7 @@ DataStoreBase::startCompactWorstBuffer(uint32_t initWorstBufferId, BufferStateAc for (uint32_t bufferId = 0; bufferId < _numBuffers; ++bufferId) { const auto &state = getBufferState(bufferId); if (filterFunc(state)) { + assert(!state.getCompacting()); size_t deadElems = state.getDeadElems() - state.getTypeHandler()->getReservedElements(bufferId); if (deadElems > worstDeadElems) { worstBufferId = bufferId; @@ -520,6 +518,7 @@ DataStoreBase::markCompacting(uint32_t bufferId) if ((bufferId == buffer_id) || primary_buffer_too_dead(getBufferState(buffer_id))) { switch_primary_buffer(typeId, 0u); } + assert(!state.getCompacting()); state.setCompacting(); state.disableElemHoldList(); state.setFreeListList(nullptr); |