xtern commented on code in PR #2982:
URL: https://github.com/apache/ignite-3/pull/2982#discussion_r1440346452
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImpl.java:
##########
@@ -96,12 +108,54 @@ public CompletableFuture<List<MappedFragment>>
map(MultiStepPlan multiStepPlan)
return initialTopologyFuture.thenComposeAsync(ignore ->
map0(multiStepPlan), taskExecutor);
}
+ /** Called when the primary replica has expired. */
+ public CompletableFuture<Boolean>
onPrimaryReplicaExpired(PrimaryReplicaEventParameters parameters) {
+ assert parameters != null;
+ assert parameters.groupId() instanceof TablePartitionId;
+
+ int tabId = ((TablePartitionId) parameters.groupId()).tableId();
+
+ return CompletableFuture.supplyAsync(() -> {
+ mappingsCache.values().removeIf(value ->
value.tableIds.contains(tabId));
+
+ return false;
+ }, ForkJoinPool.commonPool());
Review Comment:
Result of benchmark for 10 times scan with random `removeIf(...)
| Benchmark | (cacheSize) | (tablesInPlan) | (totalTables) | Score
| Error | Units |
|
------------|----------------|----------------|----------------|-------------|----------|-------
|
| 1 thread |1024 |10 |10000 |
317.112 ± |29.731 |us/op
| 8 threads |1024 |10 |10000 |
286.909 ± |5.741 |us/op
| 8 threads + sync |1024 |10 |10000 |
294.775 ± |4.226 |us/op
| | | | | |
|1 thread |1024 |100 |10000 | 340.265
± |15.269 |us/op
|8 threads |1024 |100 |10000 | 287.221
± | 3.058 |us/op
|8 threads + sync |1024 |100 |10000 | 349.131
± |49.229 |us/op
| | | | | |
| 1 thread |10000 |10 |10000 |
3136.671 ± |596.822 |us/op
| 8 threads |10000 |10 |10000 |
2822.520 ± |280.104 |us/op
| 8 threads + sync |10000 |10 |10000 |
3252.009 ± |205.003 |us/op
| | | | | |
| 1 thread |10000 |100 |10000 |
3586.382 ± |159.551 |us/op
| 8 threads |10000 |100 |10000 |
3453.345 ± |104.515 |us/op
| 8 threads + sync |10000 |100 |10000 |
3641.002 ± |192.040 |us/op
| | | | | |
| 1 thread |100000 |10 |10000 |
40390.912 ± |5187.521 |us/op
| 8 threads |100000 |10 |10000 |
38434.787 ± |8073.539 |us/op
| 8 threads + sync |100000 |10 |10000 |
41262.388 ± |8081.194 |us/op
| | | | | |
| 1 thread |100000 |100 |10000 |
63233.467 ± |12400.052 |us/op
| 8 threads |100000 |100 |10000 |
64562.198 ± |7600.780 |us/op
| 8 threads + sync |100000 |100 |10000 |
63495.429 ± |6680.330 |us/op
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]