Uploaded image for project: 'Apache Hudi'
  1. Apache Hudi
  2. HUDI-667

HoodieTestDataGenerator does not delete keys correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.6.0
    • None

    Description

      HoodieTestDataGenerator is used to generate sample data for unit-tests. It allows generating HoodieRecords for insert/update/delete. It maintains the record keys in a HashMap.

      private final Map<Integer, KeyPartition> existingKeys;

      There are two issues in the implementation:

      1. Delete from existingKeys uses KeyPartition rather than Integer keys
      2. Inserting records after deletes is not correctly handled

      The implementation uses the Integer key so that values can be looked up randomly. Assume three values were inserted, then the HashMap will hold:

      0 -> KeyPartition1
      1 -> KeyPartition2
      2 -> KeyPartition3

      Now if we delete KeyPartition2  (generate a random record for deletion), the HashMap will be:

      0 -> KeyPartition1
      2 -> KeyPartition3

       

      Now if we issue a insertBatch() then the insert is existingKeys.put(existingKeys.size(), KeyPartition3) which will overwrite the KeyPartition3 already in the map rather than actually inserting a new entry in the map.

      Attachments

        Issue Links

          Activity

            People

              shivnarayan sivabalan narayanan
              pwason Prashant Wason
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Time Spent - 20m Remaining Estimate - 40m
                  40m
                  Logged:
                  Time Spent - 20m Remaining Estimate - 40m
                  20m