Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
qiuchenjian commented on a change in pull request #3166: [CARBONDATA-3332] Blocked concurrent compaction and update
URL: https://github.com/apache/carbondata/pull/3166#discussion_r269846919 ########## File path: integration/spark2/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataRDDFactory.scala ########## @@ -867,27 +868,34 @@ object CarbonDataRDDFactory { val lock = CarbonLockFactory.getCarbonLockObj( carbonTable.getAbsoluteTableIdentifier, LockUsage.COMPACTION_LOCK) - - if (lock.lockWithRetries()) { - LOGGER.info("Acquired the compaction lock.") - try { - startCompactionThreads(sqlContext, - carbonLoadModel, - storeLocation, - compactionModel, - lock, - compactedSegments, - operationContext - ) - } catch { - case e: Exception => - LOGGER.error(s"Exception in start compaction thread. ${ e.getMessage }") - lock.unlock() - throw e + val updateLock = CarbonLockFactory.getCarbonLockObj(carbonTable + .getAbsoluteTableIdentifier, LockUsage.UPDATE_LOCK) + try { + if (updateLock.lockWithRetries()) { + if (lock.lockWithRetries()) { + LOGGER.info("Acquired the compaction lock.") + startCompactionThreads(sqlContext, + carbonLoadModel, + storeLocation, + compactionModel, + lock, + compactedSegments, + operationContext + ) + } else { + LOGGER.error("Not able to acquire the compaction lock for table " + + s"${ carbonLoadModel.getDatabaseName }.${ carbonLoadModel.getTableName}") + } + } else { + throw new ConcurrentOperationException(carbonTable, "update", "compaction") } - } else { - LOGGER.error("Not able to acquire the compaction lock for table " + - s"${ carbonLoadModel.getDatabaseName }.${ carbonLoadModel.getTableName}") + } catch { + case e: Exception => + LOGGER.error(s"Exception in start compaction thread.", e) + lock.unlock() + throw e + } finally { + updateLock.unlock() Review comment: @kunal642 @QiangCai @ravipesala @kumarvishal09 It seems that we don't check all the result of unlock, If hdfs throws the IOException which causes unlock failed, this table will be abnormal state ---------------------------------------------------------------- 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: [hidden email] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |