Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEDE-7220] arrow upgrade - check we can use memory unsafe instead of memory netty #50

Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ab27497
[FEDE-6183] Upgrade arrow to 11.0.0 (#46)
GeorgeAp May 11, 2023
992695b
update Poms
prateeknima77 Feb 26, 2024
282d889
update: bump siren arrow to next version siren-11.0.0-3-SNAPSHOT (#47)
GeorgeAp May 11, 2023
7b5c6cd
[FEDE-6850] feat: update netty to version siren-4.1.82-2 (#48)
scampi Oct 26, 2023
42b6d04
bump version number to siren-11.0.0-4-SNAPSHOT
scampi Oct 26, 2023
5a9dff1
update: poms
prateeknima77 Feb 26, 2024
76010ad
update: snapshot version
prateeknima77 Feb 26, 2024
77b48e9
chore: remove unused imports
prateeknima77 Feb 26, 2024
adfeb46
chore: update readme
prateeknima77 Feb 27, 2024
c9f0cc0
update: netty version
prateeknima77 Feb 27, 2024
51d8de6
update: java bom
prateeknima77 Feb 27, 2024
33c9657
update: snapshot version
prateeknima77 Feb 27, 2024
a83092b
chore: update readme
prateeknima77 Feb 27, 2024
cff1c73
update: discard project version from dependency
prateeknima77 Feb 27, 2024
8cd59c2
update: delete testing and parquet testing
prateeknima77 Feb 27, 2024
e1c6c8d
update: add project version
prateeknima77 Feb 28, 2024
be640a4
update: add Siren artifactory profile
prateeknima77 Feb 28, 2024
3c8bcca
revert: parent artifact version
prateeknima77 Feb 28, 2024
8fe1264
update: comment out analyze-only goal - causing issues during maven i…
prateeknima77 Feb 28, 2024
455a949
update: Pom files to remove dependency on netty
prateeknima77 Apr 3, 2024
d0dd1ef
update: remove shading
prateeknima77 Apr 18, 2024
4e5f3e4
update: pom - discard exclusion of memory-unsafe
prateeknima77 Apr 18, 2024
01ad286
update: readme
prateeknima77 Apr 18, 2024
fb7d427
update: vector pom
prateeknima77 Apr 19, 2024
9a6b412
update: revert vector pom changes
prateeknima77 Apr 23, 2024
1c369e8
chore: remove extra spaces
prateeknima77 Apr 23, 2024
a9b84cf
update: readme
prateeknima77 Apr 29, 2024
4a78ab5
update: vector pom to add memory netty dependency
prateeknima77 Jul 26, 2024
dd3c51d
fix: shadow memory-netty
prateeknima77 Jul 30, 2024
ce9ab8c
update: revert changes - discard addition of memory-netty
prateeknima77 Aug 6, 2024
21655f9
update:- snapshot version
prateeknima77 Aug 9, 2024
505495e
update: analyze-only goal - turn warnings check off
prateeknima77 Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,62 @@
under the License.
-->

# Siren fork of Arrow

The properties `drill.enable_unsafe_memory_access` and
`arrow.enable_unsafe_memory_access` are prefixed with `siren` and their
default value is set to `true`. The first property is deprecated.

## Check that Arrow uses Unsafe class to access off-heap memory for memory allocation
In order to check that Arrow uses Unsafe class for memory allocation, run the unit test `CheckArrowTest` in
`https://github.com/sirensolutions/siren-platform/blob/master/core/src/test/java/io/siren/federate/core/common/CheckArrowTest.java`.

## Build

To build the `memory`, `format` and `vector` modules:

```sh
$ cd java
$ mvn clean package
```

Because of the default value change of `unsafe_memory_access` property, some
tests in `vector` fail.

```sh
mvn -pl maven,maven/module-info-compiler-maven-plugin,memory,memory/memory-core,memory/memory-unsafe,format,vector install -Dsiren.arrow.enable_unsafe_memory_access=false -Dsiren.drill.enable_unsafe_memory_access=false
```

## Make a new release of Siren's Apache Arrow

- Tests should pass.

- Make a new version:

```sh
mvn versions:set -DnewVersion=siren-0.14.1-2
```

- tag the commit for the release

```sh
git tag --sign siren-0.14.1-2
````

- Deploy to Siren's artifactory

```sh
$ mvn deploy -DskipTests=true -P artifactory -Dartifactory_username=<USERNAME> -Dartifactory_password=<PASSWORD>
```

## Update to a new version of Siren's Apache Arrow
Developer tips on updating to a new version of Arrow can be found here: https://sirensolutions.atlassian.net/wiki/spaces/EN/pages/3108864001/Upgrading+Federate+Apache+Arrow+Version .

- add `[email protected]:apache/arrow.git` as the `upstream` remote.
- execute `git fetch --all --tags`
- create a temporary branch from `siren-changes`
- rebase against the new tag.

# Apache Arrow

[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arrow.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arrow)
Expand Down
1 change: 0 additions & 1 deletion cpp/submodules/parquet-testing
Submodule parquet-testing deleted from d69d97
2 changes: 1 addition & 1 deletion java/adapter/orc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/format/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>arrow-java-root</artifactId>
<groupId>org.apache.arrow</groupId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>

<artifactId>arrow-format</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/gandiva/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>

<groupId>org.apache.arrow.gandiva</groupId>
Expand Down
4 changes: 2 additions & 2 deletions java/maven/module-info-compiler-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.arrow.maven.plugins</groupId>
<artifactId>arrow-maven-plugins</artifactId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>
<artifactId>module-info-compiler-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
Expand Down Expand Up @@ -127,4 +127,4 @@
</build>


</project>
</project>
23 changes: 22 additions & 1 deletion java/maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-->
<groupId>org.apache.arrow.maven.plugins</groupId>
<artifactId>arrow-maven-plugins</artifactId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
<name>Arrow Maven Plugins</name>
<packaging>pom</packaging>

Expand Down Expand Up @@ -342,4 +342,25 @@
</plugin>
</plugins>
</reporting>

<!-- To deploy to Siren artifactory -->
<profiles>
<profile>
<id>artifactory</id>

<distributionManagement>
<repository>
<id>artifactory-releases</id>
<name>artifactory-releases</name>
<url>${artifactory.url}/libs-release-local</url>
</repository>
<snapshotRepository>
<id>artifactory-snapshots</id>
<name>artifactory-snapshots</name>
<url>${artifactory.url}/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>

</project>
2 changes: 1 addition & 1 deletion java/memory/memory-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-memory</artifactId>
<groupId>org.apache.arrow</groupId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ public class BoundsChecking {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BoundsChecking.class);

static {
String envProperty = System.getenv("ARROW_ENABLE_UNSAFE_MEMORY_ACCESS");
String oldProperty = System.getProperty("drill.enable_unsafe_memory_access");
String envProperty = System.getenv().getOrDefault("SIREN_ARROW_ENABLE_UNSAFE_MEMORY_ACCESS", "true");
String oldProperty = System.getProperty("siren.drill.enable_unsafe_memory_access", "true");
if (oldProperty != null) {
logger.warn("\"drill.enable_unsafe_memory_access\" has been renamed to \"arrow.enable_unsafe_memory_access\"");
logger.warn("\"arrow.enable_unsafe_memory_access\" can be set to: " +
" true (to not check) or false (to check, default)");
logger.warn("\"siren.drill.enable_unsafe_memory_access\" has been renamed to " +
"\"siren.arrow.enable_unsafe_memory_access\"");
logger.warn("\"siren.arrow.enable_unsafe_memory_access\" can be set to: " +
" true (to not check, default) or false (to check)");
}
String newProperty = System.getProperty("arrow.enable_unsafe_memory_access");
String newProperty = System.getProperty("siren.arrow.enable_unsafe_memory_access", "true");

// The priority of determining the unsafe flag:
// 1. The system properties take precedence over the environmental variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public Object run() {

// get the offset of the address field in a java.nio.Buffer object
Field addressField = java.nio.Buffer.class.getDeclaredField("address");
addressField.setAccessible(true);
BYTE_BUFFER_ADDRESS_OFFSET = UNSAFE.objectFieldOffset(addressField);

Constructor<?> directBufferConstructor;
Expand All @@ -104,10 +103,7 @@ public Object run() {
constructor.setAccessible(true);
logger.debug("Constructor for direct buffer found and made accessible");
return constructor;
} catch (NoSuchMethodException e) {
logger.debug("Cannot get constructor for direct buffer allocation", e);
return e;
} catch (SecurityException e) {
GeorgeAp marked this conversation as resolved.
Show resolved Hide resolved
} catch (Exception e) {
GeorgeAp marked this conversation as resolved.
Show resolved Hide resolved
logger.debug("Cannot get constructor for direct buffer allocation", e);
return e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ private boolean getFlagValue(ClassLoader classLoader) throws Exception {
}

/**
* Ensure the flag for bounds checking is enabled by default.
* This will protect users from JVM crashes.
* Siren: Ensure the flag for bounds checking is disabled by default.
* Enabling it will protect users from JVM crashes.
*/
@Test
public void testDefaultValue() throws Exception {
ClassLoader classLoader = copyClassLoader();
if (classLoader != null) {
boolean boundsCheckingEnabled = getFlagValue(classLoader);
Assert.assertTrue(boundsCheckingEnabled);
Assert.assertFalse(boundsCheckingEnabled);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.Ignore;
import org.junit.Test;

public class TestOpens {
/** Instantiating the RootAllocator should poke MemoryUtil and fail. */
@Test
@Ignore
torito marked this conversation as resolved.
Show resolved Hide resolved
public void testMemoryUtilFailsLoudly() {
// This test is configured by Maven to run WITHOUT add-opens. So this should fail on JDK16+
// (where JEP396 means that add-opens is required to access JDK internals).
Expand Down
54 changes: 53 additions & 1 deletion java/memory/memory-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-memory</artifactId>
<groupId>org.apache.arrow</groupId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -25,6 +25,7 @@
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
Expand All @@ -34,9 +35,11 @@
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
</dependency>
<!--provided by elasticsearch-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand All @@ -50,6 +53,55 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<relocations>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>shaded.io.netty</shadedPattern>
scampi marked this conversation as resolved.
Show resolved Hide resolved
</relocation>
</relocations>
<artifactSet>
<excludes>
<exclude>org.slf4j</exclude>
<exclude>com.google.code.findbugs</exclude>
<exclude>com.google.guava</exclude>
</excludes>
</artifactSet>
<!--to prevent the Invalid signature file error -->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<!-- This profile turns on integration testing. It activates the failsafe plugin and will run any tests
Expand Down
2 changes: 1 addition & 1 deletion java/memory/memory-unsafe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-memory</artifactId>
<groupId>org.apache.arrow</groupId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java/memory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>15.0.0</version>
<version>siren-15.0.0-remove-netty-test-SNAPSHOT</version>
</parent>
<artifactId>arrow-memory</artifactId>
<name>Arrow Memory</name>
Expand Down
Loading
Loading