Hey folks!

We have noticed some inconsistencies in message ordering when running a
StreamApplication that calls two separate `map` functions over an input
and sends results to the same output. I have attached my Execution Plan,
but the gist is that the first `map` function marks a thing as "pending"
by sending a message to a status topic and the second `map` function
does some work then sends its own status with "done".

We have a test set up to read the resulting status topic with a normal
Kafka consumer to ensure that two status messages were produced by Samza
and consumed in the proper order (first "pending", then "done", per the
order of the MessageStream call chains). This test flaps pretty
routinely since upgrading to Samza 1.0; we never noticed this in the
past. Sometimes, it times out waiting for any messages, though that's
considerably less rare than the ordering issue. My understanding is, for
a given Task, by default, all processing should be done serially. Is
that no longer true? Is the guarantee *only* for the order in which
messages are consumed, not produced?

For test simplicity, there's a single Kafka partition for each topic and
I attempted to create a configuration file that would eliminate as much
coordination and concurrency sources as I knew how:

 processor.id=0
 
job.coordinator.factory=org.apache.samza.standalone.PassthroughJobCoordinatorFactory
 job.container.single.thread.mode=true

(We use the ZkJobCoordinatorFactory normally but both produce the bug)

I realize the KafkaProducer does not *technically* guarantee delivery
order except when using transactions, which KafkaSystemProducer doesn't
appear to do by default. I have checked the actual message envelope and
when the ordering is wrong, the offset order is correct -- so, "done"
was recorded by Kafka prior to "pending". This seems to rule out Samza
but I'm not entirely confident in that conclusion. Any thoughts?

Thanks,

Tom

Attachment: plan.json
Description: application/json

Reply via email to