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

Wrong update order in upsertAll and DataStreamer for a new key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0-beta1
    • 3.0.0-beta2
    • None

    Description

      Add the following test to ItInternalTableTest to reproduce:

          @Test
          public void upsertAllOrderTest() {
              RecordView<Tuple> view = table.recordView();
              InternalTable internalTable = ((TableViewInternal) table).internalTable();
              List<BinaryRowEx> rows = new ArrayList<>();
      
              int count = 100;
              int lastId = count - 1;
              long id = 12345;
      
              for (int i = 0; i < count; i++) {
                  rows.add(createKeyValueRow(id, i, "row-" + i));
              }
      
              internalTable.upsertAll(rows, null).join();
      
              Tuple res = view.get(null, Tuple.create().set("key", id));
              assertEquals(lastId, res.intValue("valInt"));
              assertEquals("row-" + lastId, res.stringValue("valStr"));
          }
      

      As a user, I expect to observe the last value for the given key. Instead, there is a random value.

      This is caused by PartitionReplicaListener - when there is no row with specified key, we generate a new random RowId:

      RowId rowId0 = insert ? new RowId(partId(), UUID.randomUUID()) : rowId
      

      Then this row id is stored in a hash set, which results in a random update order. The same applies to the DataStreamer, which goes through InternalTableImpl.updateAll.

      Attachments

        Issue Links

          Activity

            People

              ptupitsyn Pavel Tupitsyn
              ptupitsyn Pavel Tupitsyn
              Alexey Scherbakov Alexey Scherbakov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 50m
                  50m