Package org.apache.pinot.common.lineage
Class SegmentLineage
- java.lang.Object
-
- org.apache.pinot.common.lineage.SegmentLineage
-
public class SegmentLineage extends Object
Class to represent segment lineage information. Segment lineage keeps the metadata required for supporting m -> n segment replacement. Segment lineage is serialized into a znode and stored in a helix property store (zookeeper). This metadata will be used by brokers to make sure that the routing does not pick the segments with the duplicate data. NOTE: Update for the underlying segment lineage znode needs to happen with read-modify-write block to guarantee the atomic update because this metadata can be modified concurrently (e.g. task scheduler tries to add entries after scheduling new tasks while minion task tries to update the state of the existing entry)
-
-
Constructor Summary
Constructors Constructor Description SegmentLineage(String tableNameWithType)SegmentLineage(String tableNameWithType, Map<String,LineageEntry> lineageEntries)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLineageEntry(String lineageEntryId, LineageEntry lineageEntry)Add lineage entry to the segment lineage metadata with the given lineage entry idvoiddeleteLineageEntry(String lineageEntryId)Delete lineage entrystatic SegmentLineagefromZNRecord(org.apache.helix.zookeeper.datamodel.ZNRecord record)Convert ZNRecord to segment lineageLineageEntrygetLineageEntry(String lineageEntryId)Retrieve lineage entrySet<String>getLineageEntryIds()Retrieve the lineage ids for all lineage entriesStringgetTableNameWithType()com.fasterxml.jackson.databind.node.ObjectNodetoJsonObject()Returns a json representation of the segment lineage.org.apache.helix.zookeeper.datamodel.ZNRecordtoZNRecord()Convert the segment lineage object to the ZNRecordvoidupdateLineageEntry(String lineageEntryId, LineageEntry lineageEntry)Update lineage entry to the segment lineage metadata with the given lineage entry id
-
-
-
Constructor Detail
-
SegmentLineage
public SegmentLineage(String tableNameWithType)
-
SegmentLineage
public SegmentLineage(String tableNameWithType, Map<String,LineageEntry> lineageEntries)
-
-
Method Detail
-
getTableNameWithType
public String getTableNameWithType()
-
addLineageEntry
public void addLineageEntry(String lineageEntryId, LineageEntry lineageEntry)
Add lineage entry to the segment lineage metadata with the given lineage entry id- Parameters:
lineageEntryId- the id for the lineage entrylineageEntry- a lineage entry
-
updateLineageEntry
public void updateLineageEntry(String lineageEntryId, LineageEntry lineageEntry)
Update lineage entry to the segment lineage metadata with the given lineage entry id- Parameters:
lineageEntryId- the id for the lineage entry to be updatedlineageEntry- a lineage entry to be updated
-
getLineageEntry
public LineageEntry getLineageEntry(String lineageEntryId)
Retrieve lineage entry- Parameters:
lineageEntryId- the id for the lineage entry- Returns:
- the lineage entry for the given lineage entry id
-
getLineageEntryIds
public Set<String> getLineageEntryIds()
Retrieve the lineage ids for all lineage entries- Returns:
- lineage entry ids
-
deleteLineageEntry
public void deleteLineageEntry(String lineageEntryId)
Delete lineage entry- Parameters:
lineageEntryId- the id for the lineage entry
-
fromZNRecord
public static SegmentLineage fromZNRecord(org.apache.helix.zookeeper.datamodel.ZNRecord record)
Convert ZNRecord to segment lineage- Parameters:
record- ZNRecord representation of the segment lineage- Returns:
- the segment lineage object
-
toZNRecord
public org.apache.helix.zookeeper.datamodel.ZNRecord toZNRecord()
Convert the segment lineage object to the ZNRecord- Returns:
- ZNRecord representation of the segment lineage
-
toJsonObject
public com.fasterxml.jackson.databind.node.ObjectNode toJsonObject()
Returns a json representation of the segment lineage. Segment lineage entries are sorted in chronological order by default.
-
-