Search in sources :

Example 1 with ControllerConf

use of com.linkedin.pinot.controller.ControllerConf in project pinot by linkedin.

the class PerfBenchmarkDriver method getControllerConf.

private ControllerConf getControllerConf() {
    ControllerConf conf = new ControllerConf();
    conf.setHelixClusterName(_clusterName);
    conf.setZkStr(_zkAddress);
    conf.setControllerHost(_controllerHost);
    conf.setControllerPort(String.valueOf(_controllerPort));
    conf.setDataDir(_controllerDataDir);
    conf.setTenantIsolationEnabled(false);
    conf.setControllerVipHost("localhost");
    conf.setControllerVipProtocol("http");
    return conf;
}
Also used : ControllerConf(com.linkedin.pinot.controller.ControllerConf)

Example 2 with ControllerConf

use of com.linkedin.pinot.controller.ControllerConf in project pinot by linkedin.

the class PerfBenchmarkDriver method startController.

private void startController() {
    if (!_conf.shouldStartController()) {
        LOGGER.info("Skipping start controller step. Assumes controller is already started.");
        return;
    }
    ControllerConf conf = getControllerConf();
    LOGGER.info("Starting controller at {}", _controllerAddress);
    new ControllerStarter(conf).start();
}
Also used : ControllerConf(com.linkedin.pinot.controller.ControllerConf) ControllerStarter(com.linkedin.pinot.controller.ControllerStarter)

Example 3 with ControllerConf

use of com.linkedin.pinot.controller.ControllerConf in project pinot by linkedin.

the class StartControllerCommand method readConfigFromFile.

@Override
ControllerConf readConfigFromFile(String configFileName) throws ConfigurationException {
    ControllerConf conf = null;
    if (configFileName == null) {
        return null;
    }
    File configFile = new File(_configFileName);
    if (!configFile.exists()) {
        return null;
    }
    conf = new ControllerConf(configFile);
    return (validateConfig(conf)) ? conf : null;
}
Also used : ControllerConf(com.linkedin.pinot.controller.ControllerConf) File(java.io.File)

Example 4 with ControllerConf

use of com.linkedin.pinot.controller.ControllerConf in project pinot by linkedin.

the class StartControllerCommand method execute.

@Override
public boolean execute() throws Exception {
    if (_controllerHost == null) {
        _controllerHost = NetUtil.getHostAddress();
    }
    ControllerConf conf = readConfigFromFile(_configFileName);
    if (conf == null) {
        if (_configFileName != null) {
            LOGGER.error("Error: Unable to find file {}.", _configFileName);
            return false;
        }
        conf = new ControllerConf();
        conf.setControllerHost(_controllerHost);
        conf.setControllerPort(_controllerPort);
        conf.setDataDir(_dataDir);
        conf.setZkStr(_zkAddress);
        conf.setHelixClusterName(_clusterName);
        conf.setControllerVipHost(_controllerHost);
        conf.setTenantIsolationEnabled(_tenantIsolation);
        conf.setRetentionControllerFrequencyInSeconds(3600 * 6);
        conf.setValidationControllerFrequencyInSeconds(3600);
    }
    LOGGER.info("Executing command: " + toString());
    final ControllerStarter starter = new ControllerStarter(conf);
    starter.start();
    String pidFile = ".pinotAdminController-" + String.valueOf(System.currentTimeMillis()) + ".pid";
    savePID(System.getProperty("java.io.tmpdir") + File.separator + pidFile);
    return true;
}
Also used : ControllerConf(com.linkedin.pinot.controller.ControllerConf) ControllerStarter(com.linkedin.pinot.controller.ControllerStarter)

Example 5 with ControllerConf

use of com.linkedin.pinot.controller.ControllerConf in project pinot by linkedin.

the class LLCSegmentCommitTest method testSegmentCommit.

