Skip to content

Commit 4e9645e

Browse files
committed
MB-61292: Do not compress encrypted log files
Change-Id: I228bfb6bc7362a8833e065dadb6519e983b8dc3b Reviewed-on: https://review.couchbase.org/c/ns_server/+/217190 Tested-by: Build Bot <[email protected]> Reviewed-by: Timofey Barmin <[email protected]> Well-Formed: Build Bot <[email protected]>
1 parent 02720ba commit 4e9645e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

apps/ale/src/ale_disk_sink.erl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@ do_open_file(Path, #file_info{inode = Inode}) ->
407407
Error
408408
end.
409409

410+
compress_unencrypted(false = _IsEncrypted, Name, UncompressPth, CompressPth) ->
411+
time_stat(Name, compression_time,
412+
fun () ->
413+
compress_file(UncompressPth, CompressPth)
414+
end);
415+
compress_unencrypted(true = _IsEncrypted, _, _, _) ->
416+
ok.
417+
410418
maybe_compress_post_rotate(#worker_state{sink_name = Name,
411419
path = Path,
412420
rotation_num_files = NumFiles,
@@ -415,10 +423,8 @@ maybe_compress_post_rotate(#worker_state{sink_name = Name,
415423
UncompressedPath = Path ++ ".1",
416424
CompressedPath = Path ++ ".1.gz",
417425

418-
time_stat(Name, compression_time,
419-
fun () ->
420-
compress_file(UncompressedPath, CompressedPath)
421-
end);
426+
IsEncrypted = ale:is_file_encrypted(UncompressedPath),
427+
compress_unencrypted(IsEncrypted, Name, UncompressedPath, CompressedPath);
422428
maybe_compress_post_rotate(_) ->
423429
ok.
424430

0 commit comments

Comments
 (0)