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 Summary
Modifier and TypeMethodDescriptionintDeletes all pending segments from the metadata store.intdeletePendingSegments(String taskAllocatorId) Deletes pending segments allocated for the giventaskAllocatorIDfrom the metadata store.intdeletePendingSegments(Set<String> segmentIdsToDelete) Deletes pending segments for the given IDs from the metadata store.intdeletePendingSegmentsCreatedIn(org.joda.time.Interval interval) Deletes all pending segments which were created during the given interval from the metadata store.intdeleteSegments(Set<SegmentId> segmentsIdsToDelete) Permanently deletes the segments for the given IDs from the metadata store.booleaninsertPendingSegment(PendingSegmentRecord pendingSegment, boolean skipSegmentLineageCheck) Inserts a pending segment into the metadata store.intinsertPendingSegments(List<PendingSegmentRecord> pendingSegments, boolean skipSegmentLineageCheck) Inserts pending segments into the metadata store.intinsertSegments(Set<DataSegmentPlus> segments) Inserts the given segments into the metadata store.intinsertSegmentsWithMetadata(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.intmarkAllSegmentsAsUnused(org.joda.time.DateTime updateTime) Marks all the segments in given datasource as unused.booleanmarkSegmentAsUnused(SegmentId segmentId, org.joda.time.DateTime updateTime) Marks the segment as unused.intmarkSegmentsAsUnused(Set<SegmentId> segmentIds, org.joda.time.DateTime updateTime) Marks the given segments as unused.intmarkSegmentsWithinIntervalAsUnused(org.joda.time.Interval interval, List<String> versions, org.joda.time.DateTime updateTime) Marks segments that are fully contained in the given interval as unused.booleanupdateSegmentPayload(DataSegment segment) Updates the payload of the given segment in the metadata store.
-
Method Details
-
insertSegments
Inserts the given segments into the metadata store.- Returns:
- Number of new segments inserted
-
insertSegmentsWithMetadata
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
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
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
Permanently deletes the segments for the given IDs from the metadata store.- Returns:
- Number of segments deleted successfully
-
updateSegmentPayload
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
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
Deletes pending segments for the given IDs from the metadata store.- Returns:
- Number of pending segments deleted.
-
deletePendingSegments
Deletes pending segments allocated for the giventaskAllocatorIDfrom 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.
-