Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some of the typos #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions include/phxpaxos/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace phxpaxos

class NetWork;

//All the funciton in class Node is thread safe!
//All the function in class Node is thread safe!

class Node
{
Expand All @@ -42,7 +42,7 @@ class Node
virtual ~Node() { }

//If you want to end paxos, just delete poNode.
//But if you use your own network, poNode can be deleted after your own network stop recieving messages.
//But if you use your own network, poNode can be deleted after your own network stop receiving messages.
static int RunNode(const Options & oOptions, Node *& poNode);

//Base function.
Expand Down Expand Up @@ -142,18 +142,18 @@ class Node
//Qos

//If many threads propose same group, that some threads will be on waiting status.
//Set max hold threads, and we will reject some propose request to avoid to many threads be holded.
//Set max hold threads, and we will reject some propose request to avoid to many threads be held.
//Reject propose request will get retcode(PaxosTryCommitRet_TooManyThreadWaiting_Reject), check on def.h.
virtual void SetMaxHoldThreads(const int iGroupIdx, const int iMaxHoldThreads) = 0;

//To avoid threads be holded too long time, we use this threshold to reject some propose to control thread's wait time.
//To avoid threads be held too long time, we use this threshold to reject some propose to control thread's wait time.
virtual void SetProposeWaitTimeThresholdMS(const int iGroupIdx, const int iWaitTimeThresholdMS) = 0;

//write disk
virtual void SetLogSync(const int iGroupIdx, const bool bLogSync) = 0;

//Not suggest to use this function
//pair: value,smid.
//pair: value, smid.
//Because of BatchPropose, a InstanceID maybe include multi-value.
virtual int GetInstanceValue(const int iGroupIdx, const uint64_t llInstanceID,
std::vector<std::pair<std::string, int> > & vecValues) = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/phxpaxos/sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class StateMachine
//Checkpoint file was on dir(sCheckpointTmpFileDirPath).
//vecFileList is all the file in dir(sCheckpointTmpFileDirPath).
//vecFileList filepath is absolute path.
//After called this fuction, paxoslib will kill the processor.
//After called this function, paxoslib will kill the processor.
//State machine need to understand this when restart.
virtual int LoadCheckpointState(const int iGroupIdx, const std::string & sCheckpointTmpFileDirPath,
const std::vector<std::string> & vecFileList, const uint64_t llCheckpointInstanceID);
Expand Down
2 changes: 1 addition & 1 deletion include/phxpaxos/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace phxpaxos
{

//Paxoslib need to storage many datas, if you want to storage datas yourself,
//you must implememt all function in class LogStorage, and make sure that observe the writeoptions.
//you must implement all function in class LogStorage, and make sure that observe the writeoptions.

class WriteOptions
{
Expand Down
2 changes: 1 addition & 1 deletion sample/phxecho/echo_sm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bool PhxEchoSM :: Execute(const int iGroupIdx, const uint64_t llInstanceID,
printf("[SM Execute] ok, smid %d instanceid %lu value %s\n",
SMID(), llInstanceID, sPaxosValue.c_str());

//only commiter node have SMCtx.
//only committer node have SMCtx.
if (poSMCtx != nullptr && poSMCtx->m_pCtx != nullptr)
{
PhxEchoSMCtx * poPhxEchoSMCtx = (PhxEchoSMCtx *)poSMCtx->m_pCtx;
Expand Down
2 changes: 1 addition & 1 deletion sample/phxkv/kv_paxos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int PhxKV :: RunPaxos()
oOptions.vecNodeInfoList = m_vecNodeList;

//because all group share state machine(kv), so every group have same state machine.
//just for split key to different paxos group, to upgrate performance.
//just for split key to different paxos group, to upgrade performance.
for (int iGroupIdx = 0; iGroupIdx < m_iGroupCount; iGroupIdx++)
{
GroupSMInfo oSMInfo;
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/acceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int AcceptorState :: Persist(const uint64_t llInstanceID, const uint32_t iLastCh
}

PLGImp("GroupIdx %d InstanceID %lu PromiseID %lu PromiseNodeID %lu "
"AccectpedID %lu AcceptedNodeID %lu ValueLen %zu Checksum %u",
"AcceptedID %lu AcceptedNodeID %lu ValueLen %zu Checksum %u",
m_poConfig->GetMyGroupIdx(), llInstanceID, m_oPromiseBallot.m_llProposalID,
m_oPromiseBallot.m_llNodeID, m_oAcceptedBallot.m_llProposalID,
m_oAcceptedBallot.m_llNodeID, m_sAcceptedValue.size(), m_iChecksum);
Expand Down Expand Up @@ -162,7 +162,7 @@ int AcceptorState :: Load(uint64_t & llInstanceID)
m_iChecksum = oState.checksum();

PLGImp("GroupIdx %d InstanceID %lu PromiseID %lu PromiseNodeID %lu"
" AccectpedID %lu AcceptedNodeID %lu ValueLen %zu Checksum %u",
" AcceptedID %lu AcceptedNodeID %lu ValueLen %zu Checksum %u",
m_poConfig->GetMyGroupIdx(), llInstanceID, m_oPromiseBallot.m_llProposalID,
m_oPromiseBallot.m_llNodeID, m_oAcceptedBallot.m_llProposalID,
m_oAcceptedBallot.m_llNodeID, m_sAcceptedValue.size(), m_iChecksum);
Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Instance
void OnNewValueCommitTimeout();

public:
//this funciton only enqueue, do nothing.
//this function only enqueue, do nothing.
int OnReceiveMessage(const char * pcMessage, const int iMessageLen);

public:
Expand Down
4 changes: 2 additions & 2 deletions src/algorithm/ioloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void IOLoop :: OneLoop(const int iTimeoutMs)
DealWithRetry();

//must put on here
//because addtimer on this funciton
//because addtimer on this function
m_poInstance->CheckNewValue();
}

Expand Down Expand Up @@ -240,7 +240,7 @@ void IOLoop :: DealwithTimeoutOne(const uint32_t iTimerID, const int iType)
auto it = m_mapTimerIDExist.find(iTimerID);
if (it == end(m_mapTimerIDExist))
{
//PLGErr("Timeout aready remove!, timerid %u iType %d", iTimerID, iType);
//PLGErr("Timeout already removed!, timerid %u iType %d", iTimerID, iType);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/learner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void Learner :: OnSendNowInstanceID(const PaxosMsg & oPaxosMsg)
int ret = m_poConfig->GetSystemVSM()->UpdateByCheckpoint(oPaxosMsg.systemvariables(), bSystemVariablesChange);
if (ret == 0 && bSystemVariablesChange)
{
PLGHead("SystemVariables changed!, all thing need to reflesh, so skip this msg");
PLGHead("SystemVariables changed!, all thing need to refresh, so skip this msg");
return;
}

Expand Down
14 changes: 7 additions & 7 deletions src/logstorage/log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ int LogStore :: GetFileFD(const int iNeedWriteSize, int & iFd, int & iFileID, in
{
if (m_iFd == -1)
{
PLG1Err("File aready broken, fileid %d", m_iFileID);
PLG1Err("File already broken, fileid %d", m_iFileID);
return -1;
}

Expand Down Expand Up @@ -317,7 +317,7 @@ int LogStore :: GetFileFD(const int iNeedWriteSize, int & iFd, int & iFileID, in
{
assert(iOffset != -1);

m_oFileLogger.Log("new file but file aready exist, now fileid %d exist filesize %d",
m_oFileLogger.Log("new file but file already exist, now fileid %d exist filesize %d",
m_iFileID, iOffset);

PLG1Err("IncreaseFileID success, but file exist, data wrong, file size %d", iOffset);
Expand Down Expand Up @@ -430,7 +430,7 @@ int LogStore :: Read(const std::string & sFileID, uint64_t & llInstanceID, std::
if (iReadLen != (ssize_t)sizeof(int))
{
close(iFd);
PLG1Err("readlen %zd not qual to %zu", iReadLen, sizeof(int));
PLG1Err("readlen %zd not equal to %zu", iReadLen, sizeof(int));
return -1;
}

Expand All @@ -441,7 +441,7 @@ int LogStore :: Read(const std::string & sFileID, uint64_t & llInstanceID, std::
if (iReadLen != iLen)
{
close(iFd);
PLG1Err("readlen %zd not qual to %zu", iReadLen, iLen);
PLG1Err("readlen %zd not equal to %zu", iReadLen, iLen);
return -1;
}

Expand Down Expand Up @@ -474,7 +474,7 @@ int LogStore :: Del(const std::string & sFileID, const uint64_t llInstanceID)

if (iFileID > m_iFileID)
{
PLG1Err("del fileid %d large than useing fileid %d", iFileID, m_iFileID);
PLG1Err("del fileid %d large than using fileid %d", iFileID, m_iFileID);
return -2;
}

Expand Down Expand Up @@ -650,7 +650,7 @@ int LogStore :: RebuildIndexForOneFile(const int iFileID, const int iOffset,
if (iReadLen != (ssize_t)sizeof(int))
{
bNeedTruncate = true;
PLG1Err("readlen %zd not qual to %zu, need truncate", iReadLen, sizeof(int));
PLG1Err("readlen %zd not equal to %zu, need truncate", iReadLen, sizeof(int));
break;
}

Expand All @@ -674,7 +674,7 @@ int LogStore :: RebuildIndexForOneFile(const int iFileID, const int iOffset,
if (iReadLen != iLen)
{
bNeedTruncate = true;
PLG1Err("readlen %zd not qual to %zu, need truncate", iReadLen, iLen);
PLG1Err("readlen %zd not equal to %zu, need truncate", iReadLen, iLen);
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/master/master_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void MasterMgr :: TryBeMaster(const int iLeaseTime)

if (iMasterNodeID != nullnode && (iMasterNodeID != m_poPaxosNode->GetMyNodeID()))
{
PLG1Imp("Ohter as master, can't try be master, masterid %lu myid %lu",
PLG1Imp("Other as master, can't try be master, masterid %lu myid %lu",
iMasterNodeID, m_poPaxosNode->GetMyNodeID());
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/master/master_sm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int MasterStateMachine :: LearnMaster(

if (oMasterOper.version() != m_llMasterVersion)
{
PLG1Debug("version conflit, op version %lu now master version %lu",
PLG1Debug("version conflict, op version %lu now master version %lu",
oMasterOper.version(), m_llMasterVersion);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ int Node :: RunNode(const Options & oOptions, Node *& poNode)
}

//step1 set node to network
//very important, let network on recieve callback can work.
//very important, let network on receive callback can work.
poNetWork->m_poNode = poRealNode;

//step2 run network.
//start recieve message from network, so all must init before this step.
//start receive message from network, so all must init before this step.
//must be the last step.
poNetWork->RunNetWork();

Expand Down