Changeset View
Changeset View
Standalone View
Standalone View
src/leveldb/db/repair.cc
Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | Status ConvertLogToTable(uint64_t log) { | ||||
Slice record; | Slice record; | ||||
WriteBatch batch; | WriteBatch batch; | ||||
MemTable* mem = new MemTable(icmp_); | MemTable* mem = new MemTable(icmp_); | ||||
mem->Ref(); | mem->Ref(); | ||||
int counter = 0; | int counter = 0; | ||||
while (reader.ReadRecord(&record, &scratch)) { | while (reader.ReadRecord(&record, &scratch)) { | ||||
if (record.size() < 12) { | if (record.size() < 12) { | ||||
reporter.Corruption( | reporter.Corruption( | ||||
record.size(), Status::Corruption("log record too small")); | record.size(), Status::Corruption("log record too small", logname)); | ||||
continue; | continue; | ||||
} | } | ||||
WriteBatchInternal::SetContents(&batch, record); | WriteBatchInternal::SetContents(&batch, record); | ||||
status = WriteBatchInternal::InsertInto(&batch, mem); | status = WriteBatchInternal::InsertInto(&batch, mem); | ||||
if (status.ok()) { | if (status.ok()) { | ||||
counter += WriteBatchInternal::Count(&batch); | counter += WriteBatchInternal::Count(&batch); | ||||
} else { | } else { | ||||
Log(options_.info_log, "Log #%llu: ignoring %s", | Log(options_.info_log, "Log #%llu: ignoring %s", | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |