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

Method CloseFilesAndVerifySizes

be/src/runtime/io/data-cache.cc:800–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798}
799
800Status DataCache::Partition::CloseFilesAndVerifySizes() {
801 if (trace_replay_) return Status::OK();
802 int64_t total_size = 0;
803 for (auto& file : cache_files_) {
804 uint64_t sz_on_disk;
805 // Close the backing files before checking sizes as some filesystems (e.g. XFS)
806 // preallocate the file beyond EOF. Closing the file removes any preallocation.
807 file->Close();
808 kudu::Env* env = kudu::Env::Default();
809 KUDU_RETURN_IF_ERROR(env->GetFileSizeOnDisk(file->path(), &sz_on_disk),
810 "CloseFilesAndVerifySizes()");
811 total_size += sz_on_disk;
812 uint64_t logical_sz;
813 KUDU_RETURN_IF_ERROR(env->GetFileSize(file->path(), &logical_sz),
814 "CloseFilesAndVerifySizes()");
815 DCHECK_LE(logical_sz, FLAGS_data_cache_file_max_size_bytes);
816 }
817 if (total_size > capacity_) {
818 return Status(Substitute("Partition $0 consumed $1 bytes, exceeding capacity of $2 "
819 "bytes", path_, total_size, capacity_));
820 }
821 return Status::OK();
822}
823
824void DataCache::Partition::ReleaseResources() {
825 std::unique_lock<SpinLock> partition_lock(lock_);

Callers 2

TEST_PFunction · 0.80

Calls 8

OKFunction · 0.85
DefaultClass · 0.85
SubstituteFunction · 0.85
GetFileSizeOnDiskMethod · 0.80
pathMethod · 0.80
StatusClass · 0.50
CloseMethod · 0.45
GetFileSizeMethod · 0.45

Tested by 2

TEST_PFunction · 0.64