TileDB icon indicating copy to clipboard operation
TileDB copied to clipboard

Refactor repeated encryption get stanza

Open robertbindar opened this issue 2 years ago • 1 comments

Refactor 6 almost identical code sequences that are used in storage_manager.cc and array.cc, also in the new Group API, into an external function.

Notes to the reviewers: It might be that the decisions I took below might alter some corner cases I failed to see, backward compatibility, etc. So please read the notes below.

  • The refactored code is missing asserts that were present in the original code. This version returns Status codes when things go sideways whilst reading the encryption configuration.
  • I altered a test case that was failing for me. The test case sets "sm.encryption_key" to "0", but a comment two lines above says Check ok with null key. The test case was failing for me because "0" has a length of 1, which is an invalid length for an encryption key, so the new function returned an error Status. With the original code, the test was not failing because "0" was being detected as an invalid-length key, but no error was being returned, the code was running the rest of the function with encryption_key=nullptr and key_length=0. I'm not sure what's the expected behavior here, I altered the test case because it seemed like a mistake to me.

TYPE: IMPROVEMENT DESC: Refactor repeated encryption get stanza

robertbindar avatar Apr 05 '22 11:04 robertbindar

Stale draft, closing until revisit.

ihnorton avatar Aug 16 '22 04:08 ihnorton