policer: add check for repeated error logging #914

Merged
fyrchik merged 1 commit from elebedeva/frostfs-node:fix/policer-error-log into master 2024-02-06 07:51:14 +00:00
Member

Relates #110

processObject() returns 3 types of errors:

  1. container not found errors
  2. could not get container error
  3. placement vector building error

Every error will occur for all objects in container simultaneously, so we can log each error once and safely ignore the rest.

Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com

Relates #110 ```processObject()``` returns 3 types of errors: 1. container not found errors 2. could not get container error 3. placement vector building error Every error will occur for all objects in container simultaneously, so we can log each error once and safely ignore the rest. Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
elebedeva requested review from storage-core-committers 2024-01-16 14:09:48 +00:00
elebedeva requested review from storage-core-developers 2024-01-16 14:09:51 +00:00
aarifullin reviewed 2024-01-16 14:41:25 +00:00
@ -71,2 +77,4 @@
}
}
func skipLog(errs []string, err string) bool {
Member

I am sure this method works fine in your case :) And my change request is absolutely optional. But it works until incoming err gets wrapped for some reason by another error. So, better to not compare them like strings, but make

cnrErrSkip := make(map[cid.ID][]error)

and then

import errors
/* ... */
func skipLog(errs []error, err err) bool {
   for _, e := range errs {
      if errors.Is(err, e) {
         return true
      }
   }
   return false
}
I am sure this method works fine in your case :) And my change request is absolutely optional. But it works until incoming `err` gets wrapped for some reason by another error. So, better to not compare them like strings, but make ```go cnrErrSkip := make(map[cid.ID][]error) ``` and then ```go import errors /* ... */ func skipLog(errs []error, err err) bool { for _, e := range errs { if errors.Is(err, e) { return true } } return false } ```
Owner

Btw, another think to think about is that we can fail to connect to different nodes -- I would like to see this in logs.
But it is probably not too important -- if a node is isolated, lot's of other errors will occur.

Btw, another think to think about is that we can fail to connect to different nodes -- I would like to see this in logs. But it is probably not too important -- if a node is isolated, lot's of other errors will occur.
fyrchik reviewed 2024-01-16 16:13:41 +00:00
@ -53,10 +57,12 @@ func (p *Policer) shardPolicyWorker(ctx context.Context) {
if p.objsInWork.add(addr.Address) {
err := p.processObject(ctx, addr)
Owner

processObject can return errors not only from container build, but also because some nodes are unavailable.
Can you give a list of errors (not full, just some groups) which we will ignore here?
It seems everything is ok, the last error is

return fmt.Errorf("%s: %w", logs.PolicerCouldNotBuildPlacementVectorForObject, err)

-- it will fail for all objects simultaneously, but some comment would still be nice, like "we can receive only 3 types of error, thus ignoring is safe".

`processObject` can return errors not only from container build, but also because some nodes are unavailable. Can you give a list of errors (not full, just some groups) which we will ignore here? It seems everything is ok, the last error is https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/681b2c5fd45f3c6763db2be3509575d3c3f967db/pkg/services/policer/check.go#L46 -- it will fail for all objects simultaneously, but some comment would still be nice, like "we can receive only 3 types of error, thus ignoring is safe".
Owner

Maybe even do this in the commit message.

Maybe even do this in the commit message.
dstepanov-yadro approved these changes 2024-01-22 15:21:59 +00:00
fyrchik reviewed 2024-01-23 07:20:37 +00:00
@ -73,0 +79,4 @@
func skipLog(errs []string, err string) bool {
for _, strErr := range errs {
if strErr == err {
Owner

Are you sure this will work correctly? For pointer newly created pointer types (consider fmt.Errorf) we will have false here.

Are you sure this will work correctly? For pointer newly created pointer types (consider `fmt.Errorf`) we will have `false` here.
Author
Member

fixed

fixed
fyrchik reviewed 2024-01-23 08:08:14 +00:00
@ -51,3 +51,1 @@
var (
errMissingOID = fmt.Errorf("object ID is not set")
)
var errMissingOID = fmt.Errorf("object ID is not set")
Owner

It is a good change, but can we move it to a separate commit?

It is a good change, but can we move it to a separate commit?
achuprov approved these changes 2024-01-23 14:02:29 +00:00
elebedeva force-pushed fix/policer-error-log from 010d7fe87c to 8db3f747cc 2024-01-30 07:16:19 +00:00 Compare
aarifullin approved these changes 2024-01-30 08:07:47 +00:00
acid-ant approved these changes 2024-01-30 10:33:02 +00:00
elebedeva force-pushed fix/policer-error-log from 8db3f747cc to afd2ba9a66 2024-02-05 21:57:27 +00:00 Compare
elebedeva requested review from acid-ant 2024-02-05 22:46:41 +00:00
elebedeva requested review from aarifullin 2024-02-05 22:46:42 +00:00
elebedeva requested review from achuprov 2024-02-05 22:46:44 +00:00
elebedeva requested review from dstepanov-yadro 2024-02-05 22:46:45 +00:00
fyrchik approved these changes 2024-02-06 07:51:06 +00:00
fyrchik merged commit afd2ba9a66 into master 2024-02-06 07:51:14 +00:00
elebedeva deleted branch fix/policer-error-log 2024-02-06 12:35:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#914
No description provided.