1
// Copyright 2018 The CubeFS Authors.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
// implied. See the License for the specific language governing
13
// permissions and limitations under the License.
20
"github.com/cubefs/cubefs/proto"
21
"github.com/cubefs/cubefs/repl"
22
"github.com/cubefs/cubefs/storage"
25
func (s *DataNode) Post(p *repl.Packet) error {
26
if p.IsMasterCommand() {
29
if p.IsReadOperation() && p.AfterPre {
37
func (s *DataNode) cleanupPkt(p *repl.Packet) {
38
if p.IsMasterCommand() {
41
if !p.IsLeaderPacket() {
47
func (s *DataNode) releaseExtent(p *repl.Packet) {
48
if p == nil || !storage.IsTinyExtent(p.ExtentID) || p.ExtentID <= 0 || atomic.LoadInt32(&p.IsReleased) == IsReleased {
51
if !proto.IsTinyExtentType(p.ExtentType) || !p.IsLeaderPacket() || !p.IsNormalWriteOperation() || !p.IsForwardPkt() {
57
partition := p.Object.(*DataPartition)
58
store := partition.ExtentStore()
60
store.SendToBrokenTinyExtentC(p.ExtentID)
62
store.SendToAvailableTinyExtentC(p.ExtentID)
64
atomic.StoreInt32(&p.IsReleased, IsReleased)
67
func (s *DataNode) addMetrics(p *repl.Packet) {
68
if p.IsMasterCommand() || p.ShallDegrade() {
75
partition := p.Object.(*DataPartition)