num_running_ingest_file_++;
+ // We cannot ingest a file into a dropped CF
+ if (cfd->IsDropped()) {
+ status = Status::InvalidArgument(
+ "Cannot ingest an external file into a dropped CF");
+ }
+
// Figure out if we need to flush the memtable first
- bool need_flush = false;
- status = ingestion_job.NeedsFlush(&need_flush);
- if (status.ok() && need_flush) {
- mutex_.Unlock();
- status = FlushMemTable(cfd, FlushOptions(), true /* writes_stopped */);
- mutex_.Lock();
+ if (status.ok()) {
+ bool need_flush = false;
+ status = ingestion_job.NeedsFlush(&need_flush);
+
+ if (status.ok() && need_flush) {
+ mutex_.Unlock();
+ status = FlushMemTable(cfd, FlushOptions(), true /* writes_stopped */);
+ mutex_.Lock();
+ }
}
// Run the ingestion job
ASSERT_OK(db_->IngestExternalFile(handles_[2], {unknown_sst}, ifo));
// SST CF unknown
ASSERT_OK(db_->IngestExternalFile(handles_[0], {unknown_sst}, ifo));
+
+ // Cannot ingest a file into a dropped CF
+ ASSERT_OK(db_->DropColumnFamily(handles_[1]));
+ ASSERT_NOK(db_->IngestExternalFile(handles_[1], {unknown_sst}, ifo));
+
+ // CF was not dropped, ok to Ingest
+ ASSERT_OK(db_->IngestExternalFile(handles_[2], {unknown_sst}, ifo));
}
class TestIngestExternalFileListener : public EventListener {