**Affected version:** 8.2 - 8.5.2
**Fixed in:** 8.5.3

### Problem Description

The problem applies to transforms that use more than 1 CCS cluster or 1 local and 1 CCS as source. A typical source could look like this (the important part: `remotes*`):

```
        "index" : [
          "remotes*:filebeat*"
        ],

```

If 2 indices share the same name the transform might fail with an error similar to this:

```
 Failed to retrieve checkpoint due to: Duplicate key logs-2022-11-14 (attempted merging values [... and ...]
```

Similar to the above the `_stats` call is broken for such a transform, it can fail with an error message starting with:

```
Failure during checkpoint retrieval
```

This can happen even if the transform is in state `STOPPED` or `FAILED`.

### Mitigation

Choose _one_ of the following mitigations:

 - split your transforms to use max 1 CCS/local indices

_or_

 - avoid upgrading to 8.2, until the issue got resolved (this is a regression of #80984)

_or_

 - avoid duplicate names for your indices even on remote cluster, e.g. name the index: `remote1-filebeat...`, `remote2-filebeat...`


### Solution

This is a regression of #80984 which introduced a new way of check-pointing. The remote needs to be prefixed to the index name.
x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/DefaultCheckpointProviderTests.java
import org.elasticsearch.test.MockLogAppender;
import org.elasticsearch.test.MockLogAppender.LoggingExpectation;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xpack.core.transform.transforms.SourceConfig;
import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpoint;
import org.elasticsearch.xpack.core.transform.transforms.TransformConfig;
import org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests;
import org.elasticsearch.xpack.transform.notifications.MockTransformAuditor;
import org.elasticsearch.xpack.transform.notifications.MockTransformAuditor.AuditExpectation;
import org.elasticsearch.xpack.transform.persistence.IndexBasedTransformConfigManager;
import org.junit.Before;
import org.mockito.stubbing.Answer;
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;
import java.util.Collections;
import java.util.HashSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.startsWith;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DefaultCheckpointProviderTests extends ESTestCase {