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

questions about append_compact_purge.rs example #237

Closed
stupidstan opened this issue Jul 10, 2022 · 3 comments
Closed

questions about append_compact_purge.rs example #237

stupidstan opened this issue Jul 10, 2022 · 3 comments

Comments

@stupidstan
Copy link

state.last_index一直是0,不会走到70行
image

@stupidstan
Copy link
Author

请问这个用例预期一直不停吗
loop {
for i in 1024
}

@tabokie
Copy link
Member

tabokie commented Jul 10, 2022

append_compact_purge.rs用例好像不会执行压缩

The compression is done inside engine.write(&batch). More specifically, here:

// entries
let (header_offset, compression_type) = if compression_threshold > 0
&& self.buf.len() >= LOG_BATCH_HEADER_LEN + compression_threshold
{
let buf_len = self.buf.len();
lz4::append_compress_block(&mut self.buf, LOG_BATCH_HEADER_LEN)?;
(buf_len - LOG_BATCH_HEADER_LEN, CompressionType::Lz4)
} else {
(0, CompressionType::None)
};

If the data is larger than compression_threshold (8KB by default), the block will be compressed.

state.last_index一直是0,不会走到70行

There's an issue with this example. The state.last_index should be incremented before written via engine.write(&batch).

Feel free to file an PR to fix it.

请问这个用例预期一直不停吗

Yes, you have to manually kill it. Maybe we can do something to improve it later.

@tabokie tabokie changed the title append_compact_purge.rs用例好像不会执行压缩 questions about append_compact_purge.rs example Jul 10, 2022
@stupidstan
Copy link
Author

append_compact_purge.rs用例好像不会执行压缩

The compression is done inside engine.write(&batch). More specifically, here:

// entries
let (header_offset, compression_type) = if compression_threshold > 0
&& self.buf.len() >= LOG_BATCH_HEADER_LEN + compression_threshold
{
let buf_len = self.buf.len();
lz4::append_compress_block(&mut self.buf, LOG_BATCH_HEADER_LEN)?;
(buf_len - LOG_BATCH_HEADER_LEN, CompressionType::Lz4)
} else {
(0, CompressionType::None)
};

If the data is larger than compression_threshold (8KB by default), the block will be compressed.

state.last_index一直是0,不会走到70行

There's an issue with this example. The state.last_index should be incremented before written via engine.write(&batch).

Feel free to file an PR to fix it.

请问这个用例预期一直不停吗

Yes, you have to manually kill it. Maybe we can do something to improve it later.

感谢答疑~

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

No branches or pull requests

2 participants