Skip to content

Commit 56aa68d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into simple-thread-properties
2 parents bcd0183 + bd242cc commit 56aa68d

File tree

41 files changed

+1339
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1339
-152
lines changed

docs/changelog/122074.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pr: 122074
2+
summary: If the Transform is configured to write to an alias as its destination index,
3+
when the delete_dest_index parameter is set to true, then the Delete API will now
4+
delete the write index backing the alias
5+
area: Transform
6+
type: bug
7+
issues:
8+
- 121913

docs/changelog/122365.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122365
2+
summary: Fix handling of auto expand replicas for stateless indices
3+
area: "Search"
4+
type: bug
5+
issues: []

libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.net.Socket;
3636
import java.net.SocketAddress;
3737
import java.net.SocketImplFactory;
38+
import java.net.URI;
3839
import java.net.URL;
3940
import java.net.URLStreamHandler;
4041
import java.net.URLStreamHandlerFactory;
@@ -50,17 +51,24 @@
5051
import java.nio.channels.SocketChannel;
5152
import java.nio.channels.spi.SelectorProvider;
5253
import java.nio.charset.Charset;
54+
import java.nio.file.AccessMode;
55+
import java.nio.file.CopyOption;
56+
import java.nio.file.DirectoryStream;
5357
import java.nio.file.FileStore;
5458
import java.nio.file.LinkOption;
5559
import java.nio.file.OpenOption;
5660
import java.nio.file.Path;
61+
import java.nio.file.attribute.FileAttribute;
5762
import java.nio.file.attribute.UserPrincipal;
5863
import java.nio.file.spi.FileSystemProvider;
5964
import java.security.cert.CertStoreParameters;
6065
import java.util.List;
6166
import java.util.Locale;
67+
import java.util.Map;
6268
import java.util.Properties;
69+
import java.util.Set;
6370
import java.util.TimeZone;
71+
import java.util.concurrent.ExecutorService;
6472
import java.util.concurrent.ForkJoinPool;
6573
import java.util.function.Consumer;
6674

