New upstream version 8.1.0
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#include <toolkit/StorageTkEx.h>
|
||||
#include <program/Program.h>
|
||||
|
||||
#include "ChunkBalanceMsgEx.h"
|
||||
|
||||
|
||||
FileIDLock ChunkBalanceMsgEx::lock(EntryLockStore& store)
|
||||
{
|
||||
return {&store, getEntryInfo()->getEntryID(), true};
|
||||
}
|
||||
|
||||
bool ChunkBalanceMsgEx::processIncoming(ResponseContext& ctx)
|
||||
{
|
||||
#ifdef BEEGFS_DEBUG
|
||||
const char* logContext = "ChunkBalanceMsg incoming";
|
||||
#endif // BEEGFS_DEBUG
|
||||
|
||||
LOG_DEBUG(logContext, Log_SPAM, "Starting ChunkBalance job from localTargetID: "
|
||||
+ StringTk::uintToStr(getTargetID()) + "; to destinationTargetID: "
|
||||
+ StringTk::uintToStr(getDestinationID()));
|
||||
return BaseType::processIncoming(ctx);
|
||||
}
|
||||
|
||||
std::unique_ptr<MirroredMessageResponseState> ChunkBalanceMsgEx::executeLocally(ResponseContext& ctx,
|
||||
bool isSecondary)
|
||||
{
|
||||
ChunkBalanceMsgResponseState resp;
|
||||
|
||||
FhgfsOpsErr chunkBalanceMsgRes = FhgfsOpsErr_SUCCESS;
|
||||
|
||||
const char* logContext = "Update Stripe Pattern";
|
||||
|
||||
LogContext(logContext).logErr("This message is not yet implemented. \n It should trigger chunk balancing components on the metadata service. ");
|
||||
|
||||
resp.setResult(chunkBalanceMsgRes);
|
||||
return boost::make_unique<ResponseState>(std::move(resp));
|
||||
}
|
||||
|
||||
ChunkBalancerJob* ChunkBalanceMsgEx::addChunkBalanceJob()
|
||||
{
|
||||
std::lock_guard<Mutex> mutexLock(ChunkBalanceJobMutex);
|
||||
|
||||
ChunkBalancerJob* chunkBalanceJob = nullptr;
|
||||
return chunkBalanceJob;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/net/message/storage/chunkbalancing/ChunkBalanceMsg.h>
|
||||
#include <common/net/message/storage/chunkbalancing/ChunkBalanceRespMsg.h>
|
||||
|
||||
#include <net/message/MirroredMessage.h>
|
||||
#include <session/EntryLock.h>
|
||||
|
||||
class ChunkBalancerJob;
|
||||
|
||||
class ChunkBalanceMsgResponseState : public ErrorCodeResponseState<ChunkBalanceRespMsg, NETMSGTYPE_ChunkBalance>
|
||||
{
|
||||
public:
|
||||
|
||||
ChunkBalanceMsgResponseState() : ErrorCodeResponseState<ChunkBalanceRespMsg, NETMSGTYPE_ChunkBalance>(FhgfsOpsErr_INTERNAL)
|
||||
{
|
||||
}
|
||||
|
||||
ChunkBalanceMsgResponseState(ChunkBalanceMsgResponseState&& other) :
|
||||
ErrorCodeResponseState<ChunkBalanceRespMsg, NETMSGTYPE_ChunkBalance>(other.result)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
// Always return false from changeObservableState() to prohibit forwarding
|
||||
// to secondary. See MirroredMessage::finishOperation() for more details.
|
||||
*/
|
||||
|
||||
bool changesObservableState() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void setResult(FhgfsOpsErr result) { this->result = result; }
|
||||
|
||||
private:
|
||||
FhgfsOpsErr result;
|
||||
};
|
||||
|
||||
class ChunkBalanceMsgEx : public MirroredMessage<ChunkBalanceMsg, FileIDLock>
|
||||
{
|
||||
public:
|
||||
typedef ChunkBalanceMsgResponseState ResponseState;
|
||||
|
||||
virtual bool processIncoming(ResponseContext& ctx) override;
|
||||
|
||||
std::unique_ptr<MirroredMessageResponseState> executeLocally(ResponseContext& ctx,
|
||||
bool isSecondary) override;
|
||||
|
||||
FileIDLock lock(EntryLockStore& store) override;
|
||||
bool isMirrored() override { return getEntryInfo()->getIsBuddyMirrored(); }
|
||||
|
||||
private:
|
||||
Mutex ChunkBalanceJobMutex;
|
||||
ChunkBalancerJob* addChunkBalanceJob();
|
||||
|
||||
void forwardToSecondary(ResponseContext& ctx) override {};
|
||||
FhgfsOpsErr processSecondaryResponse(NetMessage& resp) override
|
||||
{
|
||||
return FhgfsOpsErr_SUCCESS;
|
||||
}
|
||||
const char* mirrorLogContext() const override { return "ChunkBalanceMsgEx/forward"; }
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#include <toolkit/StorageTkEx.h>
|
||||
#include <program/Program.h>
|
||||
|
||||
#include "StripePatternUpdateMsgEx.h"
|
||||
|
||||
FileIDLock StripePatternUpdateMsgEx::lock(EntryLockStore& store)
|
||||
{
|
||||
return {&store, getEntryInfo()->getEntryID(), true};
|
||||
}
|
||||
|
||||
bool StripePatternUpdateMsgEx::processIncoming(ResponseContext& ctx)
|
||||
{
|
||||
#ifdef BEEGFS_DEBUG
|
||||
const char* logContext = "StripePatternUpdateMsg incoming";
|
||||
#endif // BEEGFS_DEBUG
|
||||
|
||||
LOG_DEBUG(logContext, Log_SPAM, "Attempting to change stripe pattern of file at chunkPath: " + getRelativePath() + "; from localTargetID: "
|
||||
+ StringTk::uintToStr(getTargetID()) + "; to destinationTargetID: "
|
||||
+ StringTk::uintToStr(getDestinationID()));
|
||||
return BaseType::processIncoming(ctx);
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<MirroredMessageResponseState> StripePatternUpdateMsgEx::executeLocally(ResponseContext& ctx,
|
||||
bool isSecondary)
|
||||
{
|
||||
|
||||
FhgfsOpsErr stripePatternMsgRes;
|
||||
const char* logContext = "Update Stripe Pattern";
|
||||
|
||||
LogContext(logContext).logErr("This message is not yet implemented. \n It should change the metadata stripe pattern of the chunk that is being balanced. ");
|
||||
|
||||
stripePatternMsgRes = FhgfsOpsErr_SUCCESS;
|
||||
return boost::make_unique<ResponseState>(stripePatternMsgRes);
|
||||
}
|
||||
|
||||
ChunkBalancerJob* StripePatternUpdateMsgEx::addChunkBalanceJob()
|
||||
{
|
||||
std::lock_guard<Mutex> mutexLock(ChunkBalanceJobMutex);
|
||||
|
||||
ChunkBalancerJob* chunkBalanceJob = nullptr;
|
||||
return chunkBalanceJob;
|
||||
}
|
||||
|
||||
void StripePatternUpdateMsgEx::forwardToSecondary(ResponseContext& ctx)
|
||||
{
|
||||
sendToSecondary(ctx, *this, NETMSGTYPE_StripePatternUpdate);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/net/message/storage/chunkbalancing/StripePatternUpdateMsg.h>
|
||||
#include <common/net/message/storage/chunkbalancing/StripePatternUpdateRespMsg.h>
|
||||
#include <net/message/MirroredMessage.h>
|
||||
#include <session/EntryLock.h>
|
||||
|
||||
|
||||
class ChunkBalancerJob;
|
||||
|
||||
class StripePatternUpdateMsgEx : public MirroredMessage<StripePatternUpdateMsg, FileIDLock>
|
||||
{
|
||||
public:
|
||||
typedef ErrorCodeResponseState<StripePatternUpdateRespMsg, NETMSGTYPE_StripePatternUpdate> ResponseState;
|
||||
virtual bool processIncoming(ResponseContext& ctx) override;
|
||||
|
||||
std::unique_ptr<MirroredMessageResponseState> executeLocally(ResponseContext& ctx,
|
||||
bool isSecondary) override;
|
||||
|
||||
FileIDLock lock(EntryLockStore& store) override;
|
||||
bool isMirrored() override { return getEntryInfo()->getIsBuddyMirrored(); }
|
||||
|
||||
private:
|
||||
Mutex ChunkBalanceJobMutex;
|
||||
Mutex StripePatternUpdateMutex;
|
||||
Condition StripePatternUpdateCond;
|
||||
|
||||
ChunkBalancerJob* addChunkBalanceJob();
|
||||
void waitForStripePatternUpdate();
|
||||
|
||||
void forwardToSecondary(ResponseContext& ctx) override;
|
||||
FhgfsOpsErr processSecondaryResponse(NetMessage& resp) override
|
||||
{
|
||||
return static_cast<FhgfsOpsErr>(static_cast<StripePatternUpdateRespMsg&>(resp).getValue());
|
||||
}
|
||||
const char* mirrorLogContext() const override { return "StripePatternUpdateMsgEx/forward"; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user