mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(cli): remove unnecessary commands for cli
Signed-off-by: chihe <chihe@oppo.com>
This commit is contained in:
parent
f0e631799e
commit
ef8183b648
@ -22,7 +22,6 @@ import (
|
||||
|
||||
"github.com/cubefs/cubefs/proto"
|
||||
"github.com/cubefs/cubefs/sdk/master"
|
||||
"github.com/cubefs/cubefs/util/strutil"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -245,11 +244,11 @@ func newClusterSetVolDeletionDelayTimeCmd(client *master.MasterClient) *cobra.Co
|
||||
func newClusterSetParasCmd(client *master.MasterClient) *cobra.Command {
|
||||
var clientIDKey string
|
||||
var optAutoRepairRate, optMarkDeleteRate, optDelBatchCount, optDelWorkerSleepMs, optLoadFactor, opMaxDpCntLimit string
|
||||
dataNodesetSelector := ""
|
||||
metaNodesetSelector := ""
|
||||
dataNodeSelector := ""
|
||||
metaNodeSelector := ""
|
||||
markBrokenDiskThreshold := ""
|
||||
// dataNodesetSelector := ""
|
||||
// metaNodesetSelector := ""
|
||||
// dataNodeSelector := ""
|
||||
// metaNodeSelector := ""
|
||||
// markBrokenDiskThreshold := ""
|
||||
autoDecommissionDisk := ""
|
||||
autoDecommissionDiskInterval := ""
|
||||
autoDpMetaRepair := ""
|
||||
@ -269,13 +268,13 @@ func newClusterSetParasCmd(client *master.MasterClient) *cobra.Command {
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
if markBrokenDiskThreshold != "" {
|
||||
val, err := strutil.ParsePercent(markBrokenDiskThreshold)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
markBrokenDiskThreshold = fmt.Sprintf("%v", val)
|
||||
}
|
||||
// if markBrokenDiskThreshold != "" {
|
||||
// val, err := strutil.ParsePercent(markBrokenDiskThreshold)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// markBrokenDiskThreshold = fmt.Sprintf("%v", val)
|
||||
// }
|
||||
|
||||
if autoDecommissionDisk != "" {
|
||||
if _, err = strconv.ParseBool(autoDecommissionDisk); err != nil {
|
||||
@ -348,8 +347,6 @@ func newClusterSetParasCmd(client *master.MasterClient) *cobra.Command {
|
||||
}
|
||||
if err = client.AdminAPI().SetClusterParas(optDelBatchCount, optMarkDeleteRate, optDelWorkerSleepMs,
|
||||
optAutoRepairRate, optLoadFactor, opMaxDpCntLimit, opMaxMpCntLimit, clientIDKey,
|
||||
dataNodesetSelector, metaNodesetSelector,
|
||||
dataNodeSelector, metaNodeSelector, markBrokenDiskThreshold,
|
||||
autoDecommissionDisk, autoDecommissionDiskInterval,
|
||||
autoDpMetaRepair, autoDpMetaRepairParallelCnt,
|
||||
dpRepairTimeout, dpTimeout, dpBackupTimeout, decommissionDpLimit, decommissionDiskLimit); err != nil {
|
||||
@ -366,11 +363,11 @@ func newClusterSetParasCmd(client *master.MasterClient) *cobra.Command {
|
||||
cmd.Flags().StringVar(&opMaxDpCntLimit, CliFlagMaxDpCntLimit, "", "Maximum number of dp on each datanode, default 3000, 0 represents setting to default")
|
||||
cmd.Flags().StringVar(&opMaxMpCntLimit, CliFlagMaxMpCntLimit, "", "Maximum number of mp on each metanode, default 300, 0 represents setting to default")
|
||||
cmd.Flags().StringVar(&clientIDKey, CliFlagClientIDKey, client.ClientIDKey(), CliUsageClientIDKey)
|
||||
cmd.Flags().StringVar(&dataNodesetSelector, CliFlagDataNodesetSelector, "", "Set the nodeset select policy(datanode) for cluster")
|
||||
cmd.Flags().StringVar(&metaNodesetSelector, CliFlagMetaNodesetSelector, "", "Set the nodeset select policy(metanode) for cluster")
|
||||
cmd.Flags().StringVar(&dataNodeSelector, CliFlagDataNodeSelector, "", "Set the node select policy(datanode) for cluster")
|
||||
cmd.Flags().StringVar(&metaNodeSelector, CliFlagMetaNodeSelector, "", "Set the node select policy(metanode) for cluster")
|
||||
cmd.Flags().StringVar(&markBrokenDiskThreshold, CliFlagMarkDiskBrokenThreshold, "", "Threshold to mark disk as broken")
|
||||
// cmd.Flags().StringVar(&dataNodesetSelector, CliFlagDataNodesetSelector, "", "Set the nodeset select policy(datanode) for cluster")
|
||||
// cmd.Flags().StringVar(&metaNodesetSelector, CliFlagMetaNodesetSelector, "", "Set the nodeset select policy(metanode) for cluster")
|
||||
// cmd.Flags().StringVar(&dataNodeSelector, CliFlagDataNodeSelector, "", "Set the node select policy(datanode) for cluster")
|
||||
// cmd.Flags().StringVar(&metaNodeSelector, CliFlagMetaNodeSelector, "", "Set the node select policy(metanode) for cluster")
|
||||
// cmd.Flags().StringVar(&markBrokenDiskThreshold, CliFlagMarkDiskBrokenThreshold, "", "Threshold to mark disk as broken")
|
||||
cmd.Flags().StringVar(&autoDpMetaRepair, CliFlagAutoDpMetaRepair, "", "Enable or disable auto data partition meta repair")
|
||||
cmd.Flags().StringVar(&autoDpMetaRepairParallelCnt, CliFlagAutoDpMetaRepairParallelCnt, "", "Parallel count of auto data partition meta repair")
|
||||
cmd.Flags().StringVar(&dpRepairTimeout, CliFlagDpRepairTimeout, "", "Data partition repair timeout(example: 1h)")
|
||||
|
||||
@ -50,6 +50,7 @@ const (
|
||||
CliOpQueryDecommissionFailedDisk = "query-decommission-failed-disk"
|
||||
CliOpSetDecommissionDiskLimit = "set-decommission-disk-limit"
|
||||
CliOpResetRestoreStatus = "reset-restore-status"
|
||||
CliOpCancelDecommission = "cancel-decommission"
|
||||
|
||||
CliOpSetDecommissionLimit = "set-decommission-limit"
|
||||
CliOpQueryDecommissionStatus = "query-decommission-status"
|
||||
@ -137,7 +138,7 @@ const (
|
||||
CliFlagAutoDpMetaRepair = "autoDpMetaRepair"
|
||||
CliFlagAutoDpMetaRepairParallelCnt = "autoDpMetaRepairParallelCnt"
|
||||
CliFlagDpRepairTimeout = "dpRepairTimeout"
|
||||
CliFlagDpTimeout = "dpTimeout"
|
||||
CliFlagDpTimeout = "dpHeartbeatTimeout"
|
||||
CliFlagAutoDecommissionDisk = "autoDecommissionDisk"
|
||||
CliFlagAutoDecommissionDiskInterval = "autoDecommissionDiskInterval"
|
||||
CliFlagDpBackupTimeout = "dpBackupTimeout"
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/cubefs/cubefs/blobstore/cli/common/fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@ -39,15 +40,17 @@ func newDataNodeCmd(client *master.MasterClient) *cobra.Command {
|
||||
newDataNodeDecommissionCmd(client),
|
||||
newDataNodeMigrateCmd(client),
|
||||
newDataNodeQueryDecommissionedDisk(client),
|
||||
newDataNodeCancelDecommissionCmd(client),
|
||||
)
|
||||
return cmd
|
||||
}
|
||||
|
||||
const (
|
||||
cmdDataNodeListShort = "List information of data nodes"
|
||||
cmdDataNodeInfoShort = "Show information of a data node"
|
||||
cmdDataNodeDecommissionInfoShort = "decommission partitions in a data node to others"
|
||||
cmdDataNodeQueryDecommissionedDisksShort = "query datanode decommissioned disks"
|
||||
cmdDataNodeListShort = "List information of data nodes"
|
||||
cmdDataNodeInfoShort = "Show information of a data node"
|
||||
cmdDataNodeDecommissionInfoShort = "decommission partitions in a data node to others"
|
||||
cmdDataNodeQueryDecommissionedDisksShort = "query datanode decommissioned disks"
|
||||
cmdDataNodeCancelDecommissionedDisksShort = "cancel decommission progress for datanode"
|
||||
)
|
||||
|
||||
func newDataNodeListCmd(client *master.MasterClient) *cobra.Command {
|
||||
@ -171,7 +174,7 @@ func newDataNodeMigrateCmd(client *master.MasterClient) *cobra.Command {
|
||||
return validDataNodes(client, toComplete), cobra.ShellCompDirectiveNoFileComp
|
||||
},
|
||||
}
|
||||
cmd.Flags().IntVar(&optCount, CliFlagCount, dpMigrateMax, "Migrate dp count,default 15")
|
||||
cmd.Flags().IntVar(&optCount, CliFlagCount, dpMigrateMax, fmt.Sprintf("Migrate dp count,default %v", dpMigrateMax))
|
||||
cmd.Flags().StringVar(&clientIDKey, CliFlagClientIDKey, client.ClientIDKey(), CliUsageClientIDKey)
|
||||
return cmd
|
||||
}
|
||||
@ -196,3 +199,21 @@ func newDataNodeQueryDecommissionedDisk(client *master.MasterClient) *cobra.Comm
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
func newDataNodeCancelDecommissionCmd(client *master.MasterClient) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: CliOpCancelDecommission + " [{HOST}:{PORT}]",
|
||||
Short: cmdDataNodeCancelDecommissionedDisksShort,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := client.NodeAPI().QueryCancelDecommissionedDataNode(args[0])
|
||||
if err != nil {
|
||||
stdout("%v", err)
|
||||
return err
|
||||
}
|
||||
stdoutln(fmt.Sprintf("Cancel decommission for %v success", args[0]))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ func newDiskCmd(client *master.MasterClient) *cobra.Command {
|
||||
newDecommissionDiskCmd(client),
|
||||
newRecommissionDiskCmd(client),
|
||||
newQueryDecommissionDiskCmd(client),
|
||||
newAbortDecommissionDiskCmd(client),
|
||||
newCancelDecommissionDiskCmd(client),
|
||||
)
|
||||
return cmd
|
||||
}
|
||||
@ -211,13 +211,13 @@ func newQueryDecommissionDiskCmd(client *master.MasterClient) *cobra.Command {
|
||||
}
|
||||
|
||||
const (
|
||||
cmdAbortDecommissionDiskShort = "Abort disk decommission"
|
||||
cmdCancelDecommissionDiskShort = "cancel disk decommission"
|
||||
)
|
||||
|
||||
func newAbortDecommissionDiskCmd(client *master.MasterClient) *cobra.Command {
|
||||
func newCancelDecommissionDiskCmd(client *master.MasterClient) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: CliOpAbortDecommission + " [DATA NODE ADDR] [DISK]",
|
||||
Short: cmdAbortDecommissionDiskShort,
|
||||
Use: CliOpCancelDecommission + " [DATA NODE ADDR] [DISK]",
|
||||
Short: cmdCancelDecommissionDiskShort,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
@ -229,7 +229,7 @@ func newAbortDecommissionDiskCmd(client *master.MasterClient) *cobra.Command {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
stdout("%v\n", "Abort decommission successfully")
|
||||
stdout("%v\n", "cancel decommission successfully")
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
|
||||
@ -79,7 +79,7 @@ func NewDataPartitionRepairTask(extentFiles []*storage.ExtentInfo, tinyDeleteRec
|
||||
// - periodically check the size of the local extent, and if it is smaller than the largest size,
|
||||
// add it to the tobeRepaired list, and generate the corresponding tasks.
|
||||
func (dp *DataPartition) repair(extentType uint8) {
|
||||
start := time.Now().UnixNano()
|
||||
start := time.Now()
|
||||
log.LogInfof("action[repair] partition(%v) start extentType %v.",
|
||||
dp.partitionID, extentType)
|
||||
|
||||
@ -99,12 +99,13 @@ func (dp *DataPartition) repair(extentType uint8) {
|
||||
err := dp.buildDataPartitionRepairTask(repairTasks, extentType, tinyExtents, replica)
|
||||
if err != nil {
|
||||
log.LogErrorf(errors.Stack(err))
|
||||
log.LogErrorf("action[repair] partition(%v) err(%v).",
|
||||
dp.partitionID, err)
|
||||
log.LogErrorf("action[repair] partition(%v) tinyExtents(%v)%v extentType %v err(%v).",
|
||||
dp.partitionID, len(tinyExtents), tinyExtents, extentType, err)
|
||||
dp.moveToBrokenTinyExtentC(extentType, tinyExtents)
|
||||
return
|
||||
}
|
||||
log.LogInfof("action[repair] partition(%v) before prepareRepairTasks", dp.partitionID)
|
||||
log.LogInfof("action[repair] partition(%v) before prepareRepairTasks extentType %v tinyExtents(%v)%v",
|
||||
dp.partitionID, extentType, len(tinyExtents), tinyExtents)
|
||||
// compare all the extents in the replicas to compute the good and bad ones
|
||||
availableTinyExtents, brokenTinyExtents := dp.prepareRepairTasks(repairTasks)
|
||||
|
||||
@ -112,29 +113,31 @@ func (dp *DataPartition) repair(extentType uint8) {
|
||||
err = dp.NotifyExtentRepair(repairTasks)
|
||||
if err != nil {
|
||||
dp.sendAllTinyExtentsToC(extentType, availableTinyExtents, brokenTinyExtents)
|
||||
log.LogErrorf("action[repair] partition(%v) err(%v).",
|
||||
dp.partitionID, err)
|
||||
log.LogErrorf("action[repair] partition(%v) availableTinyExtents (%v)%v brokenTinyExtents(%v)%v "+
|
||||
"extentType %v err(%v).",
|
||||
dp.partitionID, len(availableTinyExtents), availableTinyExtents, len(brokenTinyExtents), brokenTinyExtents,
|
||||
extentType, err)
|
||||
log.LogError(errors.Stack(err))
|
||||
return
|
||||
}
|
||||
log.LogDebugf("DoRepair")
|
||||
// ask the leader to do the repair
|
||||
dp.DoRepair(repairTasks)
|
||||
end := time.Now().UnixNano()
|
||||
|
||||
log.LogInfof("action[repair] partition(%v) send availableTinyExtents (%v)%v brokenTinyExtents(%v)%v extentType %v.",
|
||||
dp.partitionID, len(availableTinyExtents), availableTinyExtents, len(brokenTinyExtents), brokenTinyExtents, extentType)
|
||||
// every time we need to figure out which extents need to be repaired and which ones do not.
|
||||
dp.sendAllTinyExtentsToC(extentType, availableTinyExtents, brokenTinyExtents)
|
||||
|
||||
// error check
|
||||
if dp.extentStore.AvailableTinyExtentCnt()+dp.extentStore.BrokenTinyExtentCnt() > storage.TinyExtentCount {
|
||||
log.LogWarnf("action[repair] partition(%v) GoodTinyExtents(%v) "+
|
||||
"BadTinyExtents(%v) finish cost[%vms].", dp.partitionID, dp.extentStore.AvailableTinyExtentCnt(),
|
||||
dp.extentStore.BrokenTinyExtentCnt(), (end-start)/int64(time.Millisecond))
|
||||
"BadTinyExtents(%v) finish cost[%v] extentType %v.", dp.partitionID, dp.extentStore.AvailableTinyExtentCnt(),
|
||||
dp.extentStore.BrokenTinyExtentCnt(), time.Now().Sub(start).String(), extentType)
|
||||
}
|
||||
|
||||
log.LogInfof("action[repair] partition(%v) GoodTinyExtents(%v) BadTinyExtents(%v)"+
|
||||
" finish cost[%vms] masterAddr(%v) extentType %v.", dp.partitionID, dp.extentStore.AvailableTinyExtentCnt(),
|
||||
dp.extentStore.BrokenTinyExtentCnt(), (end-start)/int64(time.Millisecond), MasterClient.Nodes(), extentType)
|
||||
" finish cost[%v] masterAddr(%v) extentType %v.", dp.partitionID, dp.extentStore.AvailableTinyExtentCnt(),
|
||||
dp.extentStore.BrokenTinyExtentCnt(), time.Now().Sub(start).String(), MasterClient.Nodes(), extentType)
|
||||
}
|
||||
|
||||
func (dp *DataPartition) buildDataPartitionRepairTask(repairTasks []*DataPartitionRepairTask, extentType uint8, tinyExtents []uint64, replica []string) (err error) {
|
||||
|
||||
@ -1500,8 +1500,8 @@ errHandler:
|
||||
if err != nil {
|
||||
log.LogWarnf("action[decommissionDataPartition] del dp[%v] from bad dataPartitionIDs failed:%v", partition.PartitionID, err)
|
||||
}
|
||||
// choose other node to create data partition when retry decommission
|
||||
if resetDecommissionDst {
|
||||
// choose other node to create data partition when retry decommission if not specify dst
|
||||
if resetDecommissionDst && !partition.DecommissionDstAddrSpecify {
|
||||
partition.DecommissionDstAddr = ""
|
||||
log.LogWarnf("action[decommissionDataPartition] partitionID:%v reset DecommissionDstAddr", partition.PartitionID)
|
||||
}
|
||||
|
||||
@ -527,7 +527,6 @@ func (api *AdminAPI) SetMasterVolDeletionDelayTime(volDeletionDelayTimeHour int)
|
||||
}
|
||||
|
||||
func (api *AdminAPI) SetClusterParas(batchCount, markDeleteRate, deleteWorkerSleepMs, autoRepairRate, loadFactor, maxDpCntLimit, maxMpCntLimit, clientIDKey string,
|
||||
dataNodesetSelector, metaNodesetSelector, dataNodeSelector, metaNodeSelector string, markDiskBrokenThreshold string,
|
||||
enableAutoDecommissionDisk string, autoDecommissionDiskInterval string,
|
||||
enableAutoDpMetaRepair string, autoDpMetaRepairParallelCnt string,
|
||||
dpRepairTimeout string, dpTimeout string, dpBackupTimeout string, decommissionDpLimit, decommissionDiskLimit string,
|
||||
@ -542,13 +541,13 @@ func (api *AdminAPI) SetClusterParas(batchCount, markDeleteRate, deleteWorkerSle
|
||||
request.addParam("maxMpCntLimit", maxMpCntLimit)
|
||||
request.addParam("clientIDKey", clientIDKey)
|
||||
|
||||
request.addParam("dataNodesetSelector", dataNodesetSelector)
|
||||
request.addParam("metaNodesetSelector", metaNodesetSelector)
|
||||
request.addParam("dataNodeSelector", dataNodeSelector)
|
||||
request.addParam("metaNodeSelector", metaNodeSelector)
|
||||
if markDiskBrokenThreshold != "" {
|
||||
request.addParam("markDiskBrokenThreshold", markDiskBrokenThreshold)
|
||||
}
|
||||
// request.addParam("dataNodesetSelector", dataNodesetSelector)
|
||||
// request.addParam("metaNodesetSelector", metaNodesetSelector)
|
||||
// request.addParam("dataNodeSelector", dataNodeSelector)
|
||||
// request.addParam("metaNodeSelector", metaNodeSelector)
|
||||
// if markDiskBrokenThreshold != "" {
|
||||
// request.addParam("markDiskBrokenThreshold", markDiskBrokenThreshold)
|
||||
// }
|
||||
if enableAutoDecommissionDisk != "" {
|
||||
request.addParam("autoDecommissionDisk", enableAutoDecommissionDisk)
|
||||
}
|
||||
@ -809,7 +808,7 @@ func (api *AdminAPI) QueryDecommissionFailedDisk(decommType int) (diskInfo []*pr
|
||||
}
|
||||
|
||||
func (api *AdminAPI) AbortDiskDecommission(addr string, disk string) (err error) {
|
||||
request := newRequest(post, proto.AdminAbortDecommissionDisk)
|
||||
request := newRequest(post, proto.CancelDecommissionDisk)
|
||||
request.addParam("addr", addr)
|
||||
request.addParam("disk", disk)
|
||||
|
||||
|
||||
@ -173,3 +173,8 @@ func (api *NodeAPI) QueryDecommissionedDisks(addr string) (disks *proto.Decommis
|
||||
err = api.mc.requestWith(disks, newRequest(get, proto.QueryDisableDisk).Header(api.h).addParam("addr", addr))
|
||||
return
|
||||
}
|
||||
|
||||
func (api *NodeAPI) QueryCancelDecommissionedDataNode(addr string) (err error) {
|
||||
err = api.mc.request(newRequest(get, proto.CancelDecommissionDataNode).Header(api.h).addParam("addr", addr))
|
||||
return
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ func (ei *ExtentInfo) String() (m string) {
|
||||
if source == "" {
|
||||
source = "none"
|
||||
}
|
||||
return fmt.Sprintf("FileID(%v)_Size(%v)_IsDeleted(%v)_Souarce(%v)_MT(%d)_AT(%d)_CRC(%d)", ei.FileID, ei.Size, ei.IsDeleted, source, ei.ModifyTime, ei.AccessTime, ei.Crc)
|
||||
return fmt.Sprintf("FileID(%v)_Size(%v)_IsDeleted(%v)_Source(%v)_MT(%d)_AT(%d)_CRC(%d)", ei.FileID, ei.Size, ei.IsDeleted, source, ei.ModifyTime, ei.AccessTime, ei.Crc)
|
||||
}
|
||||
|
||||
func (ei *ExtentInfo) MarshalBinaryWithBuffer(buff *bytes.Buffer) (err error) {
|
||||
|
||||
@ -721,11 +721,16 @@ func IsTinyExtent(extentID uint64) bool {
|
||||
// Read reads the extent based on the given id.
|
||||
func (s *ExtentStore) Read(extentID uint64, offset, size int64, nbuf []byte, isRepairRead bool, isBackupRead bool) (crc uint32, err error) {
|
||||
var e *Extent
|
||||
|
||||
log.LogInfof("[Read] extent[%d] offset[%d] size[%d] isRepairRead[%v] extentLock[%v]", extentID, offset, size, isRepairRead, s.extentLock)
|
||||
begin := time.Now()
|
||||
log.LogInfof("[Read] dp %v extent[%d] offset[%d] size[%d] isRepairRead[%v] extentLock[%v]",
|
||||
s.partitionID, extentID, offset, size, isRepairRead, s.extentLock)
|
||||
defer func() {
|
||||
log.LogInfof("[Read] dp %v extent[%d] offset[%d] size[%d] isRepairRead[%v] extentLock[%v] cost %v",
|
||||
s.partitionID, extentID, offset, size, isRepairRead, s.extentLock, time.Now().Sub(begin).String())
|
||||
}()
|
||||
ei, _ := s.GetExtentInfo(extentID)
|
||||
if ei == nil {
|
||||
return 0, errors.Trace(ExtentHasBeenDeletedError, "[Read] extent[%d] is already been deleted", extentID)
|
||||
return 0, errors.Trace(ExtentHasBeenDeletedError, "[Read] extent[%d] is already been deleted", s.partitionID, extentID)
|
||||
}
|
||||
|
||||
s.elMutex.RLock()
|
||||
@ -733,13 +738,13 @@ func (s *ExtentStore) Read(extentID uint64, offset, size int64, nbuf []byte, isR
|
||||
if _, ok := s.extentLockMap[extentID]; !ok {
|
||||
s.elMutex.RUnlock()
|
||||
err = fmt.Errorf("extent(%v) is not locked", extentID)
|
||||
log.LogErrorf("[Read] gc_extent_no_lock[%d] is not locked", extentID)
|
||||
log.LogErrorf("[Read]dp %v gc_extent_no_lock[%d] is not locked", s.partitionID, extentID)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if s.extentLock {
|
||||
if _, ok := s.extentLockMap[extentID]; ok && !isRepairRead {
|
||||
log.LogErrorf("[Read] gc_extent_lock[%d] is locked, should not be read.", extentID)
|
||||
log.LogErrorf("[Read]dp %v gc_extent_lock[%d] is locked, should not be read.", s.partitionID, extentID)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -754,10 +759,13 @@ func (s *ExtentStore) Read(extentID uint64, offset, size int64, nbuf []byte, isR
|
||||
|
||||
// if err = s.checkOffsetAndSize(extentID, offset, size); err != nil {
|
||||
// return
|
||||
// }
|
||||
log.LogDebugf("action[Extent.read]extent %v offset %v size %v ei.Size %v e.dataSize %v isRepairRead %v",
|
||||
extentID, offset, size, ei.Size, e.dataSize, isRepairRead)
|
||||
//}
|
||||
begin2 := time.Now()
|
||||
log.LogDebugf("[Read]dp %v extent %v offset %v size %v ei.Size %v e.dataSize %v isRepairRead %v",
|
||||
s.partitionID, extentID, offset, size, ei.Size, e.dataSize, isRepairRead)
|
||||
crc, err = e.Read(nbuf, offset, size, isRepairRead)
|
||||
log.LogDebugf("[Read]dp %v extent %v offset %v size %v ei.Size %v e.dataSize %v isRepairRead %v,cost %v",
|
||||
s.partitionID, extentID, offset, size, ei.Size, e.dataSize, isRepairRead, time.Now().Sub(begin2).String())
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user