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

Inner properties mutation broken in SQL UPDATE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.8
    • 2.0
    • binary, sql
    • None

    Description

      Discovered in course of working on IGNITE-4340.

      Say, we have following type for cache values

      static final class AllTypes implements Serializable {
              /**
               * Data Long.
               */
              @QuerySqlField
              Long longCol;
      
              /**
               * Inner type object.
               */
              @QuerySqlField
              InnerType innerTypeCol;
      
              /** */
              static final class InnerType implements Serializable {
                  /** */
                  @QuerySqlField
                  Long innerLongCol;
      
                  /** */
                  @QuerySqlField
                  String innerStrCol;
             }
      }
      

      Queries like this fail for both optimized and binary marshaller:

      UPDATE AllTypes set innerLongCol = ?
      

      For optimized, current DML implementation mutates existing inner property thus confusing DML statements re-run logic (query re-runs because engine sees value as concurrently modified, though the only change is its own, and ultimately fails). The solution is to clone inner objects and set new property values on them because we need to have old value pristine.

      For binary, current DML implementation does not honor properties hierarchy and, for above example, just sets innerLongCol field on AllTypes binary object and not its child InnerType object. Thus, index will be updated and SELECTs for that column will return correct value for that field, but inner state of target property innerTypeCol does not change, and AllTypes object gets its own odd field innerLongCol which it does not know how to do with (no metadata about it in type descriptor).

      The patch for both problems is ready and lying on my shelf waiting for 1.8 release to happen to be applied. Then this will ultimately be fixed with the rest of known problems/improvements (Jira issues for them will follow).

      Attachments

        Issue Links

          Activity

            People

              al.psc Alexander Paschenko
              al.psc Alexander Paschenko
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: