Search in sources :

Example 1 with TimelineService

use of org.apache.hudi.timeline.service.TimelineService in project hudi by apache.

the class TestRemoteHoodieTableFileSystemView method getFileSystemView.

protected SyncableFileSystemView getFileSystemView(HoodieTimeline timeline) {
    FileSystemViewStorageConfig sConf = FileSystemViewStorageConfig.newBuilder().withStorageType(FileSystemViewStorageType.SPILLABLE_DISK).build();
    HoodieMetadataConfig metadataConfig = HoodieMetadataConfig.newBuilder().build();
    HoodieCommonConfig commonConfig = HoodieCommonConfig.newBuilder().build();
    HoodieLocalEngineContext localEngineContext = new HoodieLocalEngineContext(metaClient.getHadoopConf());
    try {
        server = new TimelineService(localEngineContext, new Configuration(), TimelineService.Config.builder().serverPort(0).build(), FileSystem.get(new Configuration()), FileSystemViewManager.createViewManager(localEngineContext, metadataConfig, sConf, commonConfig));
        server.startService();
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
    LOG.info("Connecting to Timeline Server :" + server.getServerPort());
    view = new RemoteHoodieTableFileSystemView("localhost", server.getServerPort(), metaClient);
    return view;
}
Also used : FileSystemViewStorageConfig(org.apache.hudi.common.table.view.FileSystemViewStorageConfig) HoodieMetadataConfig(org.apache.hudi.common.config.HoodieMetadataConfig) HoodieCommonConfig(org.apache.hudi.common.config.HoodieCommonConfig) Configuration(org.apache.hadoop.conf.Configuration) TimelineService(org.apache.hudi.timeline.service.TimelineService) RemoteHoodieTableFileSystemView(org.apache.hudi.common.table.view.RemoteHoodieTableFileSystemView) HoodieLocalEngineContext(org.apache.hudi.common.engine.HoodieLocalEngineContext)

Example 2 with TimelineService

use of org.apache.hudi.timeline.service.TimelineService in project hudi by apache.

the class EmbeddedTimelineService method startServer.

public void startServer() throws IOException {
    TimelineService.Config.Builder timelineServiceConfBuilder = TimelineService.Config.builder().serverPort(writeConfig.getEmbeddedTimelineServerPort()).numThreads(writeConfig.getEmbeddedTimelineServerThreads()).compress(writeConfig.getEmbeddedTimelineServerCompressOutput()).async(writeConfig.getEmbeddedTimelineServerUseAsync()).refreshTimelineBasedOnLatestCommit(writeConfig.isRefreshTimelineServerBasedOnLatestCommit());
    // if timeline-server-based markers are used.
    if (writeConfig.getMarkersType() == MarkerType.TIMELINE_SERVER_BASED) {
        timelineServiceConfBuilder.enableMarkerRequests(true).markerBatchNumThreads(writeConfig.getMarkersTimelineServerBasedBatchNumThreads()).markerBatchIntervalMs(writeConfig.getMarkersTimelineServerBasedBatchIntervalMs()).markerParallelism(writeConfig.getMarkersDeleteParallelism());
    }
    server = new TimelineService(context, hadoopConf.newCopy(), timelineServiceConfBuilder.build(), FSUtils.getFs(basePath, hadoopConf.newCopy()), viewManager);
    serverPort = server.startService();
    LOG.info("Started embedded timeline server at " + hostAddr + ":" + serverPort);
}
Also used : HoodieWriteConfig(org.apache.hudi.config.HoodieWriteConfig) FileSystemViewStorageConfig(org.apache.hudi.common.table.view.FileSystemViewStorageConfig) TimelineService(org.apache.hudi.timeline.service.TimelineService)

Example 3 with TimelineService

use of org.apache.hudi.timeline.service.TimelineService in project hudi by apache.

the class HoodieClientTestUtils method initTimelineService.

/**
 * Initializes timeline service based on the write config.
 *
 * @param context             {@link HoodieEngineContext} instance to use.
 * @param basePath            Base path of the table.
 * @param timelineServicePort Port number to use for timeline service.
 * @return started {@link TimelineService} instance.
 */
public static TimelineService initTimelineService(HoodieEngineContext context, String basePath, int timelineServicePort) {
    try {
        HoodieWriteConfig config = HoodieWriteConfig.newBuilder().withPath(basePath).withFileSystemViewConfig(FileSystemViewStorageConfig.newBuilder().withRemoteServerPort(timelineServicePort).build()).build();
        TimelineService timelineService = new TimelineService(context, new Configuration(), TimelineService.Config.builder().enableMarkerRequests(true).serverPort(config.getViewStorageConfig().getRemoteViewServerPort()).build(), FileSystem.get(new Configuration()), FileSystemViewManager.createViewManager(context, config.getMetadataConfig(), config.getViewStorageConfig(), config.getCommonConfig()));
        timelineService.startService();
        LOG.info("Timeline service server port: " + timelineServicePort);
        return timelineService;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) TimelineService(org.apache.hudi.timeline.service.TimelineService) HoodieWriteConfig(org.apache.hudi.config.HoodieWriteConfig) HoodieException(org.apache.hudi.exception.HoodieException) IOException(java.io.IOException)

Example 4 with TimelineService

use of org.apache.hudi.timeline.service.TimelineService in project hudi by apache.

the class TestTimelineServerBasedWriteMarkers method setup.

@BeforeEach
public void setup() throws IOException {
    initPath();
    initMetaClient();
    this.jsc = new JavaSparkContext(HoodieClientTestUtils.getSparkConfForTest(TestTimelineServerBasedWriteMarkers.class.getName()));
    this.context = new HoodieSparkEngineContext(jsc);
    this.fs = FSUtils.getFs(metaClient.getBasePath(), metaClient.getHadoopConf());
    this.markerFolderPath = new Path(metaClient.getMarkerFolderPath("000"));
    FileSystemViewStorageConfig storageConf = FileSystemViewStorageConfig.newBuilder().withStorageType(FileSystemViewStorageType.SPILLABLE_DISK).build();
    HoodieMetadataConfig metadataConfig = HoodieMetadataConfig.newBuilder().build();
    HoodieLocalEngineContext localEngineContext = new HoodieLocalEngineContext(metaClient.getHadoopConf());
    try {
        timelineService = new TimelineService(localEngineContext, new Configuration(), TimelineService.Config.builder().serverPort(0).enableMarkerRequests(true).build(), FileSystem.get(new Configuration()), FileSystemViewManager.createViewManager(localEngineContext, metadataConfig, storageConf, HoodieCommonConfig.newBuilder().build()));
        timelineService.startService();
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
    this.writeMarkers = new TimelineServerBasedWriteMarkers(metaClient.getBasePath(), markerFolderPath.toString(), "000", "localhost", timelineService.getServerPort(), 300);
}
Also used : Path(org.apache.hadoop.fs.Path) FileSystemViewStorageConfig(org.apache.hudi.common.table.view.FileSystemViewStorageConfig) HoodieSparkEngineContext(org.apache.hudi.client.common.HoodieSparkEngineContext) HoodieMetadataConfig(org.apache.hudi.common.config.HoodieMetadataConfig) Configuration(org.apache.hadoop.conf.Configuration) TimelineService(org.apache.hudi.timeline.service.TimelineService) JavaSparkContext(org.apache.spark.api.java.JavaSparkContext) HoodieLocalEngineContext(org.apache.hudi.common.engine.HoodieLocalEngineContext) IOException(java.io.IOException) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

TimelineService (org.apache.hudi.timeline.service.TimelineService)4 Configuration (org.apache.hadoop.conf.Configuration)3 FileSystemViewStorageConfig (org.apache.hudi.common.table.view.FileSystemViewStorageConfig)3 IOException (java.io.IOException)2 HoodieMetadataConfig (org.apache.hudi.common.config.HoodieMetadataConfig)2 HoodieLocalEngineContext (org.apache.hudi.common.engine.HoodieLocalEngineContext)2 HoodieWriteConfig (org.apache.hudi.config.HoodieWriteConfig)2 Path (org.apache.hadoop.fs.Path)1 HoodieSparkEngineContext (org.apache.hudi.client.common.HoodieSparkEngineContext)1 HoodieCommonConfig (org.apache.hudi.common.config.HoodieCommonConfig)1 RemoteHoodieTableFileSystemView (org.apache.hudi.common.table.view.RemoteHoodieTableFileSystemView)1 HoodieException (org.apache.hudi.exception.HoodieException)1 JavaSparkContext (org.apache.spark.api.java.JavaSparkContext)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1