### CI Link

https://gradle-enterprise.elastic.co/s/bvu7cpvrzcftw

### Repro line

./gradlew ':server:test' --tests "org.elasticsearch.gateway.PersistedClusterStateServiceTests.testOverrideLuceneVersion" -Dtests.seed=6EB840113B42885F -Dtests.locale=es-CR -Dtests.timezone=Etc/GMT-7 -Druntime.java=17

### Does it reproduce?

No

### Applicable branches

main

### Failure history

_No response_

### Failure excerpt

```
org.elasticsearch.gateway.PersistedClusterStateServiceTests > testOverrideLuceneVersion FAILED
    org.elasticsearch.gateway.CorruptStateException: java.lang.IllegalArgumentException: Expected [meta-data] as a field name but got test-13
        at __randomizedtesting.SeedInfo.seed([6EB840113B42885F:65540F3577FD9A17]:0)
        at app//org.elasticsearch.gateway.PersistedClusterStateService.readXContent(PersistedClusterStateService.java:540)
        at app//org.elasticsearch.gateway.PersistedClusterStateService.lambda$loadOnDiskState$2(PersistedClusterStateService.java:494)
        at app//org.elasticsearch.gateway.PersistedClusterStateService.consumeFromType(PersistedClusterStateService.java:581)
        at app//org.elasticsearch.gateway.PersistedClusterStateService.loadOnDiskState(PersistedClusterStateService.java:493)
        at app//org.elasticsearch.gateway.PersistedClusterStateService.loadBestOnDiskState(PersistedClusterStateService.java:417)
        at app//org.elasticsearch.gateway.PersistedClusterStateServiceTests.loadPersistedClusterState(PersistedClusterStateServiceTests.java:1577)
        at app//org.elasticsearch.gateway.PersistedClusterStateServiceTests.testOverrideLuceneVersion(PersistedClusterStateServiceTests.java:1421)

        Caused by:
        java.lang.IllegalArgumentException: Expected [meta-data] as a field name but got test-13
            at org.elasticsearch.cluster.metadata.Metadata$Builder.fromXContent(Metadata.java:2183)
            at org.elasticsearch.gateway.PersistedClusterStateService.readXContent(PersistedClusterStateService.java:538)
            ... 6 more


Suite: Test class org.elasticsearch.gateway.PersistedClusterStateServiceTests
  1> [2022-05-26T15:04:25,152][INFO ][o.e.g.PersistedClusterStateServiceTests] [testFailsIfIndexMetadataIsDuplicated] before test
  1> [2022-05-26T15:04:25,166][INFO ][o.e.e.NodeEnvironment    ] [testFailsIfIndexMetadataIsDuplicated] using [5] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:25,167][INFO ][o.e.e.NodeEnvironment    ] [testFailsIfIndexMetadataIsDuplicated] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:25,384][INFO ][o.e.g.PersistedClusterStateServiceTests] [testFailsIfIndexMetadataIsDuplicated] after test
  1> [2022-05-26T15:04:25,388][INFO ][o.e.g.PersistedClusterStateServiceTests] [testLoadsFreshestState] before test
  1> [2022-05-26T15:04:25,401][INFO ][o.e.e.NodeEnvironment    ] [testLoadsFreshestState] using [3] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:25,401][INFO ][o.e.e.NodeEnvironment    ] [testLoadsFreshestState] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:25,438][INFO ][o.e.e.NodeEnvironment    ] [testLoadsFreshestState] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:25,438][INFO ][o.e.e.NodeEnvironment    ] [testLoadsFreshestState] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:25,475][INFO ][o.e.e.NodeEnvironment    ] [testLoadsFreshestState] using [3] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:25,475][INFO ][o.e.e.NodeEnvironment    ] [testLoadsFreshestState] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:25,515][INFO ][o.e.g.PersistedClusterStateServiceTests] [testLoadsFreshestState] after test
  1> [2022-05-26T15:04:25,518][INFO ][o.e.g.PersistedClusterStateServiceTests] [testReloadsMetadataAcrossMultipleSegments] before test
  1> [2022-05-26T15:04:25,534][INFO ][o.e.e.NodeEnvironment    ] [testReloadsMetadataAcrossMultipleSegments] using [4] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:25,534][INFO ][o.e.e.NodeEnvironment    ] [testReloadsMetadataAcrossMultipleSegments] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:27,176][INFO ][o.e.g.PersistedClusterStateServiceTests] [testReloadsMetadataAcrossMultipleSegments] after test
  1> [2022-05-26T15:04:27,180][INFO ][o.e.g.PersistedClusterStateServiceTests] [testDeleteAllPaths] before test
  1> [2022-05-26T15:04:27,187][INFO ][o.e.e.NodeEnvironment    ] [testDeleteAllPaths] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:27,187][INFO ][o.e.e.NodeEnvironment    ] [testDeleteAllPaths] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:27,218][INFO ][o.e.g.PersistedClusterStateServiceTests] [testDeleteAllPaths] after test
  1> [2022-05-26T15:04:27,221][INFO ][o.e.g.PersistedClusterStateServiceTests] [testFailsIfCorrupt] before test
  1> [2022-05-26T15:04:27,228][INFO ][o.e.e.NodeEnvironment    ] [testFailsIfCorrupt] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [281.1gb], net total_space [344.3gb], types [ext4]
  1> [2022-05-26T15:04:27,229][INFO ][o.e.e.NodeEnvironment    ] [testFailsIfCorrupt] heap size [512mb], compressed ordinary object pointers [true]
  1> [2022-05-26T15:04:27,252][INFO ][o.e.t.CorruptionUtils    ] [testFailsIfCorrupt] Corrupting file --  flipping at position 18 from 75 to 76 file: _0.cfe
  1> [2022-05-26T15:04:27,252][INFO ][o.e.t.CorruptionUtils    ] [testFailsIfCorrupt] Checksum before: [3889243134] after: [3219540954] checksum value after corruption: 3889243134] file: _0.cfe length: 278
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: Checking index with threadCount: 32
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 0.00% total deletions; 1 documents; 0 deletions
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: Segments file=segments_1 numSegments=1 version=9.2.0 id=ba4ux0qlnmg0wml8wikrx0qgg userData={current_term=1, last_accepted_version=0, node_id=Kj7q6P__T_-DgR3y_____w, node_version=8040099, oldest_index_version=8040099}
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 1 of 1: name=_0 maxDoc=1
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     version=9.2.0
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     id=ba4ux0qlnmg0wml8wikrx0qgd
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     codec=Asserting(Lucene92)
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     compound=true
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     numFiles=3
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     size (MB)=0.002
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     diagnostics = {lucene.version=9.2.0, source=flush, os.arch=amd64, java.runtime.version=17.0.2+8-86, os.version=4.19.0-20-cloud-amd64, java.vendor=Oracle Corporation, os=Linux, timestamp=1653552267245, java.version=17.0.2, java.vm.version=17.0.2+8-86}
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     no deletions
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     test: open reader.........FAILED
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex:     WARNING: exorciseIndex() would remove reference to this segment; full exception:
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: org.apache.lucene.index.CorruptIndexException: checksum failed (hardware problem?) : expected=e7d123fe actual=e3db2b5b (resource=BufferedChecksumIndexInput(NIOFSIndexInput(path="/var/lib/jenkins/workspace/elastic+elasticsearch+main+multijob+platform-support-unix/os/debian-10&&immutable/server/build/testrun/test/temp/org.elasticsearch.gateway.PersistedClusterStateServiceTests_6EB840113B42885F-001/tempDir-021/_state/_0.cfe")))
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.codecs.CodecUtil.checkFooter(CodecUtil.java:440)
  1> [2022-05-26T15:04:27,269][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.codecs.CodecUtil.checkFooter(CodecUtil.java:492)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.codecs.lucene90.Lucene90CompoundReader.readEntries(Lucene90CompoundReader.java:127)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.codecs.lucene90.Lucene90CompoundReader.<init>(Lucene90CompoundReader.java:67)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.codecs.lucene90.Lucene90CompoundFormat.getCompoundReader(Lucene90CompoundFormat.java:85)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.index.SegmentCoreReaders.<init>(SegmentCoreReaders.java:103)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:91)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.index.CheckIndex.testSegment(CheckIndex.java:928)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.index.CheckIndex.lambda$checkIndex$1(CheckIndex.java:769)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at org.apache.lucene.index.CheckIndex.lambda$callableToSupplier$2(CheckIndex.java:867)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	at java.base/java.lang.Thread.run(Thread.java:833)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 	Suppressed: org.apache.lucene.index.CorruptIndexException: codec mismatch: actual codec=Lucene90CompovndEntries vs expected codec=Lucene90CompoundEntries (resource=BufferedChecksumIndexInput(NIOFSIndexInput(path="/var/lib/jenkins/workspace/elastic+elasticsearch+main+multijob+platform-support-unix/os/debian-10&&immutable/server/build/testrun/test/temp/org.elasticsearch.gateway.PersistedClusterStateServiceTests_6EB840113B42885F-001/tempDir-021/_state/_0.cfe")))
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 		at org.apache.lucene.codecs.CodecUtil.checkHeaderNoMagic(CodecUtil.java:204)
  1> [2022-05-26T15:04:27,270][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 		at org.apache.lucene.codecs.CodecUtil.checkHeader(CodecUtil.java:193)
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 		at org.apache.lucene.codecs.CodecUtil.checkIndexHeader(CodecUtil.java:253)
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 		at org.apache.lucene.codecs.lucene90.Lucene90CompoundReader.readEntries(Lucene90CompoundReader.java:114)
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 		... 11 more
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: 
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: WARNING: 1 broken segments (containing 1 documents) detected
  1> [2022-05-26T15:04:27,271][ERROR][o.e.g.PersistedClusterStateService] [testFailsIfCorrupt] checkIndex: Took 0.014 sec total.
```
server/src/test/java/org/elasticsearch/common/compress/DeflateCompressTests.java
startingGun.await();
                        for (int i = 0; i < 10; i++) {
                            int numShorts = TestUtil.nextInt(r, 1, 40000);
                            ByteArrayOutputStream bos = new ByteArrayOutputStream();
                            short theValue = (short) r.nextInt(65535);
                            for (int j = 0; j < numShorts; j++) {
                                if (r.nextInt(10) == 0) {
                                    theValue = (short) r.nextInt(65535);
                                }
                                bos.write((byte) (theValue >>> 8));
                                bos.write((byte) theValue);
                            }
                            doTest(bos.toByteArray());
                        }
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
            };
            threads[tid].start();
        }
        startingGun.countDown();
        for (Thread t : threads) {
            t.join();
        }
    }
    private void doTest(byte bytes[]) throws IOException {
        InputStream rawIn = new ByteArrayInputStream(bytes);
        Compressor c = compressor;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();