mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(meta): fix some bug for atomic op feature.
1. init buffer pool when fsck run. 2. fix the test case for GetMaskString(). 3. check if err == nil before convert status to int. Signed-off-by: Victor1319 <834863182@qq.com>
This commit is contained in:
parent
9aa539ce50
commit
45c0e18343
@ -37,6 +37,8 @@ func NewRootCmd() *cobra.Command {
|
||||
},
|
||||
}
|
||||
|
||||
proto.InitBufferPool(0)
|
||||
|
||||
c.AddCommand(
|
||||
newCheckCmd(),
|
||||
newCleanCmd(),
|
||||
|
||||
@ -759,13 +759,16 @@ func (tm *TransactionManager) delTxFromRM(txId string) (status uint8, err error)
|
||||
}
|
||||
|
||||
resp, err := tm.txProcessor.mp.submit(opFSMTxDelete, val)
|
||||
status = resp.(uint8)
|
||||
if err != nil || status != proto.OpOk {
|
||||
if err != nil {
|
||||
log.LogWarnf("delTxFromRM: delTxFromRM transaction[%v] failed, err[%v]", txId, err)
|
||||
return proto.OpTxCommitErr, err
|
||||
}
|
||||
|
||||
log.LogDebugf("delTxFromRM: tx[%v] is deleted successfully", txId)
|
||||
status = resp.(uint8)
|
||||
if log.EnableDebug() {
|
||||
log.LogDebugf("delTxFromRM: tx[%v] is deleted successfully, status (%s)", txId, proto.GetStatusStr(status))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -501,6 +501,12 @@ func (p *Packet) GetOpMsg() (m string) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetStatusStr(status uint8) string {
|
||||
pkt := &Packet{}
|
||||
pkt.ResultCode = status
|
||||
return pkt.GetResultMsg()
|
||||
}
|
||||
|
||||
// GetResultMsg returns the result message.
|
||||
func (p *Packet) GetResultMsg() (m string) {
|
||||
if p == nil {
|
||||
|
||||
@ -15,7 +15,8 @@ func TestGetMaskFromString(t *testing.T) {
|
||||
{TxPause, "pause"},
|
||||
{TxOpMaskAll, "all"},
|
||||
{TxOpMaskOff, "off"},
|
||||
{TxOpMaskCreate | TxOpMaskRename, "create|rename"},
|
||||
{TxOpMaskCreate, "create"},
|
||||
{TxOpMaskRename, "rename"},
|
||||
}
|
||||
|
||||
for _, c := range cs {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user