I would like to understand some details on how state stores and topic partitions are assigned to Stream Processing applications and their tasks.
Let's say I have a 4-partition Topic (tA). I also have 4 instances (i0,i1,i2,i3) of the same application.id (myApp) running on 4 different machines and streaming records from tA. The streaming engine will allocate 1 partition to each application instance. For the sake of argument, let's say partition allocation is : p0->i0, p1->i1, p2->i2 and p3->i3 And also assume my streaming application instances all create their state stores SS0, SS1,SS2,SS3. So basically, SS0 will hold records (keys) corresponding to p0, SS1->p1 etc.
Now, if i0 and i1 go down, and if i2 and i3 get reassigned additional partitions p0 and p1 respectively. Will the corresponding state stores that had p0 and p1 keys also get reassigned with those partitions ?
In short, my question is : do partitions and the state stores get associated with each other so that during reassignment, they move together ? i.e. we will never have the case that the task that gets p0 gets ss1 ?