HBASE-20421 HBasecontext creates a connection but does not close it (Yu Wang)
This commit is contained in:
parent
fd2cec75f3
commit
f4f2b68238
|
@ -628,6 +628,7 @@ class HBaseContext(@transient val sc: SparkContext,
|
|||
throw new FileAlreadyExistsException("Path " + stagingDir + " already exists")
|
||||
}
|
||||
val conn = HBaseConnectionCache.getConnection(config)
|
||||
try {
|
||||
val regionLocator = conn.getRegionLocator(tableName)
|
||||
val startKeys = regionLocator.getStartKeys
|
||||
if (startKeys.length == 0) {
|
||||
|
@ -708,8 +709,10 @@ class HBaseContext(@transient val sc: SparkContext,
|
|||
compactionExclude)
|
||||
rollOverRequested = false
|
||||
})
|
||||
} finally {
|
||||
if(null != conn) conn.close()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Spark Implementation of HBase Bulk load for short rows some where less then
|
||||
|
@ -760,6 +763,7 @@ class HBaseContext(@transient val sc: SparkContext,
|
|||
throw new FileAlreadyExistsException("Path " + stagingDir + " already exists")
|
||||
}
|
||||
val conn = HBaseConnectionCache.getConnection(config)
|
||||
try {
|
||||
val regionLocator = conn.getRegionLocator(tableName)
|
||||
val startKeys = regionLocator.getStartKeys
|
||||
if (startKeys.length == 0) {
|
||||
|
@ -871,8 +875,10 @@ class HBaseContext(@transient val sc: SparkContext,
|
|||
compactionExclude)
|
||||
rollOverRequested = false
|
||||
})
|
||||
} finally {
|
||||
if(null != conn) conn.close()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return a new HFile writer when requested
|
||||
|
|
Loading…
Reference in New Issue