IMPALA-4820: avoid writing unencrypted data during write cancellation
The bug was that unencrypted data could be written to disk if
the write was cancelled before it completed. This bug was introduced
after Impala 2.8.0 was branched in the commit "
rework scratch file I/O", so does not appear in any released versions
The fix is to only start decrypting data after the write is
Added a regression test that reproduced the problem (after adding a
delay to the write).
Tested-by: Impala Public Jenkins
Reviewed-by: Tim Armstrong <email@example.com>