-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support remote storage, step2, only for be: hot data trans to cold data. clean cold data when drop table #7529
Conversation
link to #7575 |
I have two questions:
|
Please update the PR comment to describe the new implementation |
|
fe/fe-core/src/main/java/org/apache/doris/alter/MigrationHandler.java
Outdated
Show resolved
Hide resolved
…ta. clean cold data when drop table
…ta. clean cold data when drop table
|
||
OLAPStatus upload_files_to(const FilePathDesc& dir_desc) override; | ||
OLAPStatus upload_files_to(const FilePathDesc& dir_desc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need this api?
@@ -110,7 +110,7 @@ OLAPStatus AlphaRowset::link_files_to(const FilePathDesc& dir_desc, RowsetId new | |||
return OLAP_SUCCESS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not support alpha rowset any more, just return error and stop migration job if this rowset is alpharowset
@@ -28,9 +29,10 @@ extern MetricPrototype METRIC_query_scan_bytes; | |||
extern MetricPrototype METRIC_query_scan_rows; | |||
extern MetricPrototype METRIC_query_scan_count; | |||
|
|||
BaseTablet::BaseTablet(TabletMetaSharedPtr tablet_meta, DataDir* data_dir) | |||
BaseTablet::BaseTablet(TabletMetaSharedPtr tablet_meta, const StorageParamPB& storage_param, DataDir* data_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not add a new parameter, StorageParam should be part of TabletMeta
@@ -776,18 +783,18 @@ void StorageEngine::_clean_unused_txns() { | |||
} | |||
} | |||
|
|||
OLAPStatus StorageEngine::_do_sweep(const string& scan_root, const time_t& local_now, | |||
OLAPStatus StorageEngine::_do_sweep(const FilePathDesc& scan_root_desc, const time_t& local_now, | |||
const int32_t expire) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cold data will have no trash or garbage, not deal with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be deleted later, but I think is safer when migration operation is online for the first time.
std::shared_ptr<Env> env = Env::get_env(path_desc); | ||
if (env == nullptr) { | ||
LOG(INFO) << "remote storage is not exist, create it. storage_name: " << request.storage_param.storage_name; | ||
RETURN_WITH_WARN_IF_ERROR(Env::get_remote_mgr()->create_remote_storage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remote Storage Object should be shared, do not create remote storage object for every tablet. For example, we may monitor the remote storage's performance, if there are too many object, it is too hard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remote storage is shared in RemoteEnvMgr. Env::get_env() will get the shared_ptr from RemoteEnvMgr, path_desc will only take the storage_name and medium type.
@@ -1091,7 +1131,48 @@ void TabletManager::try_delete_unused_tablet_path(DataDir* data_dir, TTabletId t | |||
// TODO(ygl): may do other checks in the future | |||
if (Env::Default()->path_exists(schema_hash_path).ok()) { | |||
LOG(INFO) << "start to move tablet to trash. tablet_path = " << schema_hash_path; | |||
OLAPStatus rm_st = move_to_trash(schema_hash_path, schema_hash_path); | |||
FilePathDesc segment_desc(schema_hash_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tablet GC could not be performance on any BE, because it does not know when to delete data.
It should be performed on FE. Be only care about its local data not remote data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every remote data has a local meta, When the local meta is deleted, remote data will be deleted too.
If deleted by fe, when a migration operation is failed and did not notify fe, how can fe know it?
I have reviewed the code, it is too complicated, It should be simplified.
|
I also think Env is not used properly. There are many code like if Env is xxx Env then do something. I think we could bind tablet to specific Env, then not check env type and just call env object's method directly. |
Some method in Env is useless, for example `
} It does not make sense to be part of Env. What about just use posix api do to this and simplify Env Interface. new_random_access_file is used in read cluster id. It is not related with remote storage. |
This PR is closed, please refer to #8663 |
Proposed changes
1.1 FE create a new shadow tablet with remote path, send this request to BE.(MigrationHandler.java)
1.2 BE will create local cache dir for remote path, upload data from local to s3. (schema_change.cpp beta_rowset.cpp)
1.3 Write tablet_uid(used for remote path) in cache path. (schema_change.cpp) tablet_uid will be used to create the remote path on S3. When the remote path need to be deleted, tablet_uid is useful.
1.4 update meta to olap meta. (schema_change.cpp)
2.1 Add StorageColdMedium for DataProperty. change every DataProperty() function.
2.2 Add Type S3 to Cold Storage. (PropertyAnalyzer.java)
3.1 RemoteBlockManager will be used, all the operations will be done in it.
3.2 When a select operation arrived, it will be send to RemoteBlockManager, download the files from remote path on S3 to cache path, read the files in cache path and return.
3.1 move remote data to trash path on s3.(data_dir.cpp move_to_trash())
3.2 move local data to trash path on local disk.
3.3 delete files in trash dir on remote and local.(storage_engine.cpp start_trash_sweep() _do_sweep())
Types of changes
What types of changes does your code introduce to Doris?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
After this patch, get remote data when select is called.