@@ -575,8 +583,79 @@ public interface EntitlementChecker {
575583
void check$java_lang_ThreadGroup$setMaxPriority(Class<?> callerClass, ThreadGroup threadGroup, int pri);
576584

577585
// file system providers
586+
void check$java_nio_file_spi_FileSystemProvider$(Class<?> callerClass);
587+
588+
void checkNewFileSystem(Class<?> callerClass, FileSystemProvider that, URI uri, Map<String, ?> env);
589+
590+
void checkNewFileSystem(Class<?> callerClass, FileSystemProvider that, Path path, Map<String, ?> env);
591+
578592
void checkNewInputStream(Class<?> callerClass, FileSystemProvider that, Path path, OpenOption... options);
579593

594+
void checkNewOutputStream(Class<?> callerClass, FileSystemProvider that, Path path, OpenOption... options);
595+
596+
void checkNewFileChannel(
597+
Class<?> callerClass,
598+
FileSystemProvider that,
599+
Path path,
600+
Set<? extends OpenOption> options,
601+
FileAttribute<?>... attrs
602+
);
603+
604+
void checkNewAsynchronousFileChannel(
605+
Class<?> callerClass,
606+
FileSystemProvider that,
607+
Path path,
608+
Set<? extends OpenOption> options,
609+
ExecutorService executor,
610+
FileAttribute<?>... attrs
611+
);
612+
613+
void checkNewByteChannel(
614+
Class<?> callerClass,
615+
FileSystemProvider that,
616+
Path path,
617+
Set<? extends OpenOption> options,
618+
FileAttribute<?>... attrs
619+
);
620+
621+
void checkNewDirectoryStream(Class<?> callerClass, FileSystemProvider that, Path dir, DirectoryStream.Filter<? super Path> filter);
622+
623+
void checkCreateDirectory(Class<?> callerClass, FileSystemProvider that, Path dir, FileAttribute<?>... attrs);
624+
625+
void checkCreateSymbolicLink(Class<?> callerClass, FileSystemProvider that, Path link, Path target, FileAttribute<?>... attrs);
626+
627+
void checkCreateLink(Class<?> callerClass, FileSystemProvider that, Path link, Path existing);
628+
629+
void checkDelete(Class<?> callerClass, FileSystemProvider that, Path path);
630+
631+
void checkDeleteIfExists(Class<?> callerClass, FileSystemProvider that, Path path);
632+
633+
void checkReadSymbolicLink(Class<?> callerClass, FileSystemProvider that, Path link);
634+
635+
void checkCopy(Class<?> callerClass, FileSystemProvider that, Path source, Path target, CopyOption... options);
636+
637+
void checkMove(Class<?> callerClass, FileSystemProvider that, Path source, Path target, CopyOption... options);
638+
639+
void checkIsSameFile(Class<?> callerClass, FileSystemProvider that, Path path, Path path2);
640+
641+
void checkIsHidden(Class<?> callerClass, FileSystemProvider that, Path path);
642+
643+
void checkGetFileStore(Class<?> callerClass, FileSystemProvider that, Path path);
644+
645+
void checkCheckAccess(Class<?> callerClass, FileSystemProvider that, Path path, AccessMode... modes);
646+
647+
void checkGetFileAttributeView(Class<?> callerClass, FileSystemProvider that, Path path, Class<?> type, LinkOption... options);
648+
649+
void checkReadAttributes(Class<?> callerClass, FileSystemProvider that, Path path, Class<?> type, LinkOption... options);
650+
651+
void checkReadAttributes(Class<?> callerClass, FileSystemProvider that, Path path, String attributes, LinkOption... options);
652+
653+
void checkReadAttributesIfExists(Class<?> callerClass, FileSystemProvider that, Path path, Class<?> type, LinkOption... options);
654+
655+
void checkSetAttribute(Class<?> callerClass, FileSystemProvider that, Path path, String attribute, Object value, LinkOption... options);
656+
657+
void checkExists(Class<?> callerClass, FileSystemProvider that, Path path, LinkOption... options);
658+
580659
// file store
581660
void checkGetFileStoreAttributeView(Class<?> callerClass, FileStore that, Class<?> type);
582661

libs/entitlement/qa/entitled-plugin/src/main/java/org/elasticsearch/entitlement/qa/entitled/EntitledActions.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,47 @@
1212
import java.io.IOException;
1313
import java.nio.file.Files;
1414
import java.nio.file.Path;
15+
import java.nio.file.Paths;
1516
import java.nio.file.attribute.UserPrincipal;
17+
import java.security.SecureRandom;
1618

19+
@SuppressForbidden(reason = "Exposes forbidden APIs for testing purposes")
1720
public final class EntitledActions {
1821
private EntitledActions() {}
1922

23+
private static final SecureRandom random = new SecureRandom();
24+
25+
private static final Path testRootDir = Paths.get(System.getProperty("es.entitlements.testdir"));
26+
27+
private static Path readDir() {
28+
return testRootDir.resolve("read_dir");
29+
}
30+
31+
private static Path readWriteDir() {
32+
return testRootDir.resolve("read_write_dir");
33+
}
34+
2035
public static UserPrincipal getFileOwner(Path path) throws IOException {
2136
return Files.getOwner(path);
2237
}
2338

2439
public static void createFile(Path path) throws IOException {
2540
Files.createFile(path);
2641
}
42+
43+
public static Path createTempFileForRead() throws IOException {
44+
return Files.createFile(readDir().resolve("entitlements-" + random.nextLong() + ".tmp"));
45+
}
46+
47+
public static Path createTempFileForWrite() throws IOException {
48+
return Files.createFile(readWriteDir().resolve("entitlements-" + random.nextLong() + ".tmp"));
49+
}
50+
51+
public static Path createTempDirectoryForWrite() throws IOException {
52+
return Files.createDirectory(readWriteDir().resolve("entitlements-dir-" + random.nextLong()));
53+
}
54+
55+
public static Path createTempSymbolicLink() throws IOException {
56+
return Files.createSymbolicLink(readDir().resolve("entitlements-link-" + random.nextLong()), readWriteDir());
57+
}
2758
}

libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/DummyImplementations.java

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,32 @@
2323
import java.net.SocketAddress;
2424
import java.net.SocketException;
2525
import java.net.SocketImpl;
26+
import java.net.URI;
2627
import java.nio.channels.AsynchronousChannelGroup;
2728
import java.nio.channels.AsynchronousServerSocketChannel;
2829
import java.nio.channels.AsynchronousSocketChannel;
2930
import java.nio.channels.DatagramChannel;
3031
import java.nio.channels.Pipe;
32+
import java.nio.channels.SeekableByteChannel;
3133
import java.nio.channels.ServerSocketChannel;
3234
import java.nio.channels.SocketChannel;
3335
import java.nio.channels.spi.AbstractSelector;
3436
import java.nio.channels.spi.AsynchronousChannelProvider;
3537
import java.nio.channels.spi.SelectorProvider;
3638
import java.nio.charset.Charset;
3739
import java.nio.charset.spi.CharsetProvider;
40+
import java.nio.file.AccessMode;
41+
import java.nio.file.CopyOption;
42+
import java.nio.file.DirectoryStream;
43+
import java.nio.file.FileStore;
44+
import java.nio.file.FileSystem;
45+
import java.nio.file.LinkOption;
46+
import java.nio.file.OpenOption;
47+
import java.nio.file.Path;
48+
import java.nio.file.attribute.BasicFileAttributes;
49+
import java.nio.file.attribute.FileAttribute;
50+
import java.nio.file.attribute.FileAttributeView;
51+
import java.nio.file.spi.FileSystemProvider;
3852
import java.security.cert.Certificate;
3953
import java.text.BreakIterator;
4054
import java.text.Collator;
@@ -51,6 +65,7 @@
5165
import java.util.Iterator;
5266
import java.util.Locale;
5367
import java.util.Map;
68+
import java.util.Set;
5469
import java.util.concurrent.ExecutorService;
5570
import java.util.concurrent.ThreadFactory;
5671
import java.util.spi.CalendarDataProvider;
@@ -568,4 +583,97 @@ public Charset charsetForName(String charsetName) {
568583
return null;
569584
}
570585
}
586+
587+
static class DummyFileSystemProvider extends FileSystemProvider {
588+
@Override
589+
public String getScheme() {
590+
return "";
591+
}
592+
593+
@Override
594+
public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IOException {
595+
return null;
596+
}
597+
598+
@Override
599+
public FileSystem getFileSystem(URI uri) {
600+
return null;
601+
}
602+
603+
@Override
604+
public Path getPath(URI uri) {
605+
return null;
606+
}
607+
608+
@Override
609+
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
610+
throws IOException {
611+
return null;
612+
}
613+
614+
@Override
615+
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException {
616+
return null;
617+
}
618+
619+
@Override
620+
public void createDirectory(Path dir, FileAttribute<?>... attrs) throws IOException {
621+
622+
}
623+
624+
@Override
625+
public void delete(Path path) throws IOException {
626+
627+
}
628+
629+
@Override
630+
public void copy(Path source, Path target, CopyOption... options) throws IOException {
631+
632+
}
633+
634+
@Override
635+
public void move(Path source, Path target, CopyOption... options) throws IOException {
636+
637+
}
638+
639+
@Override
640+
public boolean isSameFile(Path path, Path path2) throws IOException {
641+
return false;
642+
}
643+
644+
@Override
645+
public boolean isHidden(Path path) throws IOException {
646+
return false;
647+
}
648+
649+
@Override
650+
public FileStore getFileStore(Path path) throws IOException {
651+
return null;
652+
}
653+
654+
@Override
655+
public void checkAccess(Path path, AccessMode... modes) throws IOException {
656+
657+
}
658+
659+
@Override
660+
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) {
661+
return null;
662+
}
663+
664+
@Override
665+
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException {
666+
return null;
667+
}
668+
669+
@Override
670+
public Map<String, Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException {
671+
return Map.of();
672+
}
673+
674+
@Override
675+
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException {
676+
677+
}
678+
}
571679
}

0 commit comments

Comments
 (0)