tikv / raft-engine

A persistent storage engine for Multi-Raft log
Apache License 2.0
565 stars 88 forks source link

questions about append_compact_purge.rs example #237

Closed stupidstan closed 2 years ago

stupidstan commented 2 years ago

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

stupidstan commented 2 years ago

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

tabokie commented 2 years ago

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

The compression is done inside engine.write(&batch). More specifically, here: https://github.com/tikv/raft-engine/blob/7a436eae40a6b62371123c96941e058b7fe52b63/src/log_batch.rs#L709-L718

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.

stupidstan commented 2 years ago

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

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

https://github.com/tikv/raft-engine/blob/7a436eae40a6b62371123c96941e058b7fe52b63/src/log_batch.rs#L709-L718

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.

感谢答疑~