/** * a new constructor with carbon index files * * @param indexFiles carbon index files */ public LatestFilesReadCommittedScope(CarbonFile[] indexFiles, Configuration configuration) { this.configuration = configuration; takeCarbonIndexFileSnapShot(indexFiles); }
String segId = getSegmentID(carbonIndexFiles[i].getName(), indexFilePath); new ReadCommittedIndexFileSnapShot(indexFileStore, segmentTimestampUpdaterMap); this.readCommittedIndexFileSnapShot = readCommittedIndexFileSnapShot; prepareLoadMetadata();
public ReadCommittedScope getReadCommitted(JobContext job, AbsoluteTableIdentifier identifier) throws IOException { if (readCommittedScope == null) { ReadCommittedScope readCommittedScope; if (job.getConfiguration().getBoolean(CARBON_TRANSACTIONAL_TABLE, true)) { readCommittedScope = new TableStatusReadCommittedScope(identifier, job.getConfiguration()); } else { readCommittedScope = getReadCommittedScope(job.getConfiguration()); if (readCommittedScope == null) { readCommittedScope = new LatestFilesReadCommittedScope(identifier.getTablePath(), job.getConfiguration()); } } this.readCommittedScope = readCommittedScope; } return readCommittedScope; } }
readCommittedScope = new LatestFilesReadCommittedScope( identifier.getTablePath() + "/Fact/Part0/Segment_null/", job.getConfiguration()); } else { readCommittedScope = getReadCommittedScope(job.getConfiguration()); if (readCommittedScope == null) { readCommittedScope = new LatestFilesReadCommittedScope(identifier.getTablePath(), job .getConfiguration()); } else {
@Override public LoadMetadataDetails[] getSegmentList() throws IOException { try { if (loadMetadataDetails == null) { takeCarbonIndexFileSnapShot(); } return loadMetadataDetails; } catch (IOException ex) { throw new IOException("Problem encountered while reading the Table Status file.", ex); } }
/** * a new constructor of this class * * @param path carbon file path * @param segmentId segment id */ public LatestFilesReadCommittedScope(String path, String segmentId, Configuration configuration) throws IOException { this.configuration = configuration; Objects.requireNonNull(path); this.carbonFilePath = path; this.segmentId = segmentId; takeCarbonIndexFileSnapShot(); }
@Override public void takeCarbonIndexFileSnapShot() throws IOException { // Read the current file Path get the list of indexes from the path. CarbonFile file = FileFactory.getCarbonFile(carbonFilePath, configuration); CarbonFile[] carbonIndexFiles = null; if (file.isDirectory()) { if (segmentId == null) { List<CarbonFile> indexFiles = new ArrayList<>(); SegmentIndexFileStore.getCarbonIndexFilesRecursively(file, indexFiles); carbonIndexFiles = indexFiles.toArray(new CarbonFile[0]); } else { String segmentPath = CarbonTablePath.getSegmentPath(carbonFilePath, segmentId); carbonIndexFiles = SegmentIndexFileStore.getCarbonIndexFiles(segmentPath, configuration); } if (carbonIndexFiles.length == 0) { throw new IOException( "No Index files are present in the table location :" + carbonFilePath); } takeCarbonIndexFileSnapShot(carbonIndexFiles); } else { throw new IOException("Path is not pointing to directory"); } }