2020-12-11 11:04:04 +03:00
|
|
|
package deletesvc
|
|
|
|
|
|
|
|
import (
|
2023-04-04 12:45:59 +03:00
|
|
|
"context"
|
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-07-06 15:36:41 +03:00
|
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
2023-03-07 16:38:26 +03:00
|
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
2021-02-17 15:30:11 +03:00
|
|
|
"go.uber.org/zap"
|
2020-12-11 11:04:04 +03:00
|
|
|
)
|
|
|
|
|
2023-04-04 12:45:59 +03:00
|
|
|
func (exec *execCtx) executeLocal(ctx context.Context) {
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.DeleteFormingTombstoneStructure)
|
2020-12-11 11:04:04 +03:00
|
|
|
|
2023-04-04 12:45:59 +03:00
|
|
|
ok := exec.formTombstone(ctx)
|
2020-12-11 11:04:04 +03:00
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.DeleteTombstoneStructureSuccessfullyFormedSaving)
|
2020-12-11 11:04:04 +03:00
|
|
|
|
2023-04-04 12:45:59 +03:00
|
|
|
exec.saveTombstone(ctx)
|
2020-12-11 11:04:04 +03:00
|
|
|
}
|
|
|
|
|
2023-04-04 12:45:59 +03:00
|
|
|
func (exec *execCtx) formTombstone(ctx context.Context) (ok bool) {
|
2021-02-17 15:30:11 +03:00
|
|
|
tsLifetime, err := exec.svc.netInfo.TombstoneLifetime()
|
|
|
|
if err != nil {
|
|
|
|
exec.status = statusUndefined
|
|
|
|
exec.err = err
|
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.DeleteCouldNotReadTombstoneLifetimeConfig,
|
2021-02-17 15:30:11 +03:00
|
|
|
zap.String("error", err.Error()),
|
|
|
|
)
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-07-06 15:36:41 +03:00
|
|
|
exec.tombstone = objectSDK.NewTombstone()
|
2021-02-17 15:30:11 +03:00
|
|
|
exec.tombstone.SetExpirationEpoch(
|
|
|
|
exec.svc.netInfo.CurrentEpoch() + tsLifetime,
|
|
|
|
)
|
2022-05-31 20:00:41 +03:00
|
|
|
exec.addMembers([]oid.ID{exec.address().Object()})
|
2020-12-11 11:04:04 +03:00
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.DeleteFormingSplitInfo)
|
2020-12-11 11:04:04 +03:00
|
|
|
|
2023-04-04 12:45:59 +03:00
|
|
|
ok = exec.formSplitInfo(ctx)
|
2020-12-11 11:04:04 +03:00
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.DeleteSplitInfoSuccessfullyFormedCollectingMembers)
|
2020-12-11 11:04:04 +03:00
|
|
|
|
2020-12-11 14:29:31 +03:00
|
|
|
exec.tombstone.SetSplitID(exec.splitInfo.SplitID())
|
|
|
|
|
2023-04-04 12:45:59 +03:00
|
|
|
ok = exec.collectMembers(ctx)
|
2020-12-11 11:04:04 +03:00
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.DeleteMembersSuccessfullyCollected)
|
2020-12-11 11:04:04 +03:00
|
|
|
|
|
|
|
ok = exec.initTombstoneObject()
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|