Skip to content

Do not put data to ETCD when no date is changed. #5291

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
merged 5 commits into from
Jul 27, 2022

Conversation

style95
Copy link
Member

@style95 style95 commented Jul 21, 2022

Description

Schedulers and invokers periodically publish their states to ETCD but when no data is changed, we don't need to keep sending the same request to ETCD.
This is not to put data to ETCD when no data is changed.

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.


def canEqual(a: Any) = a.isInstanceOf[InvokerResourceMessage]

override def equals(that: Any): Boolean =
Copy link
Member Author

Choose a reason for hiding this comment

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

The data management service compares the message to decide whether to put data or not.
https://github.com/apache/openwhisk/blob/master/common/scala/src/main/scala/org/apache/openwhisk/core/service/DataManagementService.scala#L161

So we need to override the equals method to make it compare messages with ==.

@codecov-commenter
Copy link

codecov-commenter commented Jul 21, 2022

Codecov Report

Merging #5291 (ca75f44) into master (a03507c) will decrease coverage by 4.58%.
The diff coverage is 35.00%.

@@            Coverage Diff             @@
##           master    #5291      +/-   ##
==========================================
- Coverage   79.91%   75.32%   -4.59%     
==========================================
  Files         238      238              
  Lines       14161    14199      +38     
  Branches      603      577      -26     
==========================================
- Hits        11317    10696     -621     
- Misses       2844     3503     +659     
Impacted Files Coverage Δ
...rg/apache/openwhisk/core/scheduler/Scheduler.scala 10.38% <20.00%> (+0.32%) ⬆️
.../org/apache/openwhisk/core/connector/Message.scala 73.68% <40.00%> (-3.12%) ⬇️
...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%) ⬇️
...enwhisk/connector/kafka/KamonMetricsReporter.scala 0.00% <0.00%> (-83.34%) ⬇️
...e/database/cosmosdb/cache/KafkaEventProducer.scala 0.00% <0.00%> (-78.58%) ⬇️
... and 18 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

override def equals(that: Any): Boolean =
that match {
case that: InvokerResourceMessage => {
that.canEqual(this) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I think isInstanceOf is not required after using the case match?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good.
Updated accordingly.

override def equals(that: Any): Boolean =
that match {
case that: SchedulerStates => {
that.canEqual(this) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't required either

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@style95
Copy link
Member Author

style95 commented Jul 26, 2022

@jiangpengcheng If you have no comment, I would merge this.

@style95 style95 merged commit c507069 into apache:master Jul 27, 2022
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.

4 participants