The `synchronized` is needed for getting `currentDb` IIUC. So a small change is to only wrap `formatDatabaseName(name.database.getOrElse(currentDb))` with `synchronized`.
On Thu, Mar 18, 2021 at 3:38 PM Chang Chen <baibaic...@gmail.com> wrote: > hi all > > We met an issue which is related with SessionCatalog synchronized, for > example > > def tableExists(name: TableIdentifier): Boolean = synchronized { > val db = formatDatabaseName(name.database.getOrElse(currentDb)) > val table = formatTableName(name.table) > externalCatalog.tableExists(db, table) > } > > We have modified the underlying hive meta store which a different hive > database is placed in its own shard for performance. However, we found that > the synchronized limits the concurrency, we would like > 1. replace synchronized with a read-write lock > 2. remove synchronized in hive *withClient* function > > Let me know what you guys think of it? > > If it is ok, I will create an issue and contribute a PR > > Thanks > Chang >