I have added this to my configuration ``` "segme...
# troubleshooting
a
I have added this to my configuration
Copy code
"segmentPartitionConfig": {
        "columnPartitionMap": {
          "userId": {
            "functionName": "Murmur",
            "numPartitions": 5
          }
        }
      }
Copy code
"routing": {
      "segmentPrunerTypes": [
        "partition"
      ],
      "instanceSelectorType": "strictReplicaGroup"
    },
but I dont see multiple partitions here I only see
{\"numPartitions\":1,\"functionConfig\":null,\"functionName\":\"Murmur\",\"partitions\":[0]}}}",
but I am not seeing more partitions , I keep seeing this. @Yarden Rokach. @Rajat Venkatesh
g
I'm not an expert on ingestion, but I think you may need to refresh the stables (and also be sure you are actually sending the data to 5 different partitions in kafka or the system you use to ingest them)
a
So it’s a stream ingestion @Gonzalo Ortiz And the partition will be hash partition on userID . UserID/5 so whatever the hash of under ID is it should divide the data and send it to that node nodes underlying I don’t think Kafka partitions have much role to play here .
@Xiang Fu
g
where do you see that line?
{\"numPartitions\":1,\"functionConfig\":null,\"functionName\":\"Murmur\",\"partitions\":[0]}}}",
x
do you mean you have 5 kafka partitions and each partition data are using partitioned kafka producer to write to?
where you see this
{\"numPartitions\":1,\"functionConfig\":null,\"functionName\":\"Murmur\",\"partitions\":[0]}}}",
a
No I am trying to partition my data on column userId in 5 partitions based on hash so the relevant data goes and gets retrieved from the partition it needs to Mostly like a where clause Where userId=1234 For that case I am using partition here
x
oic, pinot won’t repartition data
you have to partition data in kafka to 5 partitions
then pinot can index the data in kafka partition then mark the partition
a
So what will be the configs ?
And how will I do or go out this ?
x
what you should do is: 1. alter kafka topic to 5 partitions 2. when you produce data to kafka, use the partition api with murmur3 so that the data are correctly partitioned
a
Also explain me please how this is done ? Pretty surprising to me . Also what if my data is from offline load then this Partition won’t be applicable there right ? How will I partition then in case I need the same scenario for lesser scans
x
the configs in pinot is sufficient, as long as the upstreams is partitioned correctly
a
So then I need to send data into Kafka key wise right ?
yes, pinot relies on the upstream partitioning
a
But do I have to keep the partition same ? Bc from what I understand 5 partition in Kafka will create 5 segments in the Pinot
So this won’t be a round robin but key based In a hashing way
x
you specified the partition strategy to murmur3 right
this is how the hash been computed then mod 5 to the right partition
You can assume that kafka and pinot partitions are 1:1 mapped
a
So if I have 10 partition In kafka then I have to do mention 10 partition in murmur3 right
Copy code
segmentPartitionConfig": {
        "columnPartitionMap": {
          "userId": {
            "functionName": "Murmur3",
            "numPartitions": 10
          }
        }
      }
x
yes
so the partition id will be consistent
We always recommend to prepartition enough
a
I see so means if we require 20 partitions in future we should go with the 20 partition in Kafka right ?
So that we don’t have to reparation it ?
g
Yes, it is smart to use more partitions in order to support future workloads
Otherwise if you are using 10 partitions and want to start using 20 you will need to reingest the data
a
But if we send data on key based from Kafka and send the same key to the same partition from Kafka side then why do we need all this murmur3 then ? The data will go in the segments which the partition is assigned to as we are already configuring with key to go to which partition on kafka side
g
In case of offline tables you can either split the files accordingly or use minion tasks to do that, but I don't remember whether the later is part of apache pinot or a StarTree extension
a
I am sorry but I am still not clear with the partition concept here when it has to be key based and I will know what key will go to with partition in Kafka and hence it will go to the segment assigned to that partition then why I need basing there as it’s already going to the assigned partition
g
The murmur config is not required, but it is an optimization. If you supply that, pinot will be able to prune segments on queries with filters like where partitionCol = constantValue
a
I see so this entire
Copy code
segmentPartitionConfig": {
        "columnPartitionMap": {
          "userId": {
            "functionName": "Murmur",
            "numPartitions": 5
          }
        }
      }
Config is just for faster query reads but I thought that’s where the indexing comes into picture
g
pinot is not going to shuffle your rows to different segments if you provide that config. Instead it will enrich the already existent (and new) segments adding them a metainfo that indicate which partition they belong to. Then when running queries like
select whatever from table where userId = 'a'
Pinot will transform that into something like
select whatever from table where userId = 'a' and murmur(userId) % 5 = murmur('a') % 5
(I mean, not exactly that, but it will prune segments by only reading the ones that contain at least one row such as
murmur(userId) % 5 = murmur('a') % 5
. Ideally you would partition your data in the same way at ingestion (ie, configuring kafka to partition by userId and have partitions for any k). If you do so, it is going to be guaranteed that each segment will contain data for exactly one partition, which means that the query above will only read 1/5 of your data
Config is just for faster query reads but I thought that’s where the indexing comes into picture
Indexes are another layer of improvement in queries. Pinot first prunes segments and then apply indexes. Using indexes is faster than full scans, but pruning segments is even faster than using indexes
a
Got it so let’s say I have 5 userID, xyz id They both make primary Now what will be the steps here I first Send the data from my Kafka for the same partition on key based right and then once it reaches Pinot it applies murmur on that primary key or key based
Right
g
yes
a
But then won’t it affect the data from Kafka bc I am sending one key combination to a certain partition and murmur5 will have its own hashing on top of it
g
you have to configure kafka to partition by that same key, yes
a
Let me once try to do it and then get back to you if I have issues ? Does that work . I’ll probably try it today or tomorrow
g
cool!
x
Please let us know.
Also one suggestion, lets try to use a slack thread for one topic to discussion, so it won’t flush the whole channel 🙂
a
sure will definitely try to keep on one topic