@Override public Catalog getCatalog(String catalogName) throws NoSuchObjectException, MetaException { // in case of event based cache update, cache will not be updated for catalog. if (!sharedCache.isCatalogCachePrewarmed() || canUseEvents) { return rawStore.getCatalog(catalogName); } Catalog cat = sharedCache.getCatalogFromCache(normalizeIdentifier(catalogName)); if (cat == null) { throw new NoSuchObjectException(); } return cat; }
@VisibleForTesting public static void createDefaultCatalog(RawStore ms, Warehouse wh) throws MetaException, InvalidOperationException { try { Catalog defaultCat = ms.getCatalog(DEFAULT_CATALOG_NAME); // Null check because in some test cases we get a null from ms.getCatalog. if (defaultCat !=null && defaultCat.getLocationUri().equals("TBD")) { // One time update issue. When the new 'hive' catalog is created in an upgrade the // script does not know the location of the warehouse. So we need to update it. LOG.info("Setting location of default catalog, as it hasn't been done after upgrade"); defaultCat.setLocationUri(wh.getWhRoot().toString()); ms.alterCatalog(defaultCat.getName(), defaultCat); } } catch (NoSuchObjectException e) { Catalog cat = new Catalog(DEFAULT_CATALOG_NAME, wh.getWhRoot().toString()); long time = System.currentTimeMillis() / 1000; cat.setCreateTime((int) time); cat.setDescription(Warehouse.DEFAULT_CATALOG_COMMENT); ms.createCatalog(cat); } }
List<Catalog> catalogs = new ArrayList<>(catalogsToCache.size()); for (String catName : catalogsToCache) { catalogs.add(rawStore.getCatalog(catName));
@Override public GetCatalogResponse get_catalog(GetCatalogRequest rqst) throws NoSuchObjectException, TException { String catName = rqst.getName(); startFunction("get_catalog", ": " + catName); Catalog cat = null; Exception ex = null; try { cat = getMS().getCatalog(catName); firePreEvent(new PreReadCatalogEvent(this, cat)); return new GetCatalogResponse(cat); } catch (MetaException|NoSuchObjectException e) { ex = e; throw e; } finally { endFunction("get_catalog", cat != null, ex); } }
try { ms.openTransaction(); cat = ms.getCatalog(catName);
cat = getMS().getCatalog(db.getCatalogName()); } catch (NoSuchObjectException e) { LOG.error("No such catalog " + db.getCatalogName());
try { try { getMS().getCatalog(catalog.getName()); throw new AlreadyExistsException("Catalog " + catalog.getName() + " already exists"); } catch (NoSuchObjectException e) {
@Override public Catalog getCatalog(String catalogName) throws NoSuchObjectException, MetaException { if (!sharedCache.isCatalogCachePrewarmed()) { return rawStore.getCatalog(catalogName); } Catalog cat = sharedCache.getCatalogFromCache(normalizeIdentifier(catalogName)); if (cat == null) { throw new NoSuchObjectException(); } return cat; }
@VisibleForTesting public static void createDefaultCatalog(RawStore ms, Warehouse wh) throws MetaException, InvalidOperationException { try { Catalog defaultCat = ms.getCatalog(DEFAULT_CATALOG_NAME); // Null check because in some test cases we get a null from ms.getCatalog. if (defaultCat !=null && defaultCat.getLocationUri().equals("TBD")) { // One time update issue. When the new 'hive' catalog is created in an upgrade the // script does not know the location of the warehouse. So we need to update it. LOG.info("Setting location of default catalog, as it hasn't been done after upgrade"); defaultCat.setLocationUri(wh.getWhRoot().toString()); ms.alterCatalog(defaultCat.getName(), defaultCat); } } catch (NoSuchObjectException e) { Catalog cat = new Catalog(DEFAULT_CATALOG_NAME, wh.getWhRoot().toString()); cat.setDescription(Warehouse.DEFAULT_CATALOG_COMMENT); ms.createCatalog(cat); } }
List<Catalog> catalogs = new ArrayList<>(catalogsToCache.size()); for (String catName : catalogsToCache) { catalogs.add(rawStore.getCatalog(catName));
@Override public GetCatalogResponse get_catalog(GetCatalogRequest rqst) throws NoSuchObjectException, TException { String catName = rqst.getName(); startFunction("get_catalog", ": " + catName); Catalog cat = null; Exception ex = null; try { cat = getMS().getCatalog(catName); firePreEvent(new PreReadCatalogEvent(this, cat)); return new GetCatalogResponse(cat); } catch (MetaException|NoSuchObjectException e) { ex = e; throw e; } finally { endFunction("get_database", cat != null, ex); } }
try { ms.openTransaction(); cat = ms.getCatalog(catName);
cat = getMS().getCatalog(db.getCatalogName()); } catch (NoSuchObjectException e) { LOG.error("No such catalog " + db.getCatalogName());
try { try { getMS().getCatalog(catalog.getName()); throw new AlreadyExistsException("Catalog " + catalog.getName() + " already exists"); } catch (NoSuchObjectException e) {