Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Dataset Improvements 

Namespace Permissions

In order to impersonate an application with an owner principal (user) different from the namespace owner, the application owner must be able to create entities in the namespace.

  • Directories in HDFS under the <namespace_root>/data to create file sets and <namespace_root>/tmp as a staging location for launching programs. 
    • If you create the <namespace_root> beforehand and pass it in as a custom root directory when creating the namespace, you must ensure that all users that impersonate applications have write permissions in this directory. 
    • If you do not specify a custom location for the namespace, you can specify a group name for the namespace.As a best practice, we recommend to make every application owner as well as the namespace owner member of that group. CDAP will create the mentioned directories with that group ownership and rwx permissions permissions for that group.
  • Tables in the corresponding HBase namespace to create Table-based datasets
    • If you provide a custom HBase namespace when creating the namespace, it is your responsibility to ensure that every application principal can create tables in this namespace. 
      • in hbase shell: grant '<user>, 'AC', '@<namespace>'
      • or grant '@<group>', 'AC', '@<namespace>'
    • If you let CDAP create the namespace, it will use the group name specified in the namespace configuration to issue the grant '@<group>', 'AC', '@<namespace>'. In this case it is necessary that all application owners are in that group. 
  • Tables in the namespace's Hive database, to be able to enable Explore for datasets. Depending on the Hive authorization settings:L
    • The application user must be privileged to create tables in the database
    • Hive must be configured to grant all privileges to the user that creates a table (depending on Hive configuration, this may not be the case)
    • For any sharing between applications that requires additional permissions, these must be granted manually.

Dataset Permissions

CDAP 4.1 adds the capability to configure dataset permissions through dataset properties to allow access of data by users other than owner of the dataset.

  • For filesets, by default, all files and directories are created with the file system's default umask, and with the group of the parent directory. This can be overridden by dataset properties. For example, this configures read, write and execute for the owner and the group "etl":

    PartitionedFileSetProperties.builder()
      ...
      .setFilePermissions("770")
      .setFileGroup("etl")
      .build();
  • For tables, additional permissions can be granted as part of the table creation. For example, this allows read and write for the user "joe" and read only for all members of the group "etl":

    TableProperties.builder()
      ...
      .setTablePermissions(ImmutableMap.of("joe", "RW", "@etl", "R")
      .build();

    Note that this is also need for PartitionedFileSets, because their partition metadata is stored in an HBase table.

  • Explore permissions in Hive must be granted manually outside of CDAP. 

Custom Hive Database/Table

By default, the Explore table for a dataset is in the enclosing namespace's database and named dataset_<name>. In CDAP 4.1, you can configure a custom Hive database and table name as follows

  • PartitionedFileSetProperties.builder()
      ...
      .setExploreDatabaseName("my_database")
      .setExploreTableName("clicks_gold")
      .build();

    Note that the database name must exist as CDAP will not attempt to create it. 

Reuse Existing Storage Location

A new dataset property for (Partitioned)FileSets allows configuring an existing, possibly non-empty location for the dataset's files and an existing Hive database. Use:

  • FileSetProperties.setUseExisting(true) (or DATA_USE_EXISTING / "data.use.existing") to reuse an existing location and Hive table. The dataset will assume that it does not own the existing data in that location and Hive table, and therefore, when you delete or truncate the dataset, the data will not be deleted. 
  • FileSetProperties.setPossessExisting(true) (or DATA_POSSESS_EXISTING / "data.possess.existing") to assume ownership an existing location and Hive table. The dataset will assume that it owns the existing data in that location and Hive table, and therefore, when you delete or truncate the dataset, all data will be deleted, including the previously existing data and Hive partitions.  

Note that in both cases, the existing partitions in the Hive table are not known to CDAP and therefore only accessible via Hive, not through PartitionedFileSet APIs. 

 

  • No labels