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

Re-attempt partitionedLoad #140

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

Conversation

bcarter97
Copy link
Member

No description provided.

Copy link
Contributor

@lacarvalho91 lacarvalho91 left a comment

Choose a reason for hiding this comment

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

nice work

I think we also need to simulate 2 instances of an app, by having 2 partitionedLoadAndRun streams and then killing one of them and making sure the other one starts picking up data from the partition the killed stream had

if that makes sense

build.sbt Show resolved Hide resolved
publishToKafka(testTopic1, 0, preLoadPart1)
publishToKafka(testTopic1, 1, preLoadPart2)

val partitionedStream = TopicLoader
Copy link
Contributor

Choose a reason for hiding this comment

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

does this test fail if this was to use just loadAndRun?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean if we publish to one partition and then the other? It still passes with the loadAndRun:

    "execute callback when finished loading and keep streaming per partition" in new TestContext {
      val (preLoadPart1, postLoadPart1) = records(1 to 15).splitAt(10)
      val (preLoadPart2, postLoadPart2) = records(16 to 30).splitAt(10)
      val partitions: Long              = 2

      withRunningKafka {
        createCustomTopic(testTopic1, partitions = partitions.toInt)

        publishToKafka(testTopic1, 0, preLoadPart1)
        publishToKafka(testTopic1, 1, preLoadPart2)

        val ((callback, _), recordsProbe) =
          TopicLoader.loadAndRun[String, String](NonEmptyList.one(testTopic1)).toMat(TestSink.probe)(Keep.both).run()

        recordsProbe.request(
          preLoadPart1.size.toLong + postLoadPart1.size.toLong + preLoadPart2.size.toLong + postLoadPart2.size.toLong
        )
        recordsProbe
          .expectNextN(preLoadPart1.size.toLong + preLoadPart2.size.toLong)
          .map(recordToTuple) should contain theSameElementsAs preLoadPart1 ++ preLoadPart2

        whenReady(callback) { _ =>
          publishToKafka(testTopic1, 0, postLoadPart1)
          publishToKafka(testTopic1, 1, postLoadPart2)

          recordsProbe
            .expectNextN(postLoadPart1.size.toLong + postLoadPart2.size.toLong)
            .map(recordToTuple) should contain theSameElementsAs  postLoadPart1 ++ postLoadPart2
        }
      }
    }

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah so my point is i don't think we have a test that is proving this partitioned load functionality, considering the test passes even with loadAndRun

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