rocksdb/db/compaction
Jay Huh d46d1fa105 Skip building remote compaction output file when not OK (#13183)
Summary:
During `FinishCompactionOutputFile()` if there's an IOError, we may end up having the output in memory, but table properties are not populated, because `outputs.UpdateTableProperties();` is called only when `s.ok()` is true.

However, during remote compaction result serialization, we always try to access the `table_properties` which may be null.  This was causing a segfault.

We can skip building the output files in the result completely if the status is not ok.

# Unit Test
New test added
```
./compaction_service_test --gtest_filter="*CompactionOutputFileIOError*"
```

Before the fix
```
Received signal 11 (Segmentation fault)
Invoking GDB for stack trace...
https://github.com/facebook/rocksdb/issues/4  0x00000000004708ed in rocksdb::TableProperties::TableProperties (this=0x7fae070fb4e8) at ./include/rocksdb/table_properties.h:212
212     struct TableProperties {
https://github.com/facebook/rocksdb/issues/5  0x00007fae0b195b9e in rocksdb::CompactionServiceOutputFile::CompactionServiceOutputFile (this=0x7fae070fb400, name=..., smallest=0, largest=0, _smallest_internal_key=..., _largest_internal_key=..., _oldest_ancester_time=1733335023, _file_creation_time=1733335026, _epoch_number=1, _file_checksum=..., _file_checksum_func_name=..., _paranoid_hash=0, _marked_for_compaction=false, _unique_id=..., _table_properties=...) at ./db/compaction/compaction_job.h:450
450             table_properties(_table_properties) {}
```

After the fix
```
[ RUN      ] CompactionServiceTest.CompactionOutputFileIOError
[       OK ] CompactionServiceTest.CompactionOutputFileIOError (4499 ms)
[----------] 1 test from CompactionServiceTest (4499 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (4499 ms total)
[  PASSED  ] 1 test.
```

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13183

Reviewed By: anand1976

Differential Revision: D66770876

Pulled By: jaykorean

fbshipit-source-id: 63df7c2786ce0353f38a93e493ae4e7b591f4ed9
2024-12-04 17:25:31 -08:00
..
clipping_iterator.h Refactor AddRangeDels() + consider range tombstone during compaction file cutting (#11113) 2023-02-22 12:28:18 -08:00
clipping_iterator_test.cc Print stack traces on frozen tests in CI (#10828) 2022-10-18 00:35:35 -07:00
compaction.cc Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction.h Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction_iteration_stats.h Add initial support for TimedPut API (#12419) 2024-03-14 15:44:55 -07:00
compaction_iterator.cc Fix the issue where compaction incorrectly drops a key when there is a snapshot with a sequence number of zero. (#13155) 2024-12-02 13:31:19 -08:00
compaction_iterator.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_iterator_test.cc Fix the issue where compaction incorrectly drops a key when there is a snapshot with a sequence number of zero. (#13155) 2024-12-02 13:31:19 -08:00
compaction_job.cc Skip building remote compaction output file when not OK (#13183) 2024-12-04 17:25:31 -08:00
compaction_job.h Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction_job_stats_test.cc Replace ScopedArenaIterator with ScopedArenaPtr<InternalIterator> (#12470) 2024-03-22 13:40:42 -07:00
compaction_job_test.cc Record newest_key_time as a table property (#13083) 2024-11-01 10:08:35 -07:00
compaction_outputs.cc Preserve TimedPut on penultimate level until it actually expires (#12543) 2024-04-30 11:16:02 -07:00
compaction_outputs.h Include TableProperties in the CompactionServiceResult (#13089) 2024-10-25 13:13:12 -07:00
compaction_picker.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker.h Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_fifo.cc Remove early return when scanning files for temperature change compaction (#13112) 2024-11-05 09:12:39 -08:00
compaction_picker_fifo.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_picker_level.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_level.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_picker_test.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_universal.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_universal.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_service_job.cc Skip building remote compaction output file when not OK (#13183) 2024-12-04 17:25:31 -08:00
compaction_service_test.cc Skip building remote compaction output file when not OK (#13183) 2024-12-04 17:25:31 -08:00
compaction_state.cc Fix Compaction Stats (#13071) 2024-10-16 19:20:37 -07:00
compaction_state.h Tiered Compaction: per key placement support (#9964) 2022-07-13 20:54:49 -07:00
file_pri.h Avoid shifting component too large error in FileTtlBooster (#11673) 2023-08-04 14:29:50 -07:00
sst_partitioner.cc Remove FactoryFunc from LoadXXXObject (#11203) 2023-02-17 12:54:07 -08:00
subcompaction_state.cc Fix and test for leaks of open SST files (#13117) 2024-11-08 10:54:43 -08:00
subcompaction_state.h Fix Compaction Stats (#13071) 2024-10-16 19:20:37 -07:00
tiered_compaction_test.cc Steps toward preserve/preclude options mutable (#13124) 2024-11-18 19:34:01 -08:00