Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuous replication #965

Merged
merged 2 commits into from
Nov 26, 2021

Conversation

alexvanin
Copy link
Contributor

Blocked by #948

@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #965 (08d756d) into master (7f5fb13) will not change coverage.
The diff coverage is n/a.

❗ Current head 08d756d differs from pull request most recent head f961856. Consider uploading reports for the commit f961856 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master     #965   +/-   ##
=======================================
  Coverage   38.32%   38.32%           
=======================================
  Files         258      258           
  Lines       13473    13473           
=======================================
  Hits         5163     5163           
  Misses       7878     7878           
  Partials      432      432           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f5fb13...f961856. Read the comment docs.


pool.putRemote, err = ants.NewPool(pool.putRemoteCapacity, optNonBlocking)
if err != nil {
fatalOnErr(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if statement can be omitted.

"go.uber.org/zap"
)

// NodeLoader provides functions to fetch application load statistic.
type nodeLoader interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type nodeLoader interface {
type NodeLoader interface {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be public? I am not sure it needs to be exported somewhere out of policer package.

"go.uber.org/zap"
)

// NodeLoader provides functions to fetch application load statistic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// NodeLoader provides functions to fetch application load statistic.
// NodeLoader provides application load statistics.

func (p *Policer) Run(ctx context.Context) {
defer func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these logs so useless?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, accidentally removed it. Put it back.

addrs, cursor, err = p.jobQueue.Select(cursor, p.batchSize)
if err != nil {
if errors.Is(err, engine.ErrEndOfListing) {
time.Sleep(1 * time.Second) // finished whole cycle, sleep a bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
time.Sleep(1 * time.Second) // finished whole cycle, sleep a bit
time.Sleep(time.Second) // finished whole cycle, sleep a bit

time.Sleep(1 * time.Second) // finished whole cycle, sleep a bit
continue
}
p.log.Warn("failure at object select for replication", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p.log.Warn("failure at object select for replication", zap.Error(err))
p.log.Warn("failure at object select for replication", zap.String("error", err.Error()))

and \n matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, \n are not produced anymore, even in wrapped errors! I think we simplified logger structure a while ago and it is not a case to worry now.

a := errors.New("deep error")
b := fmt.Errorf("included error: %w", a)
d := fmt.Errorf("included error two: %w", b)
c.log.Info("error", zap.Error(d)) // logger with config from neofs-dev-env

// 2021-11-24T09:50:09.841Z        info    neofs-node/main.go:59   error   {"error": "included error two: included error: deep error"} 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant \n is source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buy anyway, with current logger configuration, zap.Error is totally legit, though it produced some ugly output before and we stopped using it.

p.cache.Add(addrStr, time.Now())
})
if err != nil {
p.log.Warn("pool submission", zap.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zap.String

"go.uber.org/zap"
)

// NodeLoader provides functions to fetch application load statistic.
type nodeLoader interface {
// ObjectServiceLoad returns object service load value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ObjectServiceLoad returns object service load value.
// ObjectServiceLoad returns object service load value in [0:1] range.


p.prevTask.undone--
if p.taskPool.Cap() != newCapacity {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required check? Thought maybe pool.Tune does nothing if same capacity is passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is mostly for logger, to avoid log messages every second when capacity didn't change.

@cthulhu-rider
Copy link
Contributor

We can keep control of pool capacity value on the app-side, and on replicator's side only control the frequency of updates. In theory, you can even leave the periodicity on the side of the application.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Continues replication executed in separate pool of goroutines,
so there is no need in worker to handle replication tasks
asynchronously.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
@alexvanin
Copy link
Contributor Author

alexvanin commented Nov 24, 2021

We can keep control of pool capacity value on the app-side, and on replicator's side only control the frequency of updates. In theory, you can even leave the periodicity on the side of the application.

Yes, both are viable options. I can't say what are pros to stick with one or another option, but they will definitely work fine.

@alexvanin alexvanin merged commit 011d0f6 into nspcc-dev:master Nov 26, 2021
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Mar 5, 2022
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Mar 5, 2022
Continues replication executed in separate pool of goroutines,
so there is no need in worker to handle replication tasks
asynchronously.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants