public Path getDefaultDatabasePath(String dbName) throws MetaException { // TODO CAT - I am fairly certain that most calls to this are in error. This should only be // used when the database location is unset, which should never happen except when a // new database is being created. Once I have confirmation of this change calls of this to // getDatabasePath(), since it does the right thing. Also, merge this with // determineDatabasePath() as it duplicates much of the logic. if (dbName.equalsIgnoreCase(DEFAULT_DATABASE_NAME)) { return getWhRoot(); } return new Path(getWhRoot(), dbName.toLowerCase() + DATABASE_WAREHOUSE_SUFFIX); }
/** * Returns the MetaStore Warehouse root directory name. * * @return The warehouse root directory * @throws MetaException IO failure */ public Path getWarehouseRoot() throws MetaException { return warehouse.getWhRoot(); }
public Path getWhRootExternal() throws MetaException { if (whRootExternal != null) { return whRootExternal; } if (!hasExternalWarehouseRoot()) { whRootExternal = getWhRoot(); } else { whRootExternal = getDnsPath(new Path(whRootExternalString)); } return whRootExternal; }
/** * Get the path specified by the database. In the case of the default database the root of the * warehouse is returned. * @param db database to get the path of * @return path to the database directory * @throws MetaException when the file path cannot be properly determined from the configured * file system. */ public Path getDatabasePath(Database db) throws MetaException { if (db.getCatalogName().equalsIgnoreCase(DEFAULT_CATALOG_NAME) && db.getName().equalsIgnoreCase(DEFAULT_DATABASE_NAME)) { return getWhRoot(); } return new Path(db.getLocationUri()); }
@Override protected String expectedBaseDir() throws MetaException { return new Warehouse(conf).getWhRoot().toUri().getPath(); } }
@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); } }
/** * Build the database path based on catalog name and database name. This should only be used * when a database is being created or altered. If you just want to find out the path a * database is already using call {@link #getDatabasePath(Database)}. If the passed in * database already has a path set that will be used. If not the location will be built using * catalog's path and the database name. * @param cat catalog the database is in * @param db database object * @return Path representing the directory for the database * @throws MetaException when the file path cannot be properly determined from the configured * file system. */ public Path determineDatabasePath(Catalog cat, Database db) throws MetaException { if (db.isSetLocationUri()) { return getDnsPath(new Path(db.getLocationUri())); } if (cat == null || cat.getName().equalsIgnoreCase(DEFAULT_CATALOG_NAME)) { if (db.getName().equalsIgnoreCase(DEFAULT_DATABASE_NAME)) { return getWhRoot(); } else { return new Path(getWhRoot(), dbDirFromDbName(db)); } } else { return new Path(getDnsPath(new Path(cat.getLocationUri())), dbDirFromDbName(db)); } }
Path filePath = wh.getWhRoot(); if (ifEnableMoveOptimization(filePath, conf)) { conf.setBoolVar(REPL_ENABLE_MOVE_OPTIMIZATION, true);
try { initWh(); root = wh.getWhRoot(); authorize(root, readRequiredPriv, writeRequiredPriv); } catch (MetaException ex) {
try { initWh(); root = wh.getWhRoot(); authorize(root, readRequiredPriv, writeRequiredPriv); } catch (MetaException ex) {
/** * Starts the MetaStoreService. Be aware, as the current MetaStore does not implement clean * shutdown, starting MetaStoreService is possible only once per test. * * @throws Exception if any Exception occurs */ public void start() throws Exception { warehouse = new Warehouse(configuration); warehouseRootFs = warehouse.getFs(warehouse.getWhRoot()); TrashPolicy trashPolicy = TrashPolicy.getInstance(configuration, warehouseRootFs); trashDir = trashPolicy.getCurrentTrashDir(); }
public Path getDefaultDatabasePath(String dbName) throws MetaException { // TODO CAT - I am fairly certain that most calls to this are in error. This should only be // used when the database location is unset, which should never happen except when a // new database is being created. Once I have confirmation of this change calls of this to // getDatabasePath(), since it does the right thing. Also, merge this with // determineDatabasePath() as it duplicates much of the logic. if (dbName.equalsIgnoreCase(DEFAULT_DATABASE_NAME)) { return getWhRoot(); } return new Path(getWhRoot(), dbName.toLowerCase() + DATABASE_WAREHOUSE_SUFFIX); }
public Path getDatabasePath(Database db) throws MetaException { if (db.getName().equalsIgnoreCase(DEFAULT_DATABASE_NAME)) { return getWhRoot(); } return new Path(db.getLocationUri()); }
public Path getDatabasePath(Database db) throws MetaException { if (db.getName().equalsIgnoreCase(DEFAULT_DATABASE_NAME)) { return getWhRoot(); } return new Path(db.getLocationUri()); }
public Path getWhRootExternal() throws MetaException { if (whRootExternal != null) { return whRootExternal; } if (!hasExternalWarehouseRoot()) { whRootExternal = getWhRoot(); } else { whRootExternal = getDnsPath(new Path(whRootExternalString)); } return whRootExternal; }