Search in sources :

Example 6 with SimpleSegmentMetadata

use of com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata in project pinot by linkedin.

the class PinotResourceManagerTest method testDeletingTheSameSegmentInSegmentDeletionManager.

@Test
public void testDeletingTheSameSegmentInSegmentDeletionManager() throws Exception {
    final SegmentMetadata segmentMetadata = new SimpleSegmentMetadata(TABLE_NAME);
    final String segmentName = segmentMetadata.getName();
    File segmentFile = new File(LOCAL_DISK_DIR + "/" + TABLE_NAME + "/" + segmentName);
    for (int i = 0; i < 2; i++) {
        addOneSegment(TABLE_NAME);
        // Waiting for the external view to update
        Thread.sleep(2000);
        final ExternalView externalView = _helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(TABLE_NAME));
        List<String> segmentsList = new ArrayList<>(externalView.getPartitionSet().size());
        segmentsList.addAll(externalView.getPartitionSet());
        _pinotHelixResourceManager.deleteSegments(TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(TABLE_NAME), segmentsList);
    }
    assert (!segmentFile.exists());
}
Also used : SimpleSegmentMetadata(com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata) SegmentMetadata(com.linkedin.pinot.common.segment.SegmentMetadata) ExternalView(org.apache.helix.model.ExternalView) ArrayList(java.util.ArrayList) File(java.io.File) SimpleSegmentMetadata(com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 7 with SimpleSegmentMetadata

use of com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata in project pinot by linkedin.

the class HelixBrokerStarterTest method addOneSegment.

private void addOneSegment(String tableName) {
    final SegmentMetadata segmentMetadata = new SimpleSegmentMetadata(tableName);
    LOGGER.info("Trying to add IndexSegment : " + segmentMetadata.getName());
    _pinotResourceManager.addSegment(segmentMetadata, "http://localhost:something");
}
Also used : SimpleSegmentMetadata(com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata) SegmentMetadata(com.linkedin.pinot.common.segment.SegmentMetadata) SimpleSegmentMetadata(com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata)

Aggregations

SegmentMetadata (com.linkedin.pinot.common.segment.SegmentMetadata)7 SimpleSegmentMetadata (com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata)7 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ExternalView (org.apache.helix.model.ExternalView)1 AfterTest (org.testng.annotations.AfterTest)1 BeforeTest (org.testng.annotations.BeforeTest)1 Test (org.testng.annotations.Test)1