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

Sql. Fix index scan transactional consistency.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • sql
    • Docs Required, Release Notes Required

    Description

      Motivation

      According to tx protocol in order to prevent phantom reads we should lock current key on every iteration that may be bigger than upper bound border.

      Let's check following example:

      tbl [3, 5, 8]

      select * from tbl where k >= 3 and k <= 7  may be internally converted to sorted index scan (lowerBorder=3[included], upperBorder=7[included])

      thus we won't see key 8 and won't lock it.

      That means that tx2 may insert key 6, so that we finish with phantom read anomaly on select * from tbl where k >= 3 and k <= 7 re-run.

      Definition of Done

      Aforementioned scenario won't lead to phantom read.

      Implementation Notes

      We should lock ceil(upper bound key) or +INF if there's no such key, thus we should iterate over sorted index without upper bound parameter manually comparing next key with users upperBound. 

      Attachments

        Issue Links

          Activity

            People

              v.pyatkov Vladislav Pyatkov
              amashenkov Andrey Mashenkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 20m
                  20m