Skip to content

SAMZA-2562: [Scala cleanup] Clean up Scala in samza-kv-inmemory and samza-kv-couchbase#1404

Merged
cameronlee314 merged 2 commits intoapache:masterfrom
cameronlee314:kv_scala
Jul 28, 2020
Merged

SAMZA-2562: [Scala cleanup] Clean up Scala in samza-kv-inmemory and samza-kv-couchbase#1404
cameronlee314 merged 2 commits intoapache:masterfrom
cameronlee314:kv_scala

Conversation

@cameronlee314
Copy link
Copy Markdown
Contributor

@cameronlee314 cameronlee314 commented Jul 27, 2020

Issues:

  1. samza-kv-couchbase uses the Scala Gradle plugin but does not have Scala code
  2. samza-kv-inmemory is in Scala, but we are no longer using Scala in Samza, so it would be good to move to Java.
  3. samza-kv-inmemory is missing unit tests

Changes:

  1. Rewrite samza-kv-inmemoryin Java (no functional changes)
  2. Remove usage of Scala Gradle plugin for samza-kv-couchbase and samza-kv-inmemory
  3. Add unit tests for InMemoryKeyValueStore in samza-kv-inmemory.

Tests:

  1. Added unit tests for original Scala version of InMemoryKeyValueStore and verified that they passed.
  2. Tests pass for new Java version of InMemoryKeyValueStore.
  3. ./gradlew build (some of the tests in samza-test use InMemoryKeyValueStore).

API changes: I don't think the InMemoryKeyValueStore is part of the Samza API, since InMemoryKeyValueStorageEngineFactory is supposed to be used, but the InMemoryKeyValueStore constructor did change from having one KeyValueStoreMetrics argument with a default value of new KeyValueStoreMetrics to having a required KeyValueStoreMetrics argument. I believe this only applies to Scala usage of InMemoryKeyValueStore, since Java usage requires all arguments (even ones with default values) to be passed anyways.

Upgrade/usage instructions: If using the InMemoryKeyValueStore constructor in another Scala class, then add the KeyValueStoreMetrics argument. It's unlikely that anyone is depending on this constructor explicitly.

Notes:
While writing the unit tests, I found a couple of bugs: https://issues.apache.org/jira/browse/SAMZA-2563 (InMemoryKeyValueStore double counts deletes in metrics) and https://issues.apache.org/jira/browse/SAMZA-2564 (InMemoryKeyValueStore.snapshot does not satisfy immutability API). I did not include fixes in this PR, since I want to keep the Scala refactoring separate from any functional changes.
This PR is not intended to have any functional changes.

@cameronlee314
Copy link
Copy Markdown
Contributor Author

@bkonold Could you please review?

Copy link
Copy Markdown
Contributor

@bkonold bkonold left a comment

Choose a reason for hiding this comment

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

lgtm for the most part, minor comments

Copy link
Copy Markdown
Contributor

@bkonold bkonold left a comment

Choose a reason for hiding this comment

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

lgtm.

@cameronlee314 cameronlee314 merged commit 3b7d0d1 into apache:master Jul 28, 2020
lakshmi-manasa-g pushed a commit to lakshmi-manasa-g/samza that referenced this pull request Feb 9, 2021
…amza-kv-couchbase (apache#1404)

API changes: I don't think the InMemoryKeyValueStore is part of the Samza API, since InMemoryKeyValueStorageEngineFactory is supposed to be used, but the InMemoryKeyValueStore constructor did change from having one KeyValueStoreMetrics argument with a default value of new KeyValueStoreMetrics to having a required KeyValueStoreMetrics argument. I believe this only applies to Scala usage of InMemoryKeyValueStore, since Java usage requires all arguments (even ones with default values) to be passed anyways.

Upgrade/usage instructions: If using the InMemoryKeyValueStore constructor in another Scala class, then add the KeyValueStoreMetrics argument. It's unlikely that anyone is depending on this constructor explicitly.
@cameronlee314 cameronlee314 deleted the kv_scala branch November 17, 2021 23:27
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.

2 participants