Kafka, mail # dev - Re: Random Partitioning Issue - 2013-09-27, 17:31
Solr & Elasticsearch trainings in New York & San Francisco [more info][hide]
 Search Hadoop and all its subprojects:

Switch to Threaded View
Copy link to this message
-
Re: Random Partitioning Issue
hmmm, yeah, on I don't want todo that ... if we don't have to.

What if the DefaultPartitioner code looked like this instead =8^)

private class DefaultPartitioner[T](props: VerifiableProperties = null)
extends Partitioner[T] {

  def partition(key: T, numPartitions: Int): Int = {
    if (key == null) {
        import java.util.UUID
        Utils.abs(UUID.randomUUID.toString()) % numPartitions
    }
    else {
       Utils.abs(key.hashCode) % numPartitions
    }
  }
}
Again the goal here is the simple (often initial and dev side up and
running out of the box) so folks don't have to randomize the keys
themselves to get this effect

We would still have to also have RandomMetaRefreshPartitioner class right?
so null keys there would wait for the time refresh for that use case, right?

private class RandomMetaRefreshPartitioner[T](props: VerifiableProperties =
null) extends Partitioner[T] {

  def partition(key: T, numPartitions: Int): Int = {
    Utils.abs(key.hashCode) % numPartitions
  }
}
On Fri, Sep 27, 2013 at 1:10 PM, Jun Rao <[EMAIL PROTECTED]> wrote:
 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB