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

Method Init

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

Source from the content-addressed store, hash-verified

678}
679
680Status DataCache::Partition::Init() {
681 std::unique_lock<SpinLock> partition_lock(lock_);
682
683 RETURN_IF_ERROR(meta_cache_->Init());
684
685 // Trace replay does not require further initialization, as it is only doing
686 // metadata operations and does not do filesystem operations.
687 if (trace_replay_) return Status::OK();
688
689 // Verify the validity of the path specified.
690 if (!FileSystemUtil::IsCanonicalPath(path_)) {
691 return Status(Substitute("$0 is not a canonical path", path_));
692 }
693 RETURN_IF_ERROR(FileSystemUtil::VerifyIsDirectory(path_));
694
695 // Make sure hole punching is supported for the caching directory.
696 RETURN_IF_ERROR(FileSystemUtil::CheckHolePunch(path_));
697
698 if (FLAGS_data_cache_enable_tracing) {
699 if (FLAGS_data_cache_trace_percentage > 100 ||
700 FLAGS_data_cache_trace_percentage < 0) {
701 return Status(Substitute("Misconfigured data_cache_trace_percentage: $0."
702 "Must be between 0 and 100.", FLAGS_data_cache_trace_percentage));
703 }
704
705 // If unspecified, use a directory under the "log_dir".
706 if (FLAGS_data_cache_trace_dir.empty()) {
707 stringstream default_trace_dir;
708 default_trace_dir << FLAGS_log_dir << "/data_cache_traces/";
709 FLAGS_data_cache_trace_dir = default_trace_dir.str();
710 }
711 // To avoid mixing trace files from different partitions, give each partition
712 // its own subdirectory.
713 stringstream trace_dir;
714 trace_dir << FLAGS_data_cache_trace_dir << Substitute("/partition-$0/", index_);
715 tracer_.reset(new trace::Tracer(trace_dir.str(),
716 FLAGS_max_data_cache_trace_file_size, FLAGS_max_data_cache_trace_files,
717 FLAGS_data_cache_anonymize_trace));
718 RETURN_IF_ERROR(tracer_->Init());
719 }
720
721 data_cache_write_concurrency_ = DeviceWriteConcurrency(path_);
722
723 // Create metrics for this partition
724 InitMetrics();
725
726 // Only if loading is not enabled, or if loading is enabled but fails, do we need to
727 // create new cache file.
728 if (!(FLAGS_data_cache_keep_across_restarts && Load().ok())) {
729 // Create a backing file for the partition.
730 RETURN_IF_ERROR(CreateCacheFile());
731 oldest_opened_file_ = 0;
732 }
733
734 // Delete all cache files that are not listed in cache_files_ (including dumped metadata
735 // file). These files were left over from previous runs and are now no longer needed.
736 RETURN_IF_ERROR(DeleteUntrackedFiles());
737

Callers 12

SetUpMethod · 0.45
TEST_FFunction · 0.45
SingleReaderTestBodyMethod · 0.45
CachedReadsTestBodyMethod · 0.45
DiskIoMgrStressMethod · 0.45
InitInternalMethod · 0.45
mainFunction · 0.45
SetupWithParametersMethod · 0.45
TEST_PFunction · 0.45
mainFunction · 0.45
LoadMethod · 0.45
TEST_FFunction · 0.45

Calls 15

OKFunction · 0.85
SubstituteFunction · 0.85
DeviceWriteConcurrencyFunction · 0.85
PrintBytesFunction · 0.85
SplitFunction · 0.85
SkipEmptyClass · 0.85
SplitStringToSetUsingFunction · 0.85
moveFunction · 0.85
resetMethod · 0.65
StatusClass · 0.50
emptyMethod · 0.45
strMethod · 0.45

Tested by 8

SetUpMethod · 0.36
TEST_FFunction · 0.36
SingleReaderTestBodyMethod · 0.36
CachedReadsTestBodyMethod · 0.36
SetupWithParametersMethod · 0.36
TEST_PFunction · 0.36
mainFunction · 0.36
TEST_FFunction · 0.36