Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12058

Wrong order in file idempotent store.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.20.1, 2.20.2, 2.21.0
    • Fix Version/s: 2.21.0
    • Component/s: camel-core
    • Labels:
    • Estimated Complexity:
      Novice
    • Flags:
      Patch

      Description

      I recently noticed that there is wrong entry order in file using
      FileIdempotentRepository implementation.
      The effect is that instead of having order like:

      file1.txt.20171123
      file2.txt.20171123
      file1.txt.20171124
      file3.txt.20171125
      file2.txt.20171126

      we have:

      file1.txt.20171123
      file1.txt.20171124
      file2.txt.20171123
      file2.txt.20171126
      file3.txt.20171125

      where date extension represents order in which particular file was consumed
      by the idempotent file consumer.
      As a consequence instead of initializing memory cache with newest values,
      it is initialized (probably) based on hash function from truncStore method
      and we consume same file more than once:

      protected void trunkStore() {
      LOG.info("Trunking idempotent filestore: {}", fileStore);
      FileOutputStream fos = null;
      try {
      fos = new FileOutputStream(fileStore);
      for (String key : cache.keySet())

      { fos.write(key.getBytes()); fos.write(STORE_DELIMITER.getBytes()); }


      } catch (IOException e)

      { throw ObjectHelper.wrapRuntimeCamelException(e); }

      finally

      { IOHelper.close(fos, "Trunking file idempotent repository", LOG); }


      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                zurkin Krzysztof Hołdanowicz
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

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