-
Notifications
You must be signed in to change notification settings - Fork 5
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
Concurrency issues when reserving Tuples in parallel #10
Comments
Hi @kindlich. This is definitely not the expected behaviour and will cause inconsistency or make some tuples inaccessible. We will look into this issue and try to improve the handling of reservation as soon as possible. As a quick workaround until this problem is fixed, you could for example wrap your command in a simple retry logic like the following: # retry secret creation up to 3 times. print secret id and break loop if cli returns exit code 0; sleep for 50..100ms if not
parallel "for i in 1 2 3; do o=\$(java -jar cs.jar amphora create-secret {} 2> /dev/null); [ \$? -eq 0 ] && echo \"\$o\" && break || sleep \$(printf \"0.%03d\" \$((50+\$RANDOM%50))); done" ::: {1..2} However,
Best regards, |
If you are having problems with inconsistencies where Castor is no longer able to create or share reservations, you can also try clearing all reservations from the cache and resetting the consumption- and reservation-markers to 0. The following is a script that would perform the described task for a standard deployment: cat <<"EOF" | bash -s
#!/bin/bash
for vcp in starbuck apollo
do
kubectl config use-context kind-"$vcp"
kubectl exec $(kubectl get pods | awk '/^cs-redis/{print $1}') -- bash -c "redis-cli --scan --pattern castor* | xargs redis-cli del"
kubectl exec $(kubectl get pods | awk '/cs-postgres/{print $1}') -- psql -U cs castor -c "UPDATE tuple_chunk_meta_data SET consumed_marker = 0, reserved_marker = 0;"
done
EOF This way, you may not have to redeploy the entire Carbyne Stack Virtual Cloud. |
Signed-off-by: Sebastian Becker <[email protected]>
Signed-off-by: Sebastian Becker <[email protected]>
Signed-off-by: Sebastian Becker <[email protected]>
Signed-off-by: Sebastian Becker <[email protected]>
Signed-off-by: Sebastian Becker <[email protected]>
* Add test to reproduce / cover concurrency issue described by #10 * Add TupleChunkFragment -Entity, -Repository and -Service * Add initial chunk fragmentation to improve handling of concurrent requests Signed-off-by: Sebastian Becker <[email protected]>
Is there anything left to do here @sbckr? Otherwise, let's close this issue. |
Well, there is still an issue, if too many parallel requests come in. If more than N requests come in at once, the master will block some HTTP calls since no DB Entities are available. Let's imagine we have 1 Tuple Fragment available, but 2 concurrent requests:
Though the question is, is this something where you just have to
Or should this be handled at another level? |
This issue has been marked stale because it has been open for 90 days with no activity. It will be automatically closed in 30 days if no further activity occurs. |
@sbckr: Anything left here? |
Hey there,
in some tests we found out, that requesting tuples in parallel can run into timing problems:
If the latter reservation gets applied before the prior, then trying to apply the prior will result in an error
Since the issue is about timing, the example below can succeed or fail, but after a few times you usually get the error.
I'm using GNU-Parallel to create parallel requests:
# Create 2 secrets in parallel (amphora needs input-mask tuples so it fails when reserving these) parallel java -jar cs.jar amphora create-secret {} ::: {1..2}
Below is a graphic of what I think is the case:
BR,
kindlich
The text was updated successfully, but these errors were encountered: