Uploaded image for project: 'Kafka Connector'
  1. Kafka Connector
  2. KAFKA-199

Introduce a mechanism of differentiating partial IdStrategy

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Sink
    • Labels:
      None

      DeleteOneBusinessKeyStrategy, ReplaceOneBusinessKeyStrategy (maybe other places in the codebase) need to differentiate partial IdStrategy. Currently this is done by using the following code:

      isPartialId = idStrategy instanceof PartialKeyStrategy || idStrategy instanceof PartialValueStrategy;
      

      This code relies on the preexisting knowledge of all partial IdStrategy implementations. This means that if a new partial implementation appears, the code mentioned above will have to be updated in multiple places. The problem with this approach is that the author of the new partial implementation has no way of knowing that there are places in the codebase that must be updated.

      We could add a mechanism of differentiating partial IdStrategy by using, for example, one of the following approaches:

      1. A new default method IdStrategy.isPartial returning false. This is the preferable approach.
      2. A new marker interface IdStrategy.Partial. This approach should only be considered if implementing the first approach encounters difficulties not apparent at the point of creating this ticket.

      Fo more details, please see the original review discussion.

            Assignee:
            Unassigned Unassigned
            Reporter:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: