Skip to content

Clean Up Etcd Worker Actor #5323

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

Merged

Conversation

bdoyle0182
Copy link
Contributor

Description

I don't think this is the root of my issue with the scheduler not learning that a container has been removed, but nevertheless this is a valuable refactor to make sure everything is thread safe in this actor.

There should be no behavior change to the actor at all, should be 100% refactor.

This pr does a couple things:

  1. Move etcd worker to its own file under the etcd folder in commons
  2. Clean up the error handling to remove duplicate code
  3. Make the retry handling more thread safe by first forwarding the retry message and using the actor's internal timers scheduler rather than the system scheduler
  4. Fix non-thread safe access to actor member variable lease from future callbacks through 3.
  5. Add unit tests for EtcdWorker which previously wasn't covered.

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Scheduler
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@bdoyle0182 bdoyle0182 requested a review from style95 September 12, 2022 21:54
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2022

Codecov Report

Merging #5323 (a2d1f5b) into master (138f3d9) will decrease coverage by 4.31%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #5323      +/-   ##
==========================================
- Coverage   81.03%   76.71%   -4.32%     
==========================================
  Files         239      240       +1     
  Lines       14245    14242       -3     
  Branches      594      616      +22     
==========================================
- Hits        11543    10926     -617     
- Misses       2702     3316     +614     
Impacted Files Coverage Δ
...openwhisk/core/service/DataManagementService.scala 92.18% <ø> (+47.91%) ⬆️
...he/openwhisk/core/invoker/FPCInvokerReactive.scala 0.00% <ø> (ø)
...rg/apache/openwhisk/core/scheduler/Scheduler.scala 10.75% <ø> (+0.36%) ⬆️
...la/org/apache/openwhisk/core/etcd/EtcdWorker.scala 66.66% <66.66%> (ø)
...core/database/cosmosdb/RxObservableImplicits.scala 0.00% <0.00%> (-100.00%) ⬇️
...ore/database/cosmosdb/cache/CacheInvalidator.scala 0.00% <0.00%> (-100.00%) ⬇️
...e/database/cosmosdb/cache/ChangeFeedConsumer.scala 0.00% <0.00%> (-100.00%) ⬇️
...core/database/cosmosdb/CosmosDBArtifactStore.scala 0.00% <0.00%> (-95.85%) ⬇️
...sk/core/database/cosmosdb/CosmosDBViewMapper.scala 0.00% <0.00%> (-93.90%) ⬇️
...tabase/cosmosdb/cache/CacheInvalidatorConfig.scala 0.00% <0.00%> (-92.31%) ⬇️
... and 15 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@style95 style95 left a comment

Choose a reason for hiding this comment

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

@bdoyle0182 Thank you for handling this.
The changes look great to me with a minor nit.

expectMsg(FinishWork(key))
}

it should "retry request after failure if lease does not exist" in {
Copy link
Member

Choose a reason for hiding this comment

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

Can we also add other negative tests for RegisterData and RegisterInitialData?

@style95
Copy link
Member

style95 commented Oct 5, 2022

I merging this as-is because my comment is incidental.

@style95 style95 merged commit 236ca5e into apache:master Oct 5, 2022
msciabarra pushed a commit to nuvolaris/openwhisk that referenced this pull request Nov 23, 2022
* clean up etcd worker actor

* revert etcd client local change for unit testing

* fix scala 2.13 compilation

Co-authored-by: Brendan Doyle <[email protected]>
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.

3 participants