apache / pinot

Apache Pinot - A realtime distributed OLAP datastore
https://pinot.apache.org/
Apache License 2.0
5.42k stars 1.27k forks source link

Rebalancing the segments didn't work when there is only one kafka partition #5402

Open buchireddy opened 4 years ago

buchireddy commented 4 years ago

Scenario Have a Pinot clustered setup with 4 Pinot servers. The Kafka topic from which Pinot is consuming has only one partition, because of which naturally only one server will be consuming. There were 100+ segments on that server after a while and we wanted to rebalance the finished segments onto other Pinot servers for rebalancing so tried rebalancing with the Controller side API.

Expected behavior Expected that all the finished segments will be rebalanced among all 4 pinot servers, instead of just the consuming server.

Observed behavior The segments were not moved out from that consuming Pinot server. Attached below is the response for the rebalance REST request.

Pinot version: 0.3.0

{
  "status": "IN_PROGRESS",
  "description": "In progress, check controller logs for updates",
  "instanceAssignment": {
    "CONSUMING": {
      "instancePartitionsName": "testTable_CONSUMING",
      "partitionToInstancesMap": {
        "0_0": [
          "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098",
          "Server_pinot-server-0.pinot-server.demo.svc.cluster.local_8098",
          "Server_pinot-server-1.pinot-server.demo.svc.cluster.local_8098",
          "Server_pinot-server-2.pinot-server.demo.svc.cluster.local_8098"
        ]
      }
    }
  },
  "segmentAssignment": {
    "testTable__0__3450__20200509T1501Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3451__20200509T1601Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3452__20200509T1701Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3453__20200509T1801Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3454__20200509T1902Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3455__20200509T2002Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3456__20200509T2102Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3457__20200509T2202Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3458__20200509T2302Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3459__20200510T0002Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3460__20200510T0102Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3461__20200510T0202Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3462__20200510T0302Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3463__20200510T0403Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3464__20200510T0503Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3465__20200510T0603Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3466__20200510T0703Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3467__20200510T0803Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3468__20200510T0903Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3469__20200510T1003Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3470__20200510T1103Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3471__20200510T1204Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3472__20200510T1304Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3473__20200510T1404Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3474__20200510T1504Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3475__20200510T1604Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3476__20200510T1704Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3477__20200510T1804Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3478__20200510T1904Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3479__20200510T2004Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3480__20200510T2105Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3481__20200510T2205Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3482__20200510T2305Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3483__20200511T0005Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3484__20200511T0105Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3485__20200511T0205Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3486__20200511T0305Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3487__20200511T0405Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3488__20200511T0505Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3489__20200511T0606Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3490__20200511T0706Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3491__20200511T0806Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3492__20200511T0906Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3493__20200511T1006Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3494__20200511T1106Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3495__20200511T1206Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3496__20200511T1306Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3497__20200511T1407Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3498__20200511T1507Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3499__20200511T1607Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3500__20200511T1707Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3501__20200511T1807Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3502__20200511T1907Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3503__20200511T2007Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3504__20200511T2107Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3505__20200511T2208Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3506__20200511T2308Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3507__20200512T0008Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3508__20200512T0108Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3509__20200512T0208Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3510__20200512T0308Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3511__20200512T0408Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3512__20200512T0508Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3513__20200512T0608Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3514__20200512T0709Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3515__20200512T0809Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3516__20200512T0909Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3517__20200512T1009Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3518__20200512T1109Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3519__20200512T1209Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3520__20200512T1309Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3521__20200512T1409Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3522__20200512T1510Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3523__20200512T1610Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3524__20200512T1710Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3525__20200512T1810Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3526__20200512T1910Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3527__20200512T2010Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3528__20200512T2110Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3529__20200512T2211Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3530__20200512T2311Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3531__20200513T0011Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3532__20200513T0111Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3533__20200513T0211Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3534__20200513T0311Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3535__20200513T0411Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3536__20200513T0512Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3537__20200513T0612Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3538__20200513T0712Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3539__20200513T0812Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3540__20200513T0912Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3541__20200513T1012Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3542__20200513T1112Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3543__20200513T1213Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3544__20200513T1313Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3545__20200513T1413Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3546__20200513T1513Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3547__20200513T1613Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3548__20200513T1713Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3549__20200513T1814Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3550__20200513T1914Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3551__20200513T2014Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3552__20200513T2114Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3553__20200513T2214Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3554__20200513T2315Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3555__20200514T0015Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3556__20200514T0115Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3557__20200514T0215Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3558__20200514T0315Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3559__20200514T0415Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3560__20200514T0516Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3561__20200514T0616Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3562__20200514T0716Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3563__20200514T0816Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3564__20200514T0916Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3565__20200514T1016Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3566__20200514T1116Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3567__20200514T1216Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3568__20200514T1316Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3569__20200514T1417Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3570__20200514T1517Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3571__20200514T1617Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3572__20200514T1717Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3573__20200514T1817Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "ONLINE"
    },
    "testTable__0__3574__20200514T1917Z": {
      "Server_pinot-server-3.pinot-server.demo.svc.cluster.local_8098": "CONSUMING"
    }
  }
}

Is the understanding of expected behavior correct? Is this a bug?

Jackie-Jiang commented 4 years ago

Hi @buchireddy, this is the expected behavior because partition-based assignment is implicit for the LLC consuming segments. In order to rebalance the completed segments on to another set of servers, you can configure another tag for the servers to hold the completed segments and use the TagOverrideConfig to relocate the completed segments to that tag.

E.g. your current TenantConfig is:

{
  "broker": "testTable",
  "server": "testTable"
}

You can configure a new tag "testTable_OFFLINE" and tag some servers, then change your TenantConfig to:

{
  "broker": "testTable",
  "server": "testTable",
  "tagOverrideConfig": {
    "realtimeConsuming": "testTable_REALTIME",
    "realtimeCompleted": "testTable_OFFLINE"
  }
}

Then the rebalancer will relocate the completed segments to the servers with tag "testTable_OFFLINE". We also have periodic task to automatically relocate the completed segments.