-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Idempotent binding removal #1691
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Optimizations introduced in #1589 caused the removal of bindings to be non-idempotent, as the removal of routing information with dirty deletes did not allow for full transaction rollback. This commit reverts that change, losing some of the performance improvements in favour of data correctness. [#160100569]
...that we've concluded we cannot use dirty deletes in at least some areas. The sentence left is pretty to the point.
michaelklishin
approved these changes
Aug 30, 2018
Leaving this test by @acogoluegnes here so that we don't have to dig in Pivotal Tracker for it. The test must output the After the test stops there should be no hash ring state entries left on the RabbitMQ node. @Grab(group = 'com.rabbitmq', module = 'amqp-client', version = "5.3.0")
@Grab(group = 'org.slf4j', module = 'slf4j-simple', version = '1.7.25')
@Grab(group = 'org.apache.commons', module = 'commons-math3', version = '3.6.1')
import com.rabbitmq.client.Channel
import com.rabbitmq.client.Connection
import com.rabbitmq.client.ConnectionFactory
import org.apache.commons.math3.stat.descriptive.SummaryStatistics
import java.util.stream.IntStream
println "No binding in the middle"
iterate(5, { consistentHashExchange(20, 1) });
println "Bindings in the middle"
iterate(5, { consistentHashExchange(10, 2) });
static void consistentHashExchange(int nbQueuesInEachIteration, int nbOfIterations) {
ConnectionFactory cf = new ConnectionFactory();
Connection c = cf.newConnection()
Channel ch = c.createChannel();
String exchange = "hash-exchange-test";
ch.exchangeDeclare(exchange, "x-consistent-hash");
List<String> queues = new ArrayList<>();
iterate(nbOfIterations, {
for (int i = 0; i < nbQueuesInEachIteration; i++) {
String queue = ch.queueDeclare().getQueue();
queues.add(queue);
ch.queueBind(queue, exchange, "1");
}
for (String queue : queues) {
ch.queuePurge(queue);
}
// focus on hash ring management here, so avoid concurrent bindings and publishes
// for now
Thread.sleep(1000);
List<String> rks = new ArrayList<>();
IntStream.range(0, 10_000).forEach({ i -> rks.add(UUID.randomUUID().toString()) });
int nbMessages = 100_000;
int count = 0;
ch.confirmSelect();
Set<String> rksUsed = new HashSet<>();
while (count < nbMessages) {
int remaining = count % rks.size();
String rk = rks.get(remaining);
rksUsed.add(rk);
ch.basicPublish(exchange, rk, null, "".getBytes());
count++;
}
ch.waitForConfirmsOrDie();
})
List<String> counts = new ArrayList<>();
SummaryStatistics summaryStatistics = new SummaryStatistics();
for (String queue : queues) {
int messageCount = ch.queueDeclarePassive(queue).getMessageCount();
counts.add(messageCount + "");
summaryStatistics.addValue(Integer.valueOf(messageCount).doubleValue());
}
println String.join(",", counts)
println summaryStatistics
ch.exchangeDelete(exchange);
c.close()
}
static void iterate(int nbOfIterations, Closure action) throws Exception {
int count = 0;
while (count < nbOfIterations) {
action.call();
count++;
}
} |
Merged
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimizations introduced in #1589 caused the removal of bindings to
be non-idempotent, as the removal of routing information with dirty
deletes did not allow for full transaction rollback. This commit
reverts that change, losing some of the performance improvements in
favour of data correctness.
Types of Changes
Checklist
CONTRIBUTING.md
document