Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # dev >> Is DefaultEventHandler.collate sort order important?

Copy link to this message
Is DefaultEventHandler.collate sort order important?
I'm working on a patch to allow for cross-building kafka to both scala 2.8.0 and 2.9.x, and I'm down to one very minor snag in the unit tests. In AsyncProducerTest, the testCollateAndSerializeEvents test fails because default HashMap ordering for toArray (used by DefaultEventHandler.collate) changed between versions. The EasyMock expected call for multisend then fails because the ProducerRequests aren't in the same order:

  Unexpected method call multiSend([ProducerRequest(test-topic,0,70), ProducerRequest(test1$topic,0,75), ProducerRequest(test1$topic,1,75), ProducerRequest(test-topic,1,70)]):
    multiSend([ProducerRequest(test1$topic,1,75), ProducerRequest(test-topic,0,70), ProducerRequest(test-topic,1,70), ProducerRequest(test1$topic,0,75)]): expected: 1, actual: 0

Is sort order of the keys significant in any way, and if not would the preferred fix be a change to the EasyMock matcher to ignore order for the argument? Or would it be preferable to do a stable sort (perhaps change collate to return a List[(String,Int), Seq[T]])?



Derek Chen-Becker
Lead Infrastructure Engineer