Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7252

small refinement to the use of isInAnEZ in FSNamesystem

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.6.0
    • 2.7.0
    • None
    • None
    • Reviewed

    Description

      In FSN#startFileInt, EncryptionZoneManager#getEncryptionZoneForPath is invoked 3 times (dir.isInAnEZ(iip), dir.getEZForPath(iip), dir.getKeyName(iip)) in following code, actually we just need one.

      if (dir.isInAnEZ(iip)) {
                EncryptionZone zone = dir.getEZForPath(iip);
                protocolVersion = chooseProtocolVersion(zone, supportedVersions);
                suite = zone.getSuite();
                ezKeyName = dir.getKeyName(iip);
      
                Preconditions.checkNotNull(protocolVersion);
                Preconditions.checkNotNull(suite);
                Preconditions.checkArgument(!suite.equals(CipherSuite.UNKNOWN),
                    "Chose an UNKNOWN CipherSuite!");
                Preconditions.checkNotNull(ezKeyName);
              }
      

      Also there are 2 times in following code, but just need one

      if (dir.isInAnEZ(iip)) {
            // The path is now within an EZ, but we're missing encryption parameters
            if (suite == null || edek == null) {
              throw new RetryStartFileException();
            }
            // Path is within an EZ and we have provided encryption parameters.
            // Make sure that the generated EDEK matches the settings of the EZ.
            String ezKeyName = dir.getKeyName(iip);
            if (!ezKeyName.equals(edek.getEncryptionKeyName())) {
              throw new RetryStartFileException();
            }
            feInfo = new FileEncryptionInfo(suite, version,
                edek.getEncryptedKeyVersion().getMaterial(),
                edek.getEncryptedKeyIv(),
                ezKeyName, edek.getEncryptionKeyVersionName());
            Preconditions.checkNotNull(feInfo);
          }
      

      Attachments

        1. HDFS-7252.002.patch
          2 kB
          Yi Liu
        2. HDFS-7252.001.patch
          2 kB
          Yi Liu

        Activity

          People

            hitliuyi Yi Liu
            hitliuyi Yi Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: