Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/dbzero/core/memory/CacheRecycler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ namespace db0
updateSize(lock, m_capacity - flush_size);
flushed = true;
flush_result = m_current_size[priority] <= (m_capacity - flush_size);
if(getCurrentSize() >= m_capacity && !m_suppress_dist_overflow_error){
THROWF(db0::CacheException) << "DIST Memory Overflow. Too many Python objects" << THROWF_END;
}
if (getCurrentSize() >= m_capacity && !m_suppress_dist_overflow_error) {
THROWF(db0::CacheException) << "DIST Memory Overflow. Too many Python objects";
}
}
// resize is a costly operation but cannot be avoided if the number of locked
// resources exceeds the assumed limit
Expand Down
7 changes: 4 additions & 3 deletions src/dbzero/core/memory/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ namespace db0
// Currently we use uint32_t as the state number which allows enumerating 4B sequential transactions
// assuming 1s per transaction that gives us 136 years of continuous operation until the state number wraps
using StateNumType = std::uint32_t;

struct Settings
class Settings
{
public:
#ifndef NDEBUG
static bool __dbg_logs;
#endif
};

}
8 changes: 6 additions & 2 deletions src/dbzero/object_model/index/Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ namespace db0::object_model

// after unregister object might still have unflushed data, we need to flush them
if (hasInstance() && isDirty()) {
_flush();
}
try {
_flush();
} catch (CacheException &) {
// suppress cache exception, other exceptions will terminate
}
}
}

Index::Builder::Builder(Index &index)
Expand Down
2 changes: 1 addition & 1 deletion src/dbzero/object_model/tags/TagIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace db0::object_model
m_batch_op_types.empty() &&
"TagIndex::flush() or close() must be called before destruction");
}

void TagIndex::addTags(ObjectPtr memo_ptr, ObjectPtr const *args, std::size_t nargs)
{
using TypeId = db0::bindings::TypeId;
Expand Down
12 changes: 6 additions & 6 deletions src/dbzero/workspace/Fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ namespace db0
timer = std::make_unique<ProcessTimer>("Fixture::close", timer_ptr);
}

// flush to prepare objects which require it (e.g. Index) for commit
// NOTE: flush must NOT lock the fixture's shared mutex
if (m_gc0_ptr) {
getGC0().flushAllOf(Memspace::getForFlush());
}

// clear cache to destroy object instances supported by the cache
// this has to be done before commit (to not commit unrefereced objects)
m_lang_cache.clear(true, as_defunct);
Expand All @@ -191,12 +197,6 @@ namespace db0
// prevents commit on a closed fixture
std::unique_lock<std::mutex> lock(m_close_mutex);
if (!Memspace::isClosed()) {
// flush to prepare objects which require it (e.g. Index) for commit
// NOTE: flush must NOT lock the fixture's shared mutex
if (m_gc0_ptr) {
getGC0().flushAllOf(Memspace::getForFlush());
}

// clear lang cache again since flush might've released some Python instances
m_lang_cache.clear(true);

Expand Down
Loading