Skip to content
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

[Feature] Bypass sdk read and write decoupling #45918

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

Jay-ju
Copy link
Contributor

@Jay-ju Jay-ju commented May 20, 2024

Why I'm doing:

Fixes #47367

What I'm doing:

You can learn more about the background from pr's #38466.

This PR is mainly used to solve the problem that when BE directly reads and writes SR file format on S3, the code cannot be encapsulated into SDK form. This PR is mainly to decouple some code implementation and provide some compilation scripts.

build format lib

BUILD_TYPE=Debug ./build.sh --format-lib  -j32

will install directory:

-- Installing: /data00/code/community/starrocks/be/output/format-lib/
-- Installing: /data00/code/community/starrocks/be/output/format-lib/libstarrocks_format.so
Skip Building Java Extensions
***************************************
Successfully build StarRocks  √ Format Lib ; StartTime:2024-05-20 09:52:29, EndTime:2024-05-20 09:58:21, TotalTime:352s

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

Sorry, something went wrong.

@Jay-ju Jay-ju requested review from a team as code owners May 20, 2024 07:33
@mergify mergify bot assigned Jay-ju May 20, 2024
@Jay-ju Jay-ju force-pushed the bypass_sdk_read_and_write_decoupling branch 8 times, most recently from e0c2c85 to 61d5aad Compare May 27, 2024 02:09
@wyb wyb requested review from decster, kevincai and wyb June 19, 2024 05:10
@Jay-ju Jay-ju force-pushed the bypass_sdk_read_and_write_decoupling branch 6 times, most recently from d74163f to 18ed0a7 Compare June 24, 2024 08:07
(*tbl)->_slot_with_column_name_map[tdesc.id] = slot_d;
}

