Skip to content
Snippets Groups Projects
Commit 164ee609 authored by Eric Cano's avatar Eric Cano
Browse files

Added memory copy invalidation after unlock.

This uncovered several failures to fetch again after relocking objects in unit tests (fixed as well).
parent a9e38358
Branches
Tags
No related merge requests found
......@@ -134,7 +134,7 @@ void BackendRados::ScopedLock::release() {
void BackendRados::ScopedLock::set(const std::string& oid, const std::string clientId) {
m_oid = oid;
m_clientId = clientId;\
m_lockSet = true;
m_lockSet = true;
}
BackendRados::ScopedLock::~ScopedLock() {
......
......@@ -139,6 +139,7 @@ void GarbageCollector::checkHeartbeats(log::LogContext & lc) {
if (!wa->second->checkAlive()) {
cleanupDeadAgent(wa->first, lc);
ScopedExclusiveLock oaLock(m_ourAgent);
m_ourAgent.fetch();
m_ourAgent.removeFromOwnership(wa->first);
m_ourAgent.commit();
delete wa->second;
......
......@@ -76,6 +76,7 @@ TEST(ObjectStore, GarbageCollectorBasicFuctionnality) {
}
// Unregister gc's agent
cta::objectstore::ScopedExclusiveLock gcal(gcAgent);
gcAgent.fetch();
gcAgent.removeAndUnregisterSelf();
// We should not be able to remove the agent register (as it should be empty)
rel.lock(re);
......@@ -135,6 +136,7 @@ TEST(ObjectStore, GarbageCollectorRegister) {
ASSERT_FALSE(be.exists(arName));
// Unregister gc's agent
cta::objectstore::ScopedExclusiveLock gcal(gcAgent);
gcAgent.fetch();
gcAgent.removeAndUnregisterSelf();
// We should not be able to remove the agent register (as it should be empty)
rel.lock(re);
......@@ -195,6 +197,7 @@ TEST(ObjectStore, GarbageCollectorArchiveQueue) {
ASSERT_FALSE(be.exists(tpName));
// Unregister gc's agent
cta::objectstore::ScopedExclusiveLock gcal(gcAgent);
gcAgent.fetch();
gcAgent.removeAndUnregisterSelf();
// We should not be able to remove the agent register (as it should be empty)
rel.lock(re);
......@@ -255,6 +258,7 @@ TEST(ObjectStore, GarbageCollectorDriveRegister) {
ASSERT_FALSE(be.exists(tpName));
// Unregister gc's agent
cta::objectstore::ScopedExclusiveLock gcal(gcAgent);
gcAgent.fetch();
gcAgent.removeAndUnregisterSelf();
// We should not be able to remove the agent register (as it should be empty)
rel.lock(re);
......@@ -424,6 +428,7 @@ TEST(ObjectStore, GarbageCollectorArchiveRequest) {
}
// Unregister gc's agent
cta::objectstore::ScopedExclusiveLock gcal(gcAgent);
gcAgent.fetch();
gcAgent.removeAndUnregisterSelf();
// We should not be able to remove the agent register (as it should be empty)
rel.lock(re);
......
......@@ -199,6 +199,8 @@ protected:
m_lock.reset(NULL);
m_objectOps->m_locksCount--;
m_locked = false;
// Releasing a lock voids the object content in memory as stored object can now change.
m_objectOps->m_payloadInterpreted=false;
}
};
......
......@@ -179,6 +179,7 @@ m_OStoreDB(*m_backend), m_agentReference("OStoreDBFactory") {
rel.release();
agent.insertAndRegisterSelf();
rel.lock(re);
re.fetch();
re.addOrGetDriveRegisterPointerAndCommit(m_agentReference, cl);
re.addOrGetSchedulerGlobalLockAndCommit(m_agentReference, cl);
rel.release();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment