Search in sources :

Example 1 with MetacatSaveTablePartitionMetadataOnlyPostEvent

use of com.netflix.metacat.common.server.events.MetacatSaveTablePartitionMetadataOnlyPostEvent in project metacat by Netflix.

the class PartitionServiceImpl method savePartitionMetadataOnly.

/**
 * Optimization for metadata only updates.
 *
 * @param metacatRequestContext request context
 * @param dto                   savePartition dto
 * @param name                  qualified name
 * @param partitionDtos         partition dtos
 * @return empty save partition response dto
 */
private PartitionsSaveResponseDto savePartitionMetadataOnly(final MetacatRequestContext metacatRequestContext, final PartitionsSaveRequestDto dto, final QualifiedName name, final List<PartitionDto> partitionDtos) {
    registry.distributionSummary(this.partitionMetadataOnlyAddDistSummary.withTags(name.parts())).record(partitionDtos.size());
    eventBus.postSync(new MetacatSaveTablePartitionMetadataOnlyPreEvent(name, metacatRequestContext, this, dto));
    // Save metadata
    log.info("Saving metadata only for partitions for {}", name);
    userMetadataService.saveMetadata(metacatRequestContext.getUserName(), partitionDtos, true);
    eventBus.postSync(new MetacatSaveTablePartitionMetadataOnlyPostEvent(name, metacatRequestContext, this, partitionDtos, new PartitionsSaveResponseDto()));
    // since client (squirrel) only checks the response code
    return converterUtil.toPartitionsSaveResponseDto(new PartitionsSaveResponse());
}
Also used : MetacatSaveTablePartitionMetadataOnlyPostEvent(com.netflix.metacat.common.server.events.MetacatSaveTablePartitionMetadataOnlyPostEvent) PartitionsSaveResponse(com.netflix.metacat.common.server.connectors.model.PartitionsSaveResponse) MetacatSaveTablePartitionMetadataOnlyPreEvent(com.netflix.metacat.common.server.events.MetacatSaveTablePartitionMetadataOnlyPreEvent) PartitionsSaveResponseDto(com.netflix.metacat.common.dto.PartitionsSaveResponseDto)

Aggregations

PartitionsSaveResponseDto (com.netflix.metacat.common.dto.PartitionsSaveResponseDto)1 PartitionsSaveResponse (com.netflix.metacat.common.server.connectors.model.PartitionsSaveResponse)1 MetacatSaveTablePartitionMetadataOnlyPostEvent (com.netflix.metacat.common.server.events.MetacatSaveTablePartitionMetadataOnlyPostEvent)1 MetacatSaveTablePartitionMetadataOnlyPreEvent (com.netflix.metacat.common.server.events.MetacatSaveTablePartitionMetadataOnlyPreEvent)1