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

Test rocksdb #21

Closed
wants to merge 7 commits into from
Closed

Test rocksdb #21

wants to merge 7 commits into from

Conversation

jiacai2050
Copy link
Owner

Rationale

Detailed Changes

Test Plan

dracoooooo and others added 7 commits September 20, 2024 14:19
…on local disk (apache#1570)

## Rationale
In RegionBased replay, a batch of logs is first scanned from the WAL,
and then replayed on various tables using multiple threads. This
approach works fine for WALs based on tables, as the logs for each table
are clustered together. However, in a WAL based on local disk, the logs
for each table may be scattered across different positions within the
batch. During multi-threaded replay, it is possible that for a given
table, log2 is replayed before log1, resulting in missed logs.

## Detailed Changes
1. Modify `split_log_batch_by_table` function to aggregate all logs for
a table together.
2. Modify `tableBatch` struct to change a single range into a
`Vec<Range>`.

## Test Plan
Manual testing.
## Rationale
1. Currently, the WAL replayer uses coroutines to replay the WAL logs of
multiple tables in parallel. However, coroutines utilize at most one
CPU. By switching to a multithreaded approach, we can fully leverage
multiple CPUs.
2. We observed that during the replay phase, decoding the WAL log is a
CPU-intensive operation, so parallelize it.

## Detailed Changes

1. Modify both `TableBasedReplay` and `RegionBasedReplay` to use the
`spawn task` approach for parallelism, with a maximum of 20 tasks
running concurrently.
2. Preload next segment in WAL based on local storage.
4. In `BatchLogIteratorAdapter::simulated_async_next`, we first retrieve
all the payloads in a batch and then decode them in parallel.

## Test Plan
Manual testing.
Bumps [borsh](https://github.com/near/borsh-rs) from 0.10.3 to 0.10.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/near/borsh-rs/releases">borsh's
releases</a>.</em></p>
<blockquote>
<h2>borsh-derive-internal-v0.10.4</h2>
<p>No release notes provided.</p>
<h2>borsh-derive-v0.10.4</h2>
<p>No release notes provided.</p>
<h2>borsh-schema-derive-internal-v0.10.4</h2>
<p>No release notes provided.</p>
<h2>borsh-v0.10.4</h2>
<ul>
<li>Backported a fix for RUSTSEC-2023-0033: Forbid Vectors of Zero-sized
types from de-/serialization (<a
href="https://redirect.github.com/near/borsh-rs/issues/145">#145</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/near/borsh-rs/blob/borsh-v0.10.4/CHANGELOG.md">borsh's
changelog</a>.</em></p>
<blockquote>
<h2>[0.10.4] - 2024-09-23</h2>
<ul>
<li>Backported a fix for RUSTSEC-2023-0033: Forbid Vectors of Zero-sized
types from de-/serialization (<a
href="https://redirect.github.com/near/borsh-rs/issues/145">#145</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/near/borsh-rs/commit/a1fe3631df2306b2991c1fa9142d7bfa17c2419e"><code>a1fe363</code></a>
release: 0.10.4</li>
<li><a
href="https://github.com/near/borsh-rs/commit/c545f3c51718f4e6bb19efef6e473ca3ac9946ba"><code>c545f3c</code></a>
chore: revert <code>workspace</code> and <code>exclude</code> changes
(<a
href="https://redirect.github.com/near/borsh-rs/issues/311">#311</a>)</li>
<li><a
href="https://github.com/near/borsh-rs/commit/27843bcca6e250e2c6cb6bc30cc17e315288bf92"><code>27843bc</code></a>
chore: prepare 0.10.4 with backported fix (<a
href="https://redirect.github.com/near/borsh-rs/issues/310">#310</a>)</li>
<li>See full diff in <a
href="https://github.com/near/borsh-rs/compare/borsh-v0.10.3...borsh-v0.10.4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=borsh&package-manager=cargo&previous-version=0.10.3&new-version=0.10.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/apache/horaedb/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@jiacai2050 jiacai2050 closed this Oct 18, 2024
@jiacai2050 jiacai2050 deleted the test-rocksdb branch November 13, 2024 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants