Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2356

Reduce expected removeKeyAltName operations to a single findOneAndUpdate

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Component/s: None
    • None
    • Needed
    • Hide
      • Sync CSE Unified Spec Tests for ClientEncryption.removeKeyAltName() to dade3e4d.
      • If applicable, update implementation of ClientEncryption.removeKeyAltName() to use a single findOneAndUpdate() for both keyAltName removal and conditionally unsetting the keyAltNames field.
      Show
      Sync CSE Unified Spec Tests for ClientEncryption.removeKeyAltName() to dade3e4d . If applicable, update implementation of ClientEncryption.removeKeyAltName() to use a single findOneAndUpdate() for both keyAltName removal and conditionally unsetting the keyAltNames field.
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      CDRIVER-4406 Fixed 1.22.0
      CXX-2527 Done 3.8.0
      CSHARP-4212 Fixed 2.17.0
      GODRIVER-2456 Duplicate
      JAVA-4650 Done
      NODE-4312 Done
      MOTOR-978 Duplicate
      PYTHON-3305 Duplicate
      PHPC-2125 Fixed 1.15.0
      RUBY-3027 Fixed 2.18.0
      RUST-1365 Duplicate
      SWIFT-1584 Duplicate
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion CDRIVER-4406 Fixed 1.22.0 CXX-2527 Done 3.8.0 CSHARP-4212 Fixed 2.17.0 GODRIVER-2456 Duplicate JAVA-4650 Done NODE-4312 Done MOTOR-978 Duplicate PYTHON-3305 Duplicate PHPC-2125 Fixed 1.15.0 RUBY-3027 Fixed 2.18.0 RUST-1365 Duplicate SWIFT-1584 Duplicate

      Summary

      DRIVERS-2017 introduced unified spec tests for the Key Management API added to ClientEncryption in DRIVERS-1951. The unified spec tests for the removeKeyAltName() method, as currently written, expect up to two operations: a findOneAndUpdate() to remove a keyAltName from the keyAltNames field of a matching key document, and a conditional updateOne() to $unset the keyAltNames field if the array would otherwise be empty. This is to satisfy the conditions of the partial filter expression for the unique index on keyAltNames in the key vault collection.

      The removeKeyAltName() function can be optimized to use only a single findOneAndUpdate() that still conditionally $unsets the keyAltNames field by using an aggregation pipeline.

      Motivation

      Who is the affected end user?

      Any Drivers that have begun implementing, or have already implemented, the new  removeKeyAltName() function.

      How does this affect the end user?

      Drivers will have to update the unified spec test file(s) and implementation of removeKeyAltName() to satisfy the new expectations.

      How likely is it that this problem or use case will occur?

      N/A

      If the problem does occur, what are the consequences and how severe are they?

      N/A

      Is this issue urgent?

      No. This is an optimization.

      Is this ticket required by a downstream team?

      No.

      Is this ticket only for tests?

      No. The updated unified spec test will also require updating existing implementations of removeKeyAltName().

            Assignee:
            ezra.chung@mongodb.com Ezra Chung
            Reporter:
            ezra.chung@mongodb.com Ezra Chung
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: