Skip to content

Compactions should not cause corruption #6435

@sakridge

Description

@sakridge

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

Expected behavior

When doing an insert, errors are seen from rocksdb and the values are not inserted:

RocksDb(Error { message: "Corruption: block checksum mismatch: expected 1837325370, got 1292688122  in /home/ubuntu/validator-ledger/rocksdb/039077.sst offset 13991299 size 3758" }))
2020/02/19-11:23:44.797082 7f958effd700 (Original Log Time 2020/02/19-11:23:44.793153) [db/memtable_list.cc:386] [code_shred] Level-0 commit table #39137 started
2020/02/19-11:23:44.797085 7f958effd700 (Original Log Time 2020/02/19-11:23:44.796789) [db/memtable_list.cc:434] [code_shred] Level-0 commit table #39137: memtable #1 done
2020/02/19-11:23:44.797087 7f958effd700 (Original Log Time 2020/02/19-11:23:44.796850) EVENT_LOG_v1 {"time_micros": 1582140224796817, "job": 20, "event": "flush_finished", "output_compression": "NoCompression", "lsm_state": [3, 2, 0, 0, 0, 0, 0], "immutable_memtables": 0}
2020/02/19-11:23:44.797088 7f958effd700 (Original Log Time 2020/02/19-11:23:44.796959) [db/db_impl_compaction_flush.cc:201] [code_shred] Level summary: files[3 2 0 0 0 0 0] max score 0.75
2020/02/19-11:23:44.797200 7f9021bed700 [db/db_impl_compaction_flush.cc:1453] [code_shred] Manual compaction starting
2020/02/19-11:23:44.797858 7f9599ffb700 (Original Log Time 2020/02/19-11:23:44.797807) [db/db_impl_compaction_flush.cc:2428] [code_shred] Manual compaction from level-0 to level-1 from ' .. '; will stop at (end)
2020/02/19-11:23:44.797865 7f9599ffb700 [db/compaction_job.cc:1650] [code_shred] [JOB 23] Compacting 3@0 + 2@1 files to L1, score -1.00
2020/02/19-11:23:44.797876 7f9599ffb700 [db/compaction_job.cc:1654] [code_shred] Compaction start summary: Base version 37 Base level 0, inputs: [39137(483KB) 39119(5848B) 39107(191KB)], [39077(103MB) 39078(17MB)]
2020/02/19-11:23:44.798038 7f9599ffb700 EVENT_LOG_v1 {"time_micros": 1582140224797981, "job": 23, "event": "compaction_started", "compaction_reason": "ManualCompaction", "files_L0": [39137, 39119, 39107], "files_L1": [39077, 39078], "score": -1, "input_data_size": 127316315}
2020/02/19-11:23:44.865719 7f9599ffb700 [WARN] [db/db_impl_compaction_flush.cc:2721] Compaction error: Corruption: block checksum mismatch: expected 1837325370, got 1292688122  in /home/ubuntu/validator-ledger/rocksdb/039077.sst offset 13991299 size 3758
2020/02/19-11:23:44.865874 7f9599ffb700 (Original Log Time 2020/02/19-11:23:44.865499) [db/compaction_job.cc:771] [code_shred] compacted to: files[3 2 0 0 0 0 0] max score 0.00, MB/sec: 1889.9 rd, 0.0 wr, level 1, files in(3, 2) out(0) MB in(0.7, 120.8) out(0.0), read-write-amplify(182.8) write-amplify(0.0) Corruption: block checksum mismatch: exp
ected 1837325370, got 1292688122  in /home/ubuntu/validator-ledger/rocksdb/039077.sst offset 13991299 size 3758, records in: 100485, records dropped: 11148 output_compression: NoCompression
2020/02/19-11:23:44.865882 7f9599ffb700 (Original Log Time 2020/02/19-11:23:44.865664) EVENT_LOG_v1 {"time_micros": 1582140224865530, "job": 23, "event": "compaction_finished", "compaction_time_micros": 67366, "compaction_time_cpu_micros": 51101, "output_level": 1, "num_output_files": 0, "total_output_size": 0, "num_input_records": 11148, "num_out
put_records": 0, "num_subcompactions": 1, "output_compression": "NoCompression", "num_single_delete_mismatches": 0, "num_single_delete_fallthrough": 0, "lsm_state": [3, 2, 0, 0, 0, 0, 0]}
2020/02/19-11:23:44.865914 7f9599ffb700 [ERROR] [db/db_impl_compaction_flush.cc:2266] Waiting after background compaction error: Corruption: block checksum mismatch: expected 1837325370, got 1292688122  in /home/ubuntu/validator-ledger/rocksdb/039077.sst offset 13991299 size 3758, Accumulated background error counts: 1
2020/02/19-11:23:44.866269 7f9021bed700 [db/db_impl_write.cc:1438] [dead_slots] New memtable created with log file: #39138. Immutable memtables: 0.
2020/02/19-11:23:44.866481 7f9021bed700 [db/db_impl_write.cc:1438] [erasure_meta] New memtable created with log file: #39138. Immutable memtables: 0.
2020/02/19-11:23:44.866655 7f9021bed700 [db/db_impl_write.cc:1438] [orphans] New memtable created with log file: #39138. Immutable memtables: 0.
2020/02/19-11:23:44.866821 7f9021bed700 [db/db_impl_write.cc:1438] [index] New memtable created with log file: #39138. Immutable memtables: 0.
2020/02/19-11:23:44.867014 7f9021bed700 [db/db_impl_write.cc:1438] [transaction_status] New memtable created with log file: #39138. Immutable memtables: 0.

In the log we see errors with corruption during a compaction.

Rocks version:

2020/02/18-16:01:36.479968 7f2b4f185680 RocksDB version: 6.2.4
2020/02/18-16:01:36.480219 7f2b4f185680 Git sha rocksdb_build_git_sha:@76a56d89a7740f8dbb01edabf1ea5abc95a67657@
2020/02/18-16:01:36.480222 7f2b4f185680 Compile date Feb 18 2020
2020/02/18-16:01:36.480224 7f2b4f185680 DB SUMMARY
2020/02/18-16:01:36.480313 7f2b4f185680 CURRENT file:  CURRENT
2020/02/18-16:01:36.480315 7f2b4f185680 IDENTITY file:  IDENTITY
2020/02/18-16:01:36.480331 7f2b4f185680 MANIFEST file:  MANIFEST-000004 size: 550 Bytes

Actual behavior

Corruption messages and failures from insert.

Steps to reproduce the behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions