-
Notifications
You must be signed in to change notification settings - Fork 489
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
Optimize Partition Size computation #2230
Comments
@Afourcat interested? |
Hi, async fn get_partition_size(&self) -> Result<u64, ErrorCode> {
let active_len = self.active_segment.get_msg_log().get_pos();
// let total_len = {
// let reader = self.prev_segments.read().await;
//
// active_len + reader.get_total_logs_len() as u32
// };
return Ok(total_len.into());
} But while adding the To reproduce:
Going further, It seems that the The error happens on both local and k8s cluster. It seems the index opening also fail on closing and restarting the
Does someone have any idea? |
Is problem happening with or without commented line? If with commented line the, this is probably problem:
Avoid locking which could interfered with writer. Instead use AtomicU64 as here:
|
Hello,
I think that this is this line that throws the "22: Invalid argument" error. // make sure it is log file
let (m_file, file) =
MemoryMappedFile::open(&index_file_path, INDEX_ENTRY_SIZE as u64).await?;
To Reproduce: ./k8-util/cluster/reset-minikube.sh
fluvio cluster start
fluvio topic create stable --segment-size 2048
fluvio produce stable
[...Producing 1000 bytes 5 times]
kubectl logs fluvio-spg-main-0
[...Error is here] Weirdly, indexes look like this:
Can it be due to my testing environment?
Unfortunately, I don't have another one. I think I'm missing something pretty obvious. |
So this is last release? Can you create reproducible test? You can create e2e test like smoke test or cli teet |
I tried with the Here is a bats file that I placed at: #!/usr/bin/env bats
TEST_HELPER_DIR="$BATS_TEST_DIRNAME/../test_helper"
export TEST_HELPER_DIR
load "$TEST_HELPER_DIR"/tools_check.bash
load "$TEST_HELPER_DIR"/fluvio_dev.bash
load "$TEST_HELPER_DIR"/bats-support/load.bash
load "$TEST_HELPER_DIR"/bats-assert/load.bash
setup_file() {
TOPIC_NAME=$(random_string)
export TOPIC_NAME
debug_msg "Topic name: $TOPIC_NAME"
TOPIC_NAME_2=$(random_string)
export TOPIC_NAME_2
debug_msg "Topic name: $TOPIC_NAME_2"
TOPIC_NAME_3=$(random_string)
export TOPIC_NAME_3
debug_msg "Topic name: $TOPIC_NAME_3"
MESSAGE="$(random_string 1000)"
export MESSAGE
debug_msg "$MESSAGE"
}
teardown_file() {
run timeout 15s "$FLUVIO_BIN" topic delete "$TOPIC_NAME"
run timeout 15s "$FLUVIO_BIN" topic delete "$TOPIC_NAME_2"
run timeout 15s "$FLUVIO_BIN" topic delete "$TOPIC_NAME_3"
}
@test "Create a topic" {
debug_msg "topic: $TOPIC_NAME with segment size of 1024"
run timeout 15s "$FLUVIO_BIN" topic create "$TOPIC_NAME" --segment-size 1024
assert_success
debug_msg "topic: $TOPIC_NAME with segment size of 2048"
run timeout 15s "$FLUVIO_BIN" topic create "$TOPIC_NAME_2" --segment-size 2048
assert_success
debug_msg "topic: $TOPIC_NAME with segment size of 4096"
run timeout 15s "$FLUVIO_BIN" topic create "$TOPIC_NAME_3" --segment-size 4096
assert_success
}
@test "Produce message" {
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_2"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_2"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_2"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_3"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_3"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_3"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_3"'
run bash -c 'echo "$MESSAGE" | timeout 15s "$FLUVIO_BIN" produce "$TOPIC_NAME_3"'
assert_success
}
@test "Check Invalid Argument Error" {
run timeout 15s kubectl logs pod/fluvio-spg-main-0
debug_msg "Checking for \'Invalid Argument\' Error in SPG logs"
refute_output --partial 'message: "Invalid argument"'
} I think the problem comes from my testing environment, but I'm stuck, I don't know how it could produce an From what I've seen, this error only occurs on index files. |
Can you make PR for test so if this can be reproduce in the CI? |
Hello, I'm not sure how to proceed. |
This PR Implements #2230. - Add smoke-test - Bumps `fluvio-future` to `0.3.15`. - Replace File-based computation of logs' length by the sum of active and previous `Segment`s `msg_log` size. Which removes the need for file system IO. - Change tests
This is done! |
With #2212, we have ability get size of the partitions. However, performance of the size computation can be improved. Instead of querying metadata each time, it can query segments which already have size cached.
The text was updated successfully, but these errors were encountered: