| 794 | } |
| 795 | |
| 796 | Status DBImpl::OpenCompactionOutputFile(CompactionState* compact) { |
| 797 | assert(compact != nullptr); |
| 798 | assert(compact->builder == nullptr); |
| 799 | uint64_t file_number; |
| 800 | { |
| 801 | mutex_.Lock(); |
| 802 | file_number = versions_->NewFileNumber(); |
| 803 | pending_outputs_.insert(file_number); |
| 804 | CompactionState::Output out; |
| 805 | out.number = file_number; |
| 806 | out.smallest.Clear(); |
| 807 | out.largest.Clear(); |
| 808 | compact->outputs.push_back(out); |
| 809 | mutex_.Unlock(); |
| 810 | } |
| 811 | |
| 812 | // Make the output file |
| 813 | std::string fname = TableFileName(dbname_, file_number); |
| 814 | Status s = env_->NewWritableFile(fname, &compact->outfile); |
| 815 | if (s.ok()) { |
| 816 | compact->builder = new TableBuilder(options_, compact->outfile); |
| 817 | } |
| 818 | return s; |
| 819 | } |
| 820 | |
| 821 | Status DBImpl::FinishCompactionOutputFile(CompactionState* compact, |
| 822 | Iterator* input) { |
nothing calls this directly
no test coverage detected