if (!slot_d->col_name().empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry

@@ -873,7 +872,7 @@ Status FragmentMgr::exec_external_plan_fragment(const TScanOpenParams& params, c
LOG(WARNING) << "tuple descriptor is null. id: " << slot_ref.tuple_id;
return Status::InvalidArgument("tuple descriptor is null");
}
auto* slot_desc = desc_tbl->get_slot_descriptor(slot_ref.slot_id);
auto* slot_desc = desc_tbl->get_slot_descriptor_with_column(slot_ref.slot_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change to this new api?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when spark connector using filter push down, be can't recognize slot column name

namespace starrocks::lake {

extern lake::TabletManager* _lake_tablet_manager;
// extern lake::UpdateManager* _lake_update_manager;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?


if (NOT BUILD_FORMAT_LIB)
list(APPEND STORAGE_FILES lake/starlet_location_provider.cpp)
message(STATUS "include starlet_location_provider.cpp when build Storage.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

@@ -103,7 +104,13 @@ const std::shared_ptr<const TabletSchema> Tablet::tablet_schema() const {
}

StatusOr<std::shared_ptr<const TabletSchema>> Tablet::get_schema() {
return _mgr->get_tablet_schema(_id, &_version_hint);
if (_tablet_schema) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when will _table_schema not be nullptr?

Copy link
Contributor Author

@Jay-ju Jay-ju Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here Tablet Construct Function has been modified

@@ -239,11 +244,17 @@ StatusOr<TabletMetadataPtr> TabletManager::get_tablet_metadata(int64_t tablet_id
}

StatusOr<TabletMetadataPtr> TabletManager::get_tablet_metadata(const string& path, bool fill_cache) {
std::shared_ptr<FileSystem> fs;
return get_tablet_metadata(fs, path, fill_cache);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why pass a invalid fs pointer as a parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

@plotor plotor force-pushed the bypass_sdk_read_and_write_decoupling branch 5 times, most recently from c1215bf to cafa2b3 Compare September 25, 2024 10:01
@plotor plotor force-pushed the bypass_sdk_read_and_write_decoupling branch from cafa2b3 to 5fdd31b Compare September 26, 2024 04:09

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Signed-off-by: jukejian <[email protected]>
Signed-off-by: plotor <[email protected]>
@plotor plotor force-pushed the bypass_sdk_read_and_write_decoupling branch from 5fdd31b to 4097009 Compare September 26, 2024 04:10
Copy link

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

pass : 262 / 314 (83.44%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/runtime/fragment_mgr.cpp 0 1 00.00% [878]
🔵 be/src/runtime/descriptors.cpp 2 6 33.33% [820, 822, 824, 827]
🔵 be/src/storage/lake/general_tablet_writer.cpp 12 22 54.55% [74, 98, 99, 266, 267, 268, 270, 272, 293, 294]
🔵 be/src/storage/lake/pk_tablet_writer.cpp 4 6 66.67% [67, 68]
🔵 be/src/fs/fs_s3.cpp 43 61 70.49% [138, 303, 379, 382, 383, 393, 403, 408, 415, 525, 526, 527, 528, 529, 530, 555, 556, 557]
🔵 be/src/fs/fs.cpp 4 5 80.00% [93]
🔵 be/src/storage/protobuf_file.cpp 17 20 85.00% [60, 77, 155]
🔵 be/src/storage/lake/rowset.cpp 33 38 86.84% [177, 438, 460, 461, 472]
🔵 be/src/storage/lake/lake_delvec_loader.cpp 14 16 87.50% [28, 31]
🔵 be/src/storage/lake/tablet_manager.cpp 15 17 88.24% [72, 73]
🔵 be/src/storage/lake/tablet.cpp 12 13 92.31% [113]
🔵 be/src/io/s3_input_stream.cpp 42 45 93.33% [70, 75, 111]
🔵 be/src/types/timestamp_value.cpp 7 7 100.00% []
🔵 be/src/storage/lake/meta_file.cpp 9 9 100.00% []
🔵 be/src/storage/lake/lake_delvec_loader.h 5 5 100.00% []
🔵 be/src/storage/rowset/indexed_column_reader.cpp 2 2 100.00% []
🔵 be/src/runtime/exec_env.cpp 2 2 100.00% []
🔵 be/src/storage/rowset/scalar_column_iterator.cpp 3 3 100.00% []
🔵 be/src/storage/lake/horizontal_compaction_task.cpp 2 2 100.00% []
🔵 be/src/storage/lake/vertical_compaction_task.cpp 2 2 100.00% []
🔵 be/src/storage/lake/tablet_reader.cpp 2 2 100.00% []
🔵 be/src/storage/lake/update_manager.cpp 9 9 100.00% []
🔵 be/src/storage/lake/tablet_manager.h 1 1 100.00% []
🔵 be/src/storage/rowset/segment.cpp 1 1 100.00% []
🔵 be/src/storage/lake/lake_primary_key_compaction_conflict_resolver.h 1 1 100.00% []
🔵 be/src/storage/protobuf_file.h 1 1 100.00% []
🔵 be/src/storage/lake/tablet.h 4 4 100.00% []
🔵 be/src/fs/fs.h 2 2 100.00% []
🔵 be/src/storage/lake/lake_primary_key_compaction_conflict_resolver.cpp 3 3 100.00% []
🔵 be/src/fs/hdfs/fs_hdfs.cpp 2 2 100.00% []
🔵 be/src/io/s3_input_stream.h 6 6 100.00% []

@trueeyu trueeyu merged commit 3fbe518 into StarRocks:main Sep 26, 2024
48 of 49 checks passed
@Samrose-Ahmed
Copy link
Contributor

I am trying to understand this PR, it seems to aim to achieve being able to directly read and write SR files. But what is the 'format-lib' that is being compiled and built, can you explain?

@kevincai
Copy link
Contributor

@Samrose-Ahmed yes, this PR will provide the ability to build the library format-lib, and then other application can leverage the library to interact with Frontend and has the ability to write data to remote storage directly without proxying through backend RPC.

@Samrose-Ahmed
Copy link
Contributor

Awesome thanks.

@wangsimo0
Copy link
Contributor

ignore backport check: 3.3.5

stdpain added a commit to stdpain/starrocks-2 that referenced this pull request Oct 15, 2024
alvin-celerdata pushed a commit that referenced this pull request Oct 15, 2024
libhdfs depend on libjvm.

introduced by #45918

Signed-off-by: stdpain <[email protected]>
ZiheLiu pushed a commit to ZiheLiu/starrocks that referenced this pull request Oct 31, 2024
libhdfs depend on libjvm.

introduced by StarRocks#45918

Signed-off-by: stdpain <[email protected]>
renzhimin7 pushed a commit to renzhimin7/starrocks that referenced this pull request Nov 7, 2024
Signed-off-by: jukejian <[email protected]>
Signed-off-by: plotor <[email protected]>
Signed-off-by: zhiminr.ren <[email protected]>
renzhimin7 pushed a commit to renzhimin7/starrocks that referenced this pull request Nov 7, 2024
libhdfs depend on libjvm.

introduced by StarRocks#45918

Signed-off-by: stdpain <[email protected]>
Signed-off-by: zhiminr.ren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bypass read/write SR segment files in storage separation mode
8 participants