Skip to content

Commit

Permalink
[CARMEL-6076][Followup] Fix the incorrect qualified table path to det…
Browse files Browse the repository at this point in the history
…ermine the read lock (#1020)

* [CARMEL-6076][Followup] Fix the incorrect qualified table path to determine the read lock
  • Loading branch information
fenzhu authored and GitHub Enterprise committed Jul 28, 2022
1 parent 34780ad commit 70beb72
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,17 @@ object InMemoryFileIndex extends Logging {
))

val validTableLocation: Option[URI] = if (tableLocation != null && tableLocation.isDefined) {
val tl = new Path(tableLocation.get.getPath.trim)
val fs = SparkHadoopWriterUtils.getNewFileSystem(tl, hadoopConf)
val tlp = fs.makeQualified(tl).toString.toLowerCase(Locale.ROOT)
val tl = new Path(tableLocation.get).toString.trim
val tll = tl.toLowerCase(Locale.ROOT)
val readLockCluster = sparkSession.sessionState.conf.concurrentReadLockCluster
logInfo(s"Configured cluster that enables read lock for empty directory: $readLockCluster")
if (readLockCluster.trim.equalsIgnoreCase("all")) {
tableLocation
} else {
val readLockClusters: Seq[String] =
readLockCluster.split(",").toSeq.map(_.trim.toLowerCase(Locale.ROOT))
val enforced: Boolean = readLockClusters.exists(cluster => tlp.contains(cluster))
logInfo(s"Table location is: $tlp, read lock enforced = $enforced")
val enforced: Boolean = readLockClusters.exists(cluster => tll.contains(cluster))
logInfo(s"Table location is: $tl, read lock enforced = $enforced")
if (enforced) tableLocation else null
}
} else {
Expand Down

0 comments on commit 70beb72

Please sign in to comment.