github-actions[bot] commented on code in PR #16813: URL: https://github.com/apache/doris/pull/16813#discussion_r1115296491
########## be/src/olap/tablet.cpp: ########## @@ -1729,6 +1729,7 @@ Status Tablet::_cooldown_data(const std::shared_ptr<io::RemoteFileSystem>& dest_ if (!old_rowset) { return Status::InternalError("cannot pick cooldown rowset in tablet {}", tablet_id()); } +<<<<<<< HEAD RowsetId new_rowset_id = StorageEngine::instance()->next_rowset_id(); Review Comment: warning: version control conflict marker in file [clang-diagnostic-error] ```cpp ablet_id()); ^ ``` ########## be/src/olap/tablet.cpp: ########## @@ -1802,6 +1795,42 @@ return Status::OK(); } +Status Tablet::_upload_rowset_meta(RowsetMetaSharedPtr& rowset_meta, RowsetSharedPtr& old_rowset, + const std::shared_ptr<io::RemoteFileSystem>& dest_fs) { + RowsetId new_rowset_id = StorageEngine::instance()->next_rowset_id(); + + auto start = std::chrono::steady_clock::now(); + + Status st; + { + std::shared_lock slock(_remote_files_lock, std::try_to_lock); Review Comment: warning: use of undeclared identifier '_remote_files_lock' [clang-diagnostic-error] ```cpp k::now(); ^ ``` ########## be/src/olap/tablet.cpp: ########## @@ -1941,6 +1970,58 @@ return Status::OK(); } +// Upload meta file first once this replica is chosen to be new cooldown replica. +// Consider such case: +// replica A: term 15, replica B: term 14, replica C: term 15 +// and the former cooldown replica is A +// if FE chooses C to be the new cooldown replica, and B tries to +// follow C now, B wouldn't be able to find .meta file on remote storage +void Tablet::_upload_cooldown_meta() { + if (_cooldown_replica_id != replica_id()) { + return; + } + Status st = [this]() -> Status { + std::unique_lock schema_change_lock(_schema_change_lock, std::try_to_lock); + if (!schema_change_lock.owns_lock()) { + LOG(WARNING) << "Failed to own schema_change_lock. tablet=" << tablet_id(); + return Status::Error<TRY_LOCK_FAILED>(); + } + // Check executing serially with compaction task. + std::unique_lock base_compaction_lock(_base_compaction_lock, std::try_to_lock); + if (!base_compaction_lock.owns_lock()) { + LOG(WARNING) << "Failed to own base_compaction_lock. tablet=" << tablet_id(); + return Status::Error<TRY_LOCK_FAILED>(); + } + std::unique_lock cumu_compaction_lock(_cumulative_compaction_lock, std::try_to_lock); + if (!cumu_compaction_lock.owns_lock()) { + LOG(WARNING) << "Failed to own cumu_compaction_lock. tablet=" << tablet_id(); + return Status::Error<TRY_LOCK_FAILED>(); + } + std::shared_ptr<io::RemoteFileSystem> dest_fs; + RETURN_IF_ERROR(_get_cooldown_dest_fs(dest_fs)); + + auto old_rowset = pick_cooldown_rowset(); + if (!old_rowset) { + LOG(WARNING) << "Cannot pick cooldown rowset in tablet " << tablet_id(); + return Status::OK(); + } + + UniqueId cooldown_meta_id = UniqueId::gen_uid(); + std::shared_ptr<RowsetMeta> new_rowset_meta; + RETURN_IF_ERROR(_upload_rowset_meta(new_rowset_meta, old_rowset, dest_fs)); + + // upload cooldowned rowset meta to remote fs + RETURN_IF_ERROR( + _write_cooldown_meta(dest_fs.get(), cooldown_meta_id, new_rowset_meta.get())); Review Comment: warning: use of undeclared identifier '_write_cooldown_meta' [clang-diagnostic-error] ```cpp ote fs ^ ``` ########## be/src/olap/tablet.cpp: ########## @@ -1941,6 +1970,58 @@ return Status::OK(); } +// Upload meta file first once this replica is chosen to be new cooldown replica. +// Consider such case: +// replica A: term 15, replica B: term 14, replica C: term 15 +// and the former cooldown replica is A +// if FE chooses C to be the new cooldown replica, and B tries to +// follow C now, B wouldn't be able to find .meta file on remote storage +void Tablet::_upload_cooldown_meta() { + if (_cooldown_replica_id != replica_id()) { + return; + } + Status st = [this]() -> Status { + std::unique_lock schema_change_lock(_schema_change_lock, std::try_to_lock); + if (!schema_change_lock.owns_lock()) { + LOG(WARNING) << "Failed to own schema_change_lock. tablet=" << tablet_id(); + return Status::Error<TRY_LOCK_FAILED>(); + } + // Check executing serially with compaction task. + std::unique_lock base_compaction_lock(_base_compaction_lock, std::try_to_lock); + if (!base_compaction_lock.owns_lock()) { + LOG(WARNING) << "Failed to own base_compaction_lock. tablet=" << tablet_id(); + return Status::Error<TRY_LOCK_FAILED>(); + } + std::unique_lock cumu_compaction_lock(_cumulative_compaction_lock, std::try_to_lock); + if (!cumu_compaction_lock.owns_lock()) { + LOG(WARNING) << "Failed to own cumu_compaction_lock. tablet=" << tablet_id(); + return Status::Error<TRY_LOCK_FAILED>(); + } + std::shared_ptr<io::RemoteFileSystem> dest_fs; + RETURN_IF_ERROR(_get_cooldown_dest_fs(dest_fs)); Review Comment: warning: use of undeclared identifier '_get_cooldown_dest_fs' [clang-diagnostic-error] ```cpp <io::RemoteFileSystem> dest_fs; ^ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org