Interface DatasourceSegmentMetadataWriter

All Known Subinterfaces:
DatasourceSegmentCache, SegmentMetadataTransaction
All Known Implementing Classes:
ReadWriteCache

public interface DatasourceSegmentMetadataWriter
Performs write operations on the segment metadata of a single datasource.
  • Method Details

    • insertSegments

      int insertSegments(Set<DataSegmentPlus> segments)
      Inserts the given segments into the metadata store.
      Returns:
      Number of new segments inserted
    • insertSegmentsWithMetadata

      int insertSegmentsWithMetadata(Set<DataSegmentPlus> segments)
      Inserts the given segments into the metadata store while also persisting additional metadata values such as number of rows and schema fingerprint.
      Returns:
      Number of new segments inserted
    • markSegmentAsUnused

      boolean markSegmentAsUnused(SegmentId segmentId, org.joda.time.DateTime updateTime)
      Marks the segment as unused.
      Parameters:
      updateTime - The last updated timestamp of the segment will be set to this value if updated successfully.
      Returns:
      true if the segment was updated successfully, false otherwise
    • markSegmentsAsUnused

      int markSegmentsAsUnused(Set<SegmentId> segmentIds, org.joda.time.DateTime updateTime)
      Marks the given segments as unused.
      Parameters:
      updateTime - Updated segments will have their last updated timestamp set to this value.
      Returns:
      Number of segments updated successfully
    • markAllSegmentsAsUnused

      int markAllSegmentsAsUnused(org.joda.time.DateTime updateTime)
      Marks all the segments in given datasource as unused.
      Parameters:
      updateTime - Updated segments will have their last updated timestamp set to this value.
      Returns:
      Number of segments successfully
    • markSegmentsWithinIntervalAsUnused

      int markSegmentsWithinIntervalAsUnused(org.joda.time.Interval interval, @Nullable List<String> versions, org.joda.time.DateTime updateTime)
      Marks segments that are fully contained in the given interval as unused.
      Parameters:
      interval - Only segments fully contained within this interval are eligible to be marked as unused.
      versions - Optional set of segment versions eligible for update. If this set is passed as null, all segment versions are eligible for update. If passed as empty, no segment is updated.
      updateTime - Updated segments will have their last updated timestamp set to this value.
      Returns:
      Number of segments updated successfully
    • deleteSegments

      int deleteSegments(Set<SegmentId> segmentsIdsToDelete)
      Permanently deletes the segments for the given IDs from the metadata store.
      Returns:
      Number of segments deleted successfully
    • updateSegmentPayload

      boolean updateSegmentPayload(DataSegment segment)
      Updates the payload of the given segment in the metadata store. This method is used only by legacy tasks "move", "archive" and "restore".
      Returns:
      true if the segment payload was updated successfully, false otherwise
    • insertPendingSegment

      boolean insertPendingSegment(PendingSegmentRecord pendingSegment, boolean skipSegmentLineageCheck)
      Inserts a pending segment into the metadata store.
      Returns:
      true if the pending segment was inserted successfully, false otherwise
    • insertPendingSegments

      int insertPendingSegments(List<PendingSegmentRecord> pendingSegments, boolean skipSegmentLineageCheck)
      Inserts pending segments into the metadata store.
      Returns:
      Number of new pending segments inserted
    • deleteAllPendingSegments

      int deleteAllPendingSegments()
      Deletes all pending segments from the metadata store.
      Returns:
      Number of pending segments deleted
    • deletePendingSegments

      int deletePendingSegments(Set<String> segmentIdsToDelete)
      Deletes pending segments for the given IDs from the metadata store.
      Returns:
      Number of pending segments deleted.
    • deletePendingSegments

      int deletePendingSegments(String taskAllocatorId)
      Deletes pending segments allocated for the given taskAllocatorID from the metadata store.
      Returns:
      Number of pending segments deleted
    • deletePendingSegmentsCreatedIn

      int deletePendingSegmentsCreatedIn(org.joda.time.Interval interval)
      Deletes all pending segments which were created during the given interval from the metadata store.
      Returns:
      Number of pending segments deleted.