MCPcopy Create free account
hub / github.com/apache/impala / TmpFileGroup

Method TmpFileGroup

be/src/runtime/tmp-file-mgr.cc:1271–1327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1269}
1270
1271TmpFileGroup::TmpFileGroup(TmpFileMgr* tmp_file_mgr, DiskIoMgr* io_mgr,
1272 RuntimeProfile* profile, const TUniqueId& unique_id, int64_t bytes_limit)
1273 : tmp_file_mgr_(tmp_file_mgr),
1274 io_mgr_(io_mgr),
1275 io_ctx_(nullptr),
1276 unique_id_(unique_id),
1277 bytes_limit_(bytes_limit),
1278 write_counter_(ADD_COUNTER(profile, "ScratchWrites", TUnit::UNIT)),
1279 bytes_written_counter_(ADD_COUNTER(profile, "ScratchBytesWritten", TUnit::BYTES)),
1280 uncompressed_bytes_written_counter_(
1281 ADD_COUNTER(profile, "UncompressedScratchBytesWritten", TUnit::BYTES)),
1282 read_counter_(ADD_COUNTER(profile, "ScratchReads", TUnit::UNIT)),
1283 bytes_read_counter_(ADD_COUNTER(profile, "ScratchBytesRead", TUnit::BYTES)),
1284 read_use_mem_counter_(ADD_COUNTER(profile, "ScratchReadsUseMem", TUnit::UNIT)),
1285 bytes_read_use_mem_counter_(
1286 ADD_COUNTER(profile, "ScratchBytesReadUseMem", TUnit::BYTES)),
1287 read_use_local_disk_counter_(
1288 ADD_COUNTER(profile, "ScratchReadsUseLocalDisk", TUnit::UNIT)),
1289 bytes_read_use_local_disk_counter_(
1290 ADD_COUNTER(profile, "ScratchBytesReadUseLocalDisk", TUnit::BYTES)),
1291 scratch_space_bytes_used_counter_(
1292 ADD_COUNTER(profile, "ScratchFileUsedBytes", TUnit::BYTES)),
1293 disk_read_timer_(ADD_TIMER(profile, "TotalReadBlockTime")),
1294 encryption_timer_(ADD_TIMER(profile, "TotalEncryptionTime")),
1295 compression_timer_(tmp_file_mgr->compression_enabled() ?
1296 ADD_TIMER(profile, "TotalCompressionTime") :
1297 nullptr),
1298 num_blacklisted_files_(0),
1299 spilling_disk_faulty_(false),
1300 current_bytes_allocated_(0),
1301 current_bytes_allocated_remote_(0),
1302 next_allocation_index_(0),
1303 free_ranges_(64) {
1304 DCHECK(tmp_file_mgr != nullptr);
1305 io_ctx_ = io_mgr_->RegisterContext();
1306 io_ctx_->set_read_use_mem_counter(read_use_mem_counter_);
1307 io_ctx_->set_bytes_read_use_mem_counter(bytes_read_use_mem_counter_);
1308 io_ctx_->set_read_use_local_disk_counter(read_use_local_disk_counter_);
1309 io_ctx_->set_bytes_read_use_local_disk_counter(bytes_read_use_local_disk_counter_);
1310 // Populate the priority based index ranges.
1311 const std::vector<std::unique_ptr<TmpDir>>& tmp_dirs = tmp_file_mgr_->tmp_dirs_;
1312 if (tmp_dirs.size() > 0) {
1313 int start_index = 0;
1314 int priority = tmp_dirs[0]->priority();
1315 for (int i = 0; i < tmp_dirs.size() - 1; ++i) {
1316 priority = tmp_dirs[i]->priority();
1317 const int next_priority = tmp_dirs[i + 1]->priority();
1318 if (next_priority != priority) {
1319 tmp_files_index_range_.emplace(priority, TmpFileIndexRange(start_index, i));
1320 start_index = i + 1;
1321 priority = next_priority;
1322 }
1323 }
1324 tmp_files_index_range_.emplace(priority,
1325 TmpFileIndexRange(start_index, tmp_dirs.size() - 1));
1326 }
1327}
1328

Callers

nothing calls this directly

Calls 9

TmpFileIndexRangeClass · 0.85
compression_enabledMethod · 0.80
RegisterContextMethod · 0.80
sizeMethod · 0.45
priorityMethod · 0.45

Tested by

no test coverage detected