vikramahuja1001 commented on a change in pull request #3988: URL: https://github.com/apache/carbondata/pull/3988#discussion_r534175368
########## File path: integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/util/SecondaryIndexUtil.scala ########## @@ -226,85 +233,59 @@ object SecondaryIndexUtil { validSegmentsToUse.toList.asJava, indexCarbonTable) } - mergedSegments.asScala.map { seg => - val file = SegmentFileStore.writeSegmentFile( - indexCarbonTable, - seg.getLoadName, - carbonLoadModel.getFactTimeStamp.toString, - null, - null) - val segment = new Segment(seg.getLoadName, file) - SegmentFileStore.updateTableStatusFile(indexCarbonTable, - seg.getLoadName, - file, - indexCarbonTable.getCarbonTableIdentifier.getTableId, - new SegmentFileStore(tablePath, segment.getSegmentFileName)) - segment - } - - val statusLock = - new SegmentStatusManager(indexCarbonTable.getAbsoluteTableIdentifier).getTableStatusLock - try { - val retryCount = CarbonLockUtil.getLockProperty(CarbonCommonConstants - .NUMBER_OF_TRIES_FOR_CONCURRENT_LOCK, - CarbonCommonConstants.NUMBER_OF_TRIES_FOR_CONCURRENT_LOCK_DEFAULT) - val maxTimeout = CarbonLockUtil.getLockProperty(CarbonCommonConstants - .MAX_TIMEOUT_FOR_CONCURRENT_LOCK, - CarbonCommonConstants.MAX_TIMEOUT_FOR_CONCURRENT_LOCK_DEFAULT) - if (statusLock.lockWithRetries(retryCount, maxTimeout)) { - val endTime = System.currentTimeMillis() - val loadMetadataDetails = SegmentStatusManager - .readLoadMetadata(indexCarbonTable.getMetadataPath) - loadMetadataDetails.foreach(loadMetadataDetail => { - if (rebuiltSegments.contains(loadMetadataDetail.getLoadName)) { - loadMetadataDetail.setLoadStartTime(carbonLoadModel.getFactTimeStamp) - loadMetadataDetail.setLoadEndTime(endTime) - CarbonLoaderUtil - .addDataIndexSizeIntoMetaEntry(loadMetadataDetail, - loadMetadataDetail.getLoadName, - indexCarbonTable) - } - }) - SegmentStatusManager - .writeLoadDetailsIntoFile(CarbonTablePath.getTableStatusFilePath(tablePath), - loadMetadataDetails) - } else { - throw new RuntimeException( - "Not able to acquire the lock for table status updation for table " + databaseName + - "." + indexCarbonTable.getTableName) - } - } finally { - if (statusLock != null) { - statusLock.unlock() - } - } - // clear the indexSchema cache for the merged segments, as the index files and - // data files are rewritten after compaction + val segmentToLoadStartTimeMap: scala.collection.mutable.Map[String, java.lang.Long] = + scala.collection.mutable.Map() if (mergedSegments.size > 0) { Review comment: this if is not required ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org