mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
do real copies where copyOf was used before
This commit is contained in:
parent
69ba45a797
commit
01cfa95d1c
@ -611,7 +611,7 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IndexShardRoutingTable build() {
|
public IndexShardRoutingTable build() {
|
||||||
return new IndexShardRoutingTable(shardId, Collections.unmodifiableList(shards));
|
return new IndexShardRoutingTable(shardId, Collections.unmodifiableList(new ArrayList<>(shards)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IndexShardRoutingTable readFrom(StreamInput in) throws IOException {
|
public static IndexShardRoutingTable readFrom(StreamInput in) throws IOException {
|
||||||
|
@ -141,7 +141,7 @@ public class DanglingIndicesState extends AbstractComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
allocateDangledIndices.allocateDangled(Collections.unmodifiableCollection(danglingIndices.values()), new LocalAllocateDangledIndices.Listener() {
|
allocateDangledIndices.allocateDangled(Collections.unmodifiableCollection(new ArrayList<>(danglingIndices.values())), new LocalAllocateDangledIndices.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(LocalAllocateDangledIndices.AllocateDangledResponse response) {
|
public void onResponse(LocalAllocateDangledIndices.AllocateDangledResponse response) {
|
||||||
logger.trace("allocated dangled");
|
logger.trace("allocated dangled");
|
||||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.index.shard;
|
|||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.index.store.StoreFileMetaData;
|
import org.elasticsearch.index.store.StoreFileMetaData;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -89,8 +90,8 @@ public class CommitPoint {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.indexFiles = Collections.unmodifiableList(indexFiles);
|
this.indexFiles = Collections.unmodifiableList(new ArrayList<>(indexFiles));
|
||||||
this.translogFiles = Collections.unmodifiableList(translogFiles);
|
this.translogFiles = Collections.unmodifiableList(new ArrayList<>(translogFiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
public long version() {
|
public long version() {
|
||||||
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -46,7 +47,7 @@ public class CommitPoints implements Iterable<CommitPoint> {
|
|||||||
return (o2.version() < o1.version() ? -1 : (o2.version() == o1.version() ? 0 : 1));
|
return (o2.version() < o1.version() ? -1 : (o2.version() == o1.version() ? 0 : 1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.commitPoints = Collections.unmodifiableList(commitPoints);
|
this.commitPoints = Collections.unmodifiableList(new ArrayList<>(commitPoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CommitPoint> commits() {
|
public List<CommitPoint> commits() {
|
||||||
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.xcontent.*;
|
|||||||
import org.elasticsearch.index.store.StoreFileMetaData;
|
import org.elasticsearch.index.store.StoreFileMetaData;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -342,7 +343,7 @@ public class BlobStoreIndexShardSnapshot implements ToXContent, FromXContentBuil
|
|||||||
assert indexVersion >= 0;
|
assert indexVersion >= 0;
|
||||||
this.snapshot = snapshot;
|
this.snapshot = snapshot;
|
||||||
this.indexVersion = indexVersion;
|
this.indexVersion = indexVersion;
|
||||||
this.indexFiles = Collections.unmodifiableList(indexFiles);
|
this.indexFiles = Collections.unmodifiableList(new ArrayList<>(indexFiles));
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.numberOfFiles = numberOfFiles;
|
this.numberOfFiles = numberOfFiles;
|
||||||
|
@ -51,7 +51,7 @@ public class BlobStoreIndexShardSnapshots implements Iterable<SnapshotFiles>, To
|
|||||||
private final ImmutableMap<String, List<FileInfo>> physicalFiles;
|
private final ImmutableMap<String, List<FileInfo>> physicalFiles;
|
||||||
|
|
||||||
public BlobStoreIndexShardSnapshots(List<SnapshotFiles> shardSnapshots) {
|
public BlobStoreIndexShardSnapshots(List<SnapshotFiles> shardSnapshots) {
|
||||||
this.shardSnapshots = Collections.unmodifiableList(shardSnapshots);
|
this.shardSnapshots = Collections.unmodifiableList(new ArrayList<>(shardSnapshots));
|
||||||
// Map between blob names and file info
|
// Map between blob names and file info
|
||||||
Map<String, FileInfo> newFiles = newHashMap();
|
Map<String, FileInfo> newFiles = newHashMap();
|
||||||
// Map between original physical names and file info
|
// Map between original physical names and file info
|
||||||
@ -77,7 +77,7 @@ public class BlobStoreIndexShardSnapshots implements Iterable<SnapshotFiles>, To
|
|||||||
}
|
}
|
||||||
ImmutableMap.Builder<String, List<FileInfo>> mapBuilder = ImmutableMap.builder();
|
ImmutableMap.Builder<String, List<FileInfo>> mapBuilder = ImmutableMap.builder();
|
||||||
for (Map.Entry<String, List<FileInfo>> entry : physicalFiles.entrySet()) {
|
for (Map.Entry<String, List<FileInfo>> entry : physicalFiles.entrySet()) {
|
||||||
mapBuilder.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
|
mapBuilder.put(entry.getKey(), Collections.unmodifiableList(new ArrayList<>(entry.getValue())));
|
||||||
}
|
}
|
||||||
this.physicalFiles = mapBuilder.build();
|
this.physicalFiles = mapBuilder.build();
|
||||||
this.files = ImmutableMap.copyOf(newFiles);
|
this.files = ImmutableMap.copyOf(newFiles);
|
||||||
@ -99,7 +99,7 @@ public class BlobStoreIndexShardSnapshots implements Iterable<SnapshotFiles>, To
|
|||||||
}
|
}
|
||||||
ImmutableMap.Builder<String, List<FileInfo>> mapBuilder = ImmutableMap.builder();
|
ImmutableMap.Builder<String, List<FileInfo>> mapBuilder = ImmutableMap.builder();
|
||||||
for (Map.Entry<String, List<FileInfo>> entry : physicalFiles.entrySet()) {
|
for (Map.Entry<String, List<FileInfo>> entry : physicalFiles.entrySet()) {
|
||||||
mapBuilder.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
|
mapBuilder.put(entry.getKey(), Collections.unmodifiableList(new ArrayList<>(entry.getValue())));
|
||||||
}
|
}
|
||||||
this.physicalFiles = mapBuilder.build();
|
this.physicalFiles = mapBuilder.build();
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class SnapshotUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return Arrays.asList(selectedIndices);
|
return Collections.unmodifiableList(new ArrayList<>(Arrays.asList(selectedIndices)));
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableList(new ArrayList<>(result));
|
return Collections.unmodifiableList(new ArrayList<>(result));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user