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

[Enhancement] Reduce txn log writes and deletes #42542

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

sduzh
Copy link
Contributor

@sduzh sduzh commented Mar 13, 2024

Why I'm doing:

In the current implementation, for each data load, each Tablet creates a txn log file on the object store and deletes it after a successful publish version. This will bring a lot of object store access, which can easily lead to request limit exceeded problem, and also some API access billing.

What I'm doing:

Instead of creating a txn log file for each Tablet at the end of data loading, the OlapTableSink node creates a single combined txn log file containing all tablet txn logs. During the publish version phase, each tablet will get the combined txn log file and find its own txn log from it.

TODO:

  • Optimize abort_txn requests to avoid duplicate deletion of combined txn logs
  • For transactions using a combined txn log, do not send a delete_txn_log request after the batch publish version succeeds

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.2
    • 3.1
    • 3.0
    • 2.5

@sduzh
Copy link
Contributor Author

sduzh commented Mar 20, 2024

@wyb @kevincai @meegoo PTAL

@sduzh
Copy link
Contributor Author

sduzh commented Mar 22, 2024

@Mergifyio reabase

Copy link
Contributor

mergify bot commented Mar 22, 2024

reabase

❌ Sorry but I didn't understand the command. Please consult the commands documentation 📚.

@sduzh
Copy link
Contributor Author

sduzh commented Mar 22, 2024

@Mergifyio rebase

Copy link
Contributor

mergify bot commented Mar 22, 2024

rebase

✅ Branch has been successfully rebased

@sduzh sduzh force-pushed the enhancement/merge-txn-log branch from 6584800 to be87f77 Compare March 22, 2024 09:12
@sduzh
Copy link
Contributor Author

sduzh commented Mar 25, 2024

@wyb PTAL

@sduzh sduzh force-pushed the enhancement/merge-txn-log branch 3 times, most recently from 40dd029 to 3f69af3 Compare March 30, 2024 13:37
@sduzh sduzh force-pushed the enhancement/merge-txn-log branch 4 times, most recently from 79a16c2 to 319a221 Compare April 16, 2024 09:15
kevincai
kevincai previously approved these changes Apr 16, 2024
@sduzh sduzh enabled auto-merge (squash) April 17, 2024 06:24
@sduzh
Copy link
Contributor Author

sduzh commented Apr 17, 2024

@Mergifyio rebase

Copy link
Contributor

mergify bot commented Apr 17, 2024

rebase

✅ Branch has been successfully rebased

@sduzh sduzh force-pushed the enhancement/merge-txn-log branch from 35b9a12 to 091d38a Compare April 17, 2024 07:00
@sduzh sduzh force-pushed the enhancement/merge-txn-log branch from 091d38a to 0a10749 Compare April 19, 2024 06:38
@sduzh sduzh requested a review from a team as a code owner April 19, 2024 06:38
Copy link

@sduzh sduzh removed the request for review from meegoo April 19, 2024 07:15
Copy link

[FE Incremental Coverage Report]

pass : 87 / 105 (82.86%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/lake/Utils.java 6 11 54.55% [147, 162, 163, 166, 186]
🔵 com/starrocks/transaction/PublishVersionDaemon.java 28 40 70.00% [533, 571, 572, 573, 574, 594, 689, 690, 691, 692, 693, 818]
🔵 com/starrocks/lake/TxnInfoHelper.java 6 7 85.71% [20]
🔵 com/starrocks/alter/LakeTableAlterMetaJobBase.java 6 6 100.00% []
🔵 com/starrocks/lake/PartitionPublishVersionData.java 20 20 100.00% []
🔵 com/starrocks/lake/LakeTableHelper.java 2 2 100.00% []
🔵 com/starrocks/common/Config.java 1 1 100.00% []
🔵 com/starrocks/planner/OlapTableSink.java 1 1 100.00% []
🔵 com/starrocks/transaction/DatabaseTransactionMgr.java 2 2 100.00% []
🔵 com/starrocks/transaction/LakeTableTxnStateListener.java 5 5 100.00% []
🔵 com/starrocks/alter/LakeTableSchemaChangeJob.java 6 6 100.00% []
🔵 com/starrocks/transaction/TransactionState.java 3 3 100.00% []
🔵 com/starrocks/transaction/TransactionStateBatch.java 1 1 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 313 / 357 (87.68%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/tablet_sink_index_channel.h 0 1 00.00% [161]
🔵 be/src/exec/write_combined_txn_log.cpp 0 3 00.00% [22, 23, 24]
🔵 be/src/exec/tablet_sink_sender.cpp 5 17 29.41% [313, 314, 315, 317, 319, 320, 323, 370, 371, 372, 373, 375]
🔵 be/src/exec/tablet_sink_colocate_sender.cpp 5 12 41.67% [250, 278, 279, 280, 282, 283, 284]
🔵 be/src/exec/tablet_sink_index_channel.cpp 2 4 50.00% [172, 757]
🔵 be/src/exec/tablet_sink.cpp 3 4 75.00% [204]
🔵 be/src/storage/lake/transactions.cpp 105 117 89.74% [152, 239, 240, 243, 374, 401, 417, 418, 419, 421, 422, 448]
🔵 be/src/runtime/lake_tablets_channel.cpp 15 16 93.75% [426]
🔵 be/src/service/service_be/lake_service.cpp 64 67 95.52% [289, 290, 291]
🔵 be/src/storage/lake/async_delta_writer.cpp 50 52 96.15% [180, 235]
🔵 be/src/gutil/strings/join.h 1 1 100.00% []
🔵 be/src/storage/lake/metacache.cpp 17 17 100.00% []
🔵 be/src/storage/lake/filenames.h 10 10 100.00% []
🔵 be/src/exec/tablet_sink_colocate_sender.h 1 1 100.00% []
🔵 be/src/storage/lake/vacuum.cpp 3 3 100.00% []
🔵 be/src/storage/lake/tablet_manager.cpp 21 21 100.00% []
🔵 be/src/storage/lake/delta_writer.cpp 8 8 100.00% []
🔵 be/src/storage/lake/schema_change.cpp 1 1 100.00% []
🔵 be/src/storage/lake/location_provider.h 2 2 100.00% []

@sduzh sduzh merged commit 4832787 into StarRocks:main Apr 19, 2024
57 of 61 checks passed
@sduzh sduzh deleted the enhancement/merge-txn-log branch April 19, 2024 09:02
imay pushed a commit that referenced this pull request May 8, 2024
Why I'm doing:
In order to be able to reduce reads and writes to the object store, we added COMBINED TXN LOG in #42542, i.e., only one txn log file is written per partition instead of one per Tablet. However, in #42542, only stream load and routine load support combined txn log, the common insert into and broker load can not use combined txn log.

What I'm doing:
Support combined txn log for insert and broker load.
Avoid sending invalid txn log deletion requests when combined txn log and batch publish are turned on at the same time

Signed-off-by: Alex Zhu <[email protected]>
node pushed a commit to vivo/starrocks that referenced this pull request May 9, 2024
Why I'm doing:
In order to be able to reduce reads and writes to the object store, we added COMBINED TXN LOG in StarRocks#42542, i.e., only one txn log file is written per partition instead of one per Tablet. However, in StarRocks#42542, only stream load and routine load support combined txn log, the common insert into and broker load can not use combined txn log.

What I'm doing:
Support combined txn log for insert and broker load.
Avoid sending invalid txn log deletion requests when combined txn log and batch publish are turned on at the same time

Signed-off-by: Alex Zhu <[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.

5 participants