Class SecureBulkLoadManager
java.lang.Object
org.apache.hadoop.hbase.regionserver.SecureBulkLoadManager
Bulk loads in secure mode. This service addresses two issues:
- Moving files in a secure filesystem wherein the HBase Client and HBase Server are different filesystem users.
- Does moving in a secure manner. Assuming that the filesystem is POSIX compliant.
- Create an hbase owned staging directory which is world traversable (711):
/hbase/staging
- A user writes out data to his secure output directory:
/user/foo/data
- A call is made to hbase to create a secret staging directory which globally rwx (777):
/user/staging/averylongandrandomdirectoryname
- The user moves the data into the random staging directory, then calls bulkLoadHFiles()
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate org.apache.hadoop.fs.Path
private org.apache.hadoop.conf.Configuration
private AsyncConnection
private org.apache.hadoop.fs.FileSystem
private static final org.slf4j.Logger
private static final org.apache.hadoop.fs.permission.FsPermission
private static final org.apache.hadoop.fs.permission.FsPermission
private SecureRandom
private static final int
private static final int
private ConcurrentHashMap<org.apache.hadoop.security.UserGroupInformation,
org.apache.commons.lang3.mutable.MutableInt> private UserProvider
static final long
-
Constructor Summary
ConstructorDescriptionSecureBulkLoadManager
(org.apache.hadoop.conf.Configuration conf, AsyncConnection conn) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanupBulkLoad
(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CleanupBulkLoadRequest request) private org.apache.hadoop.fs.Path
createStagingDir
(org.apache.hadoop.fs.Path baseDir, User user, String randomDir) private org.apache.hadoop.fs.Path
createStagingDir
(org.apache.hadoop.fs.Path baseDir, User user, TableName tableName) private void
decrementUgiReference
(org.apache.hadoop.security.UserGroupInformation ugi) private User
private void
incrementUgiReference
(org.apache.hadoop.security.UserGroupInformation ugi) private boolean
isUserReferenced
(org.apache.hadoop.security.UserGroupInformation ugi) prepareBulkLoad
(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest request) secureBulkLoadHFiles
(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest request) secureBulkLoadHFiles
(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest request, List<String> clusterIds) (package private) void
setFsCreatedListener
(Consumer<HRegion> fsCreatedListener) void
start()
void
stop()
-
Field Details
-
VERSION
- See Also:
-
RANDOM_WIDTH
- See Also:
-
RANDOM_RADIX
- See Also:
-
LOG
-
PERM_ALL_ACCESS
-
PERM_HIDDEN
-
random
-
fs
-
conf
-
baseStagingDir
-
userProvider
-
ugiReferenceCounter
private ConcurrentHashMap<org.apache.hadoop.security.UserGroupInformation,org.apache.commons.lang3.mutable.MutableInt> ugiReferenceCounter -
conn
-
fsCreatedListener
-
-
Constructor Details
-
SecureBulkLoadManager
SecureBulkLoadManager(org.apache.hadoop.conf.Configuration conf, AsyncConnection conn)
-
-
Method Details
-
start
- Throws:
IOException
-
stop
- Throws:
IOException
-
prepareBulkLoad
public String prepareBulkLoad(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.PrepareBulkLoadRequest request) throws IOException - Throws:
IOException
-
cleanupBulkLoad
public void cleanupBulkLoad(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CleanupBulkLoadRequest request) throws IOException - Throws:
IOException
-
setFsCreatedListener
-
incrementUgiReference
-
decrementUgiReference
-
isUserReferenced
-
secureBulkLoadHFiles
public Map<byte[],List<org.apache.hadoop.fs.Path>> secureBulkLoadHFiles(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest request) throws IOException - Throws:
IOException
-
secureBulkLoadHFiles
public Map<byte[],List<org.apache.hadoop.fs.Path>> secureBulkLoadHFiles(HRegion region, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest request, List<String> clusterIds) throws IOException - Throws:
IOException
-
createStagingDir
private org.apache.hadoop.fs.Path createStagingDir(org.apache.hadoop.fs.Path baseDir, User user, TableName tableName) throws IOException - Throws:
IOException
-
createStagingDir
private org.apache.hadoop.fs.Path createStagingDir(org.apache.hadoop.fs.Path baseDir, User user, String randomDir) throws IOException - Throws:
IOException
-
getActiveUser
- Throws:
IOException
-