@Test
public void testSegmentCommit() throws Exception {
    SegmentCompletionManager.create(createMockHelixManager(), null, new ControllerConf(), new ControllerMetrics(new MetricsRegistry()));
    FakeLLCSegmentCommit segmentCommit = new FakeLLCSegmentCommit();
    Representation representation;
    String strResponse;
    JSONObject jsonResponse;
    // If commitStart returns failed, upload should not be called, and the client should get 'failed'
    segmentCommit._uploadCalled = false;
    segmentCommit._scm.commitStartResponse = SegmentCompletionProtocol.RESP_FAILED;
    representation = segmentCommit.post(null);
    strResponse = representation.getText();
    jsonResponse = JSONObject.parseObject(strResponse);
    Assert.assertEquals(jsonResponse.get(SegmentCompletionProtocol.STATUS_KEY), SegmentCompletionProtocol.ControllerResponseStatus.FAILED.toString());
    Assert.assertFalse(segmentCommit._uploadCalled);
    // if commitStart returns continue, and upload fails, then commitEnd should indicate upload failure.
    segmentCommit._uploadCalled = false;
    segmentCommit._scm.commitStartResponse = SegmentCompletionProtocol.RESP_COMMIT_CONTINUE;
    segmentCommit._scm.commitEndResponse = SegmentCompletionProtocol.RESP_FAILED;
    segmentCommit._uploadReturnValue = false;
    representation = segmentCommit.post(null);
    strResponse = representation.getText();
    jsonResponse = JSONObject.parseObject(strResponse);
    Assert.assertEquals(jsonResponse.get(SegmentCompletionProtocol.STATUS_KEY), SegmentCompletionProtocol.ControllerResponseStatus.FAILED.toString());
    Assert.assertTrue(segmentCommit._uploadCalled);
    Assert.assertFalse(segmentCommit._scm.uploadSuccess);
    // If commitstart returns CONINUE and upload succeeds, we should return whatever commitEnd returns.
    segmentCommit._uploadCalled = false;
    segmentCommit._scm.commitStartResponse = SegmentCompletionProtocol.RESP_COMMIT_CONTINUE;
    segmentCommit._scm.commitEndResponse = SegmentCompletionProtocol.RESP_COMMIT_SUCCESS;
    segmentCommit._uploadReturnValue = true;
    representation = segmentCommit.post(null);
    strResponse = representation.getText();
    jsonResponse = JSONObject.parseObject(strResponse);
    Assert.assertEquals(jsonResponse.get(SegmentCompletionProtocol.STATUS_KEY), SegmentCompletionProtocol.ControllerResponseStatus.COMMIT_SUCCESS.toString());
    Assert.assertTrue(segmentCommit._uploadCalled);
    Assert.assertTrue(segmentCommit._scm.uploadSuccess);
}
Also used : ControllerConf(com.linkedin.pinot.controller.ControllerConf) MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) JSONObject(com.alibaba.fastjson.JSONObject) Representation(org.restlet.representation.Representation) ControllerMetrics(com.linkedin.pinot.common.metrics.ControllerMetrics) Test(org.testng.annotations.Test)

Aggregations

ControllerConf (com.linkedin.pinot.controller.ControllerConf)9 ControllerStarter (com.linkedin.pinot.controller.ControllerStarter)2 Test (org.testng.annotations.Test)2 JSONObject (com.alibaba.fastjson.JSONObject)1 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)1 IndexingConfig (com.linkedin.pinot.common.config.IndexingConfig)1 ControllerMetrics (com.linkedin.pinot.common.metrics.ControllerMetrics)1 LLCSegmentName (com.linkedin.pinot.common.utils.LLCSegmentName)1 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)1 File (java.io.File)1 Field (java.lang.reflect.Field)1 HashMap (java.util.HashMap)1 HelixAdmin (org.apache.helix.HelixAdmin)1 ZNRecord (org.apache.helix.ZNRecord)1 IdealState (org.apache.helix.model.IdealState)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Representation (org.restlet.representation.Representation)1 BeforeClass (org.testng.annotations.BeforeClass)1