Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-20116

Linearize storage updates with safeTime adjustment rules

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 3.0.0-beta2
    • None

    Description

      Motivation

      The logic of setting safeTime explicitly prohibits setting a larger time ahead of a smaller one. In other words, all data updates within storages should be strictly ordered by the safeTime associated with such updates. Currently it's not true:

      • We associate update and safe time during update command creation (see org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener)
        UpdateCommandBuilder bldr = MSG_FACTORY.updateCommand()
                         ...
                        .safeTimeLong(hybridClock.nowLong());   
      • However, neither applying a given command locally nor sending it to the raft isn't linearized with associated safeTime value. In other words, it's possible that we will assign t0 to the cmd0 and t1 to the cmd1 but will apply cmd1 prior to cmd0 locally.

      Simply speaking, we lack some sort of synchronization here.

      Definition of Done

      • It's required to linearize updates application to preserve guarantees of the monotonicity of a safeTime's adjustment.

      Implementation Notes

      Different options are possible:

      1. We may reject a command that is associated with safeTime < already applied one. Such approach requires
        1. To resend the command with new safeTime in case of 1pc.
        1. Adjust local safeTime, and resend command with new safe time in case of 2pc.
      1. Add proper synchronization both on client and server side.
      1. Send pending safeTime instances with each command. More details below:

      Let’s assume that there were two updateCommands cmd1(safeTime: t1) and cmd2(safeTime: t2). Let’s also assume that cmd2 was send prior to cmd2 (meaning that it was reordered). In that case, assuming that cmd2 has both t1 and t2 within its data bag, it will wait for cmd1 to bring it data in a queue or formally it will wait previous commands to apply themselves.

       

      Attachments

        Issue Links

          Activity

            People

              alapin Alexander Lapin
              alapin Alexander Lapin
              Roman Puchkovskiy Roman Puchkovskiy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m