def _drop_incorrect_slots(self, cluster: Cluster, slots: Dict[str, Any]) -> None:
        """Compare required slots and configured as permanent slots with those found, dropping extraneous ones.

        .. note::
            Slots that are not contained in *slots* will be dropped.
            Slots can be filtered out with ``ignore_slots`` configuration.

            Slots that have matching names but do not match attributes in *slots* will also be dropped.

        :param cluster: cluster state information object.
        :param slots: dictionary of desired slot names as keys with slot attributes as a dictionary value, if known.
        """
        # drop old replication slots which are not presented in desired slots.
        for name in set(self._replication_slots) - set(slots):
            if not global_config.is_paused and not self.ignore_replication_slot(cluster, name):
                active, dropped = self.drop_replication_slot(name)
                if dropped:
                    logger.info("Dropped unknown replication slot '%s'", name)
                else:
                    self._schedule_load_slots = True
                    if active:
                        logger.debug("Unable to drop unknown replication slot '%s', slot is still active", name)
                    else:
                        logger.error("Failed to drop replication slot '%s'", name)

        # drop slots with matching names but attributes that do not match, e.g. `plugin` or `database`.
        for name, value in slots.items():
            if name in self._replication_slots and not compare_slots(value, self._replication_slots[name]):
                logger.info("Trying to drop replication slot '%s' because value is changing from %s to %s",
                            name, self._replication_slots[name], value)
                if self.drop_replication_slot(name) == (False, True):
                    self._replication_slots.pop(name)
                else:
                    logger.error("Failed to drop replication slot '%s'", name)
                    self._schedule_load_slots = True
Compare required slots and configured as permanent slots with those found, dropping extraneous ones.

        .. note::
            Slots that are not contained in *slots* will be dropped.
            Slots can be filtered out with ``ignore_slots`` configuration.

            Slots that have matching names but do not match attributes in *slots* will also be dropped.

        :param cluster: cluster state information object.
        :param slots: dictionary of desired slot names as keys with slot attributes as a dictionary value, if known.
        
patroni/postgresql/slots.py