Improvements here and there about notary deposits. #184
6 changed files with 25 additions and 11 deletions
|
@ -117,6 +117,14 @@ func makeAndWaitNotaryDeposit(c *cfg) {
|
||||||
tx, err := makeNotaryDeposit(c)
|
tx, err := makeNotaryDeposit(c)
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
|
||||||
|
if tx.Equals(util.Uint256{}) {
|
||||||
|
// non-error deposit with an empty TX hash means
|
||||||
|
// that the deposit has already been made; no
|
||||||
|
// need to wait it.
|
||||||
|
c.log.Info("notary deposit has already been made")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err = waitNotaryDeposit(c, tx)
|
err = waitNotaryDeposit(c, tx)
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/audit"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/audit"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/balance"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/balance"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/container"
|
||||||
frostfs "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/frostfs"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/frostfs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/governance"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/governance"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap"
|
||||||
nodevalidator "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap/nodevalidation"
|
nodevalidator "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap/nodevalidation"
|
||||||
|
@ -411,8 +411,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server.mainNotaryConfig, server.sideNotaryConfig = parseNotaryConfigs(
|
server.mainNotaryConfig, server.sideNotaryConfig = notaryConfigs(
|
||||||
cfg,
|
|
||||||
server.morphClient.ProbeNotary(),
|
server.morphClient.ProbeNotary(),
|
||||||
!server.withoutMainNet && server.mainnetClient.ProbeNotary(), // if mainnet disabled then notary flag must be disabled too
|
!server.withoutMainNet && server.mainnetClient.ProbeNotary(), // if mainnet disabled then notary flag must be disabled too
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
"github.com/spf13/viper"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,6 +78,14 @@ func (s *Server) initNotary(ctx context.Context, deposit depositor, await awaite
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tx.Equals(util.Uint256{}) {
|
||||||
|
// non-error deposit with an empty TX hash means
|
||||||
|
// that the deposit has already been made; no
|
||||||
|
// need to wait it.
|
||||||
|
s.log.Info("notary deposit has already been made")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
s.log.Info(msg)
|
s.log.Info(msg)
|
||||||
|
|
||||||
return await(ctx, tx)
|
return await(ctx, tx)
|
||||||
|
@ -88,7 +95,7 @@ func awaitNotaryDepositInClient(ctx context.Context, cli *client.Client, txHash
|
||||||
for i := 0; i < notaryDepositTimeout; i++ {
|
for i := 0; i < notaryDepositTimeout; i++ {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return ctx.Err()
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +114,7 @@ func awaitNotaryDepositInClient(ctx context.Context, cli *client.Client, txHash
|
||||||
return errDepositTimeout
|
return errDepositTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseNotaryConfigs(cfg *viper.Viper, withSideNotary, withMainNotary bool) (main, side *notaryConfig) {
|
func notaryConfigs(withSideNotary, withMainNotary bool) (main, side *notaryConfig) {
|
||||||
main = new(notaryConfig)
|
main = new(notaryConfig)
|
||||||
side = new(notaryConfig)
|
side = new(notaryConfig)
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ func (e *StorageEngine) processExpiredLocks(ctx context.Context, lockers []oid.A
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
e.log.Info("interrupt processing the expired locks by context")
|
e.log.Info("interrupt processing the expired locks", zap.Error(ctx.Err()))
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
@ -236,7 +236,7 @@ func (e *StorageEngine) processDeletedLocks(ctx context.Context, lockers []oid.A
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
e.log.Info("interrupt processing the deleted locks by context")
|
e.log.Info("interrupt processing the deleted locks", zap.Error(ctx.Err()))
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -340,7 +340,7 @@ func (c *Client) Wait(ctx context.Context, n uint32) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return ctx.Err()
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2
|
||||||
|
|
||||||
// Transaction is already in mempool waiting to be processed.
|
// Transaction is already in mempool waiting to be processed.
|
||||||
// This is an expected situation if we restart the service.
|
// This is an expected situation if we restart the service.
|
||||||
c.logger.Debug("notary deposit has already been made",
|
c.logger.Info("notary deposit has already been made",
|
||||||
zap.Int64("amount", int64(amount)),
|
zap.Int64("amount", int64(amount)),
|
||||||
zap.Int64("expire_at", till),
|
zap.Int64("expire_at", till),
|
||||||
zap.Uint32("vub", vub),
|
zap.Uint32("vub", vub),
|
||||||
|
@ -210,7 +210,7 @@ func (c *Client) depositNotary(amount fixedn.Fixed8, till int64) (res util.Uint2
|
||||||
return util.Uint256{}, nil
|
return util.Uint256{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
c.logger.Debug("notary deposit invoke",
|
c.logger.Info("notary deposit invoke",
|
||||||
zap.Int64("amount", int64(amount)),
|
zap.Int64("amount", int64(amount)),
|
||||||
zap.Int64("expire_at", till),
|
zap.Int64("expire_at", till),
|
||||||
zap.Uint32("vub", vub),
|
zap.Uint32("vub", vub),
|
||||||
|
|
Loading…
Add table
Reference in a new issue