From ddaef67181997c2830f77a972ebbad8f4a50ed70 Mon Sep 17 00:00:00 2001 From: Bharat Viswanadham Date: Fri, 21 Dec 2018 13:26:34 -0800 Subject: [PATCH] HDDS-937. Create an S3 Auth Table. Contributed by Dinesh Chitlangia. --- .../apache/hadoop/ozone/om/OMMetadataManager.java | 7 +++++++ .../hadoop/ozone/om/OmMetadataManagerImpl.java | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java index 94ff0dbb6af..ec230cd2c3e 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMMetadataManager.java @@ -254,6 +254,7 @@ public interface OMMetadataManager { Table getS3Table(); /** +<<<<<<< HEAD * Returns the DB key name of a multipart upload key in OM metadata store. * * @param volume - volume name @@ -273,6 +274,12 @@ public interface OMMetadataManager { */ Table getMultipartInfoTable(); + /** + * Gets the S3 Secrets table. + * @return Table + */ + Table getS3SecretTable(); + /** * Returns number of rows in a table. This should not be used for very * large tables. diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java index bfab48cf744..7a75ec81781 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java @@ -59,6 +59,8 @@ import org.eclipse.jetty.util.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.ws.rs.HEAD; + /** * Ozone metadata manager interface. */ @@ -89,6 +91,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager { * |-------------------------------------------------------------------| * | s3Table | s3BucketName -> /volumeName/bucketName | * |-------------------------------------------------------------------| + * | s3SecretTable | s3g_access_key_id -> s3Secret | + * |-------------------------------------------------------------------| */ private static final String USER_TABLE = "userTable"; @@ -99,6 +103,7 @@ public class OmMetadataManagerImpl implements OMMetadataManager { private static final String OPEN_KEY_TABLE = "openKeyTable"; private static final String S3_TABLE = "s3Table"; private static final String MULTIPARTINFO_TABLE = "multipartInfoTable"; + private static final String S3_SECRET_TABLE = "s3SecretTable"; private DBStore store; @@ -113,6 +118,7 @@ public class OmMetadataManagerImpl implements OMMetadataManager { private Table openKeyTable; private Table s3Table; private Table multipartInfoTable; + private Table s3SecretTable; public OmMetadataManagerImpl(OzoneConfiguration conf) throws IOException { this.lock = new OzoneManagerLock(conf); @@ -195,6 +201,7 @@ public class OmMetadataManagerImpl implements OMMetadataManager { .addTable(OPEN_KEY_TABLE) .addTable(S3_TABLE) .addTable(MULTIPARTINFO_TABLE) + .addTable(S3_SECRET_TABLE) .addCodec(OmKeyInfo.class, new OmKeyInfoCodec()) .addCodec(OmBucketInfo.class, new OmBucketInfoCodec()) .addCodec(OmVolumeArgs.class, new OmVolumeArgsCodec()) @@ -233,6 +240,8 @@ public class OmMetadataManagerImpl implements OMMetadataManager { String.class, OmMultipartKeyInfo.class); checkTableStatus(multipartInfoTable, MULTIPARTINFO_TABLE); + s3SecretTable = this.store.getTable(S3_SECRET_TABLE); + checkTableStatus(s3SecretTable, S3_SECRET_TABLE); } } @@ -655,4 +664,9 @@ public class OmMetadataManagerImpl implements OMMetadataManager { } return count; } + + @Override + public Table getS3SecretTable() { + return s3SecretTable; + } }