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

RFC: Using chunk format in coprocessor framework #43

Merged
merged 2 commits into from
Jul 31, 2021

Conversation

TennyZhuang
Copy link
Contributor

Signed-off-by: TennyZhuang zty0826@gmail.com

text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved
text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved
text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved
text/2020-03-07-copr-chunk.md Show resolved Hide resolved
text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved
text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved
text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved
```rust
#[rpn_fn]
pub fn md5(arg: Bytes, writer: Writer<Bytes>) -> Result<Guard> {
writer.write(hex_digest(MessageDigest::md5(), arg));
Copy link
Member

Choose a reason for hiding this comment

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

note that in this form, it is possible to first write something, then return an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If Err is returned, we should call discard in framework

text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved

## Summary

Using [TiDB Chunk format](https://github.com/pingcap/tidb/blob/9627132db25e5cb560ba6ed89c2e39c32edb267a/util/chunk/chunk.go) in the `coprocessor` framework instead of `VectorValue`.
Copy link
Member

Choose a reason for hiding this comment

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

Links are not unified, and are duplicated.

text/2020-03-07-copr-chunk.md Outdated Show resolved Hide resolved

The definition of `Writer` and `PartialWriter` ensures some properties:

1. `Guard` is zero-overhead, and the only way to achieve a `Guard` is calling `write` or `finish`.

Choose a reason for hiding this comment

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

Need to mention that Guard ensures write or finish has been called at least once in the implementation of the coprocessor. I think the name is confusing. Guard does not guard any resources. It is proof that write or finish has been called. Maybe we can call it evidence/witness?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@breeswish PTAL


// To
#[rpn_fn]
pub fn logical_and(lhs: &i64, rhs: &i64) -> Result<Option<i64>>;
Copy link
Contributor Author

@TennyZhuang TennyZhuang Mar 19, 2020

Choose a reason for hiding this comment

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

Here is a question. For fixed sized type, is it better to use value type instead of ref? almost all known fixed type <= 8 byte.

@skyzh
Copy link
Member

skyzh commented Jul 28, 2020

PTAL, thanks! @TennyZhuang @breeswish
Before merging, @TennyZhuang may need to squash and sign DCO for all commits.
Also, GitHub's markdown doesn't support multi-line table. Markdown lint warns too long lines on table cells, which can't be fixed.
fixed

Signed-off-by: TennyZhuang <zty0826@gmail.com>

Co-authored-by: Alex Chi <iskyzh@gmail.com>
Co-authored-by: Wenxuan <hi@breeswish.org>
@skyzh
Copy link
Member

skyzh commented Jul 31, 2021

This RFC has been already implemented. cc @andylokandy could you please give an approval and get this merged?

@skyzh skyzh merged commit ba6ee7e into tikv:master Jul 31, 2021
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.

None yet

5 participants