-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix/Nil panic in control service #2655
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2655 +/- ##
==========================================
- Coverage 30.62% 30.61% -0.01%
==========================================
Files 406 406
Lines 30070 30066 -4
==========================================
- Hits 9208 9206 -2
+ Misses 20085 20082 -3
- Partials 777 778 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall LGTM, left few suggestions
|
||
func (s *Server) ready() error { | ||
if !s.available.Load() { | ||
return status.Error(codes.Unavailable, "node has not started fully yet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me node
is smth higher level. I'd report service has not been completely initialized yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -13,6 +14,12 @@ import ( | |||
// Server is an entity that serves | |||
// Control service on storage node. | |||
type Server struct { | |||
// initialization sync; control service | |||
// is the first service to run so no other |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first service to run
is strange to see on the individual service: this field doesnt "know" what the app does, the app knows how Service
behaves
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can understand you but think that is too much of an abstraction then, do not think the control service can be reused anywhere else, only for the node and only as a main controlling service
this field doesnt "know" what the app does
yes, but we need this service to be split now. not because it is good for it but because we need it for its caller and this comment would allow a future reader to understand it faster
anyway, fixed the comment
cmd/neofs-node/control.go
Outdated
@@ -70,6 +58,17 @@ func initControlService(c *cfg) { | |||
c.wg.Done() | |||
}) | |||
}() | |||
|
|||
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why async worker? U know exactly when all needed components are ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think that is our common pattern but it was about IR, fixed
} | ||
// MarkReady marks server available. Before this call none of the other calls | ||
// are available except for the health checks. | ||
func (s *Server) MarkReady(e *engine.StorageEngine, nm netmap.Source, c container.Source, r *replicator.Replicator, st NodeState, tr TreeService) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to require all prms to be non-nil and insta panic otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Split service creation on two steps: 1. service creation with key initialization and basic health checks; 2. service real initialization that includes internals reading (such as storage engine, tree service, etc). The first one handles incoming requests when the app starts, the second one is responsible for the full work mode (storage engine initializations may take time in the real runs with the real objects stored). Signed-off-by: Pavel Karpy <[email protected]>
2825376
to
77404cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what useful can we do with the control service if it's not ready yet?
Health checks (the can be improved, see #2585 (comment)) and closing #2585. |
OK, we can have some more in the future. |
Split service creation on two steps:
The first one handles incoming requests when the app starts, the second one is responsible for the full work mode (storage engine initializations may take time in the real runs with the real objects stored).