sanpwc commented on code in PR #4049:
URL: https://github.com/apache/ignite-3/pull/4049#discussion_r1728780138
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -2770,37 +2748,33 @@ private CompletableFuture<CompletableFuture<?>>
applyUpdateCommand(
applyCmdWithExceptionHandling(cmd, resultFuture);
- return resultFuture.thenApply(res -> {
+ return resultFuture.thenCompose(res -> {
UpdateCommandResult updateCommandResult =
(UpdateCommandResult) res;
if (full && updateCommandResult != null &&
!updateCommandResult.isPrimaryReplicaMatch()) {
throw new PrimaryReplicaMissException(txId,
cmd.leaseStartTime(), updateCommandResult.currentLeaseStartTime());
}
- // TODO:
https://issues.apache.org/jira/browse/IGNITE-20124 Temporary code below
- // Try to avoid double write if an entry is already
replicated.
- synchronized (safeTime) {
- if (cmd.safeTime().compareTo(safeTime.current()) > 0) {
- if
(!IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_SKIP_STORAGE_UPDATE_IN_BENCHMARK))
{
- // We don't need to take the partition
snapshots read lock, see #INTERNAL_DOC_PLACEHOLDER why.
- storageUpdateHandler.handleUpdate(
- cmd.txId(),
- cmd.rowUuid(),
-
cmd.tablePartitionId().asTablePartitionId(),
- cmd.rowToUpdate(),
- false,
- null,
- cmd.safeTime(),
- null,
- indexIdsAtRwTxBeginTs(txId)
- );
- }
-
-
updateTrackerIgnoringTrackerClosedException(safeTime, cmd.safeTime());
+ if (updateCommandResult.isPrimaryInPeersAndLearners()) {
+ return
safeTime.waitFor(cmd.safeTime()).thenApply(ignored -> null);
+ } else {
+ if
(!IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_SKIP_STORAGE_UPDATE_IN_BENCHMARK))
{
+ // We don't need to take the partition snapshots
read lock, see #INTERNAL_DOC_PLACEHOLDER why.
+ storageUpdateHandler.handleUpdate(
+ cmd.txId(),
+ cmd.rowUuid(),
+
cmd.tablePartitionId().asTablePartitionId(),
+ cmd.rowToUpdate(),
+ false,
+ null,
+ cmd.safeTime(),
+ null,
+ indexIdsAtRwTxBeginTs(txId)
+ );
}
- }
- return null;
+ return null;
Review Comment:
Substituted with nullCompletedFuture();
--
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]