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

Switch to Scala 2.12.7 #4062

Merged
merged 13 commits into from
Nov 6, 2018
Merged

Switch to Scala 2.12.7 #4062

merged 13 commits into from
Nov 6, 2018

Conversation

chetanmeh
Copy link
Member

@chetanmeh chetanmeh commented Oct 10, 2018

Updates the Scala compiler and library to 2.12.7

Description

Apart from switching the jar versions to 2.12 some code changes were required to avoid use of now deprecated features.

Related issue and scope

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • 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.

Copy link
Member

@rabbah rabbah left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@markusthoemmes markusthoemmes left a comment

Choose a reason for hiding this comment

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

Thanks a lot for doing this, got one minor nit which I think should be addressed though.

f.onSuccess({
case _ => transid.finished(this, start, s"[PUT] '$dbName' completed document: '$docinfoStr'")
})
f.foreach(_ => transid.finished(this, start, s"[PUT] '$dbName' completed document: '$docinfoStr'"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use onComplete everywhere there's the success/failure case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@chetanmeh
Copy link
Member Author

Compilation time for whole project via reduced from 2 min 39 sec to 1 min 46 sec, thus a 33% improvement !!

$./gradlew clean
$./gradlew compileScala compileTestScala 

@chetanmeh
Copy link
Member Author

Compilation time is reduced specially for test module

2.11 2.12
image image

@codecov-io
Copy link

codecov-io commented Oct 11, 2018

Codecov Report

Merging #4062 into master will increase coverage by 4.51%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4062      +/-   ##
==========================================
+ Coverage   76.63%   81.14%   +4.51%     
==========================================
  Files         148      148              
  Lines        7249     7113     -136     
  Branches      445      439       -6     
==========================================
+ Hits         5555     5772     +217     
+ Misses       1694     1341     -353
Impacted Files Coverage Δ
...scala/whisk/core/mesos/MesosContainerFactory.scala 61.81% <ø> (ø) ⬆️
...core/database/cosmosdb/CosmosDBArtifactStore.scala 0% <0%> (-95.54%) ⬇️
...on/scala/src/main/scala/whisk/common/Logging.scala 89.58% <0%> (+2.21%) ⬆️
...n/scala/whisk/core/database/CouchDbRestStore.scala 73.23% <100%> (ø) ⬆️
...ala/whisk/core/database/s3/S3AttachmentStore.scala 85.71% <100%> (ø) ⬆️
.../src/main/scala/whisk/core/connector/Message.scala 64.86% <100%> (+7.33%) ⬆️
...rc/main/scala/whisk/core/database/StoreUtils.scala 100% <100%> (ø) ⬆️
...cala/src/main/scala/whisk/core/entity/Limits.scala 84.61% <100%> (ø) ⬆️
...core/controller/BasicAuthenticationDirective.scala 100% <100%> (+42.85%) ⬆️
...isk/core/database/memory/MemoryArtifactStore.scala 97.54% <83.33%> (-0.84%) ⬇️
... and 61 more

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 f47410d...5262791. Read the comment docs.

@chetanmeh chetanmeh added the wip label Oct 11, 2018
@chetanmeh
Copy link
Member Author

Before we merge this to master we need to have PR for all other OpenWhisk repo relying on core repo and then coordinate the merge across all those repos

@chetanmeh
Copy link
Member Author

Created 16 PR 😰 and no code change needed in other repos. Of 16 build is failing for 4 for reasons not related to this change.

Once this PR is merged those 16 PR would need to be updated to point to latest master and then merged

@chetanmeh chetanmeh removed the wip label Oct 11, 2018
@chetanmeh
Copy link
Member Author

@vvraskin @cbickel Can you check if your downstream project can compile fine with this change. If required you can use the PR branch

git clone --depth=1 --single-branch -b scala-2-12 https://github.com/chetanmeh/incubator-openwhisk.git openwhisk

@markusthoemmes
Copy link
Contributor

Kudos @chetanmeh this is a lot of repetitive work. Thanks a ton for pulling through!

@chetanmeh
Copy link
Member Author

@csantanapr I have reverted all git branch change from various PR. So all PR now only have required changes for Scala 2.12 support.

@csantanapr
Copy link
Member

In IBM we did some refactoring in our internal repos and public repos for this and we are ready for the Scala bump.

@csantanapr
Copy link
Member

The conflict needs to be resolved before we can start the merge fest.

@chetanmeh
Copy link
Member Author

Post rebase the invoker is throwing exception at runtime

Exception in thread "pool-1-thread-3" java.lang.AbstractMethodError: Method whisk/core/connector/CompletionMessage.whisk$core$connector$Message$_setter_$transid_$eq(Lwhisk/common/TransactionMetadata;)V is abstract
	at whisk.core.connector.CompletionMessage.whisk$core$connector$Message$_setter_$transid_$eq(Message.scala)
	at whisk.core.connector.Message.$init$(Message.scala:31)
	at whisk.core.connector.AcknowledegmentMessage.<init>(Message.scala:78)
	at whisk.core.connector.CompletionMessage.<init>(Message.scala:93)
	at whisk.core.invoker.InvokerReactive.whisk$core$invoker$InvokerReactive$$send$1(InvokerReactive.scala:128)
	at whisk.core.invoker.InvokerReactive.$anonfun$ack$1(InvokerReactive.scala:149)
	at whisk.core.invoker.InvokerReactive.$anonfun$ack$1$adapted(InvokerReactive.scala:121)
	at whisk.core.containerpool.ContainerProxy.$anonfun$initializeAndRun$15(ContainerProxy.scala:428)
	at scala.util.Success.foreach(Try.scala:249)
	at scala.concurrent.Future.$anonfun$foreach$1$adapted(Future.scala:225)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
	at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Strangely compilation passes fine. The transid in Message is getting marked as abstract even though its provided in case class parameters

Seems like this was changed in #4041 and may be a bug in Scala compiler. Needs further investigation

@chetanmeh
Copy link
Member Author

The issue can be seen with this fiddle. It passes with 2.11 but fails with 2.12. Probably related to scala/bug#10477

@@ -75,8 +75,8 @@ object ActivationMessage extends DefaultJsonProtocol {
* Message that is sent from the invoker to the controller after action is completed or after slot is free again for
* new actions.
*/
abstract class AcknowledegmentMessage() extends Message {
override val transid: TransactionId
abstract class AcknowledegmentMessage(private val tid: TransactionId) extends Message {
Copy link
Member Author

@chetanmeh chetanmeh Nov 6, 2018

Choose a reason for hiding this comment

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

Had to change code here to workaround Scala compiler bug (see previous comments)

cc @cbickel

@chetanmeh
Copy link
Member Author

@csantanapr The PR is green now. So we can now do the merge

@csantanapr
Copy link
Member

thanks @chetanmeh 👍

@csantanapr csantanapr merged commit b860a2e into apache:master Nov 6, 2018
@chetanmeh
Copy link
Member Author

Thanks @csantanapr for taking care of merge and changes in all other repos

@chetanmeh chetanmeh deleted the scala-2-12 branch November 7, 2018 09:52
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
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.

None yet

5 participants