forked from apache/ozone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.4.1-develop' into rel/1.4.1_arenadata1
- Loading branch information
Showing
85 changed files
with
3,011 additions
and
878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. See accompanying LICENSE file. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>ozone-main</artifactId> | ||
<groupId>org.apache.ozone</groupId> | ||
<version>1.4.1</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>ozone-dev-support</artifactId> | ||
<description>Helper module for sharing resources among projects</description> | ||
<name>Apache Ozone Dev Support</name> | ||
|
||
<properties> | ||
<failIfNoTests>false</failIfNoTests> | ||
</properties> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>${project.build.directory}/extra-resources</directory> | ||
<targetPath>META-INF</targetPath> | ||
<includes> | ||
<include>LICENSE.txt</include> | ||
<include>NOTICE.txt</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<!-- copy L&N files to target/extra-resources --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-resources</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${project.build.directory}/extra-resources</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>../</directory> | ||
<includes> | ||
<include>LICENSE.txt</include> | ||
<include>NOTICE.txt</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- add entries for L&N files to remote-resources.xml in jar file --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-remote-resources-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>process-resources</phase> | ||
<goals> | ||
<goal>bundle</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<resourcesDirectory>${project.build.outputDirectory}</resourcesDirectory> | ||
<includes> | ||
<include>META-INF/LICENSE.txt</include> | ||
<include>META-INF/NOTICE.txt</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/conf/RatisConfUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.hdds.conf; | ||
|
||
import org.apache.ratis.conf.RaftProperties; | ||
import org.apache.ratis.grpc.GrpcConfigKeys; | ||
import org.apache.ratis.server.RaftServerConfigKeys; | ||
import org.apache.ratis.util.Preconditions; | ||
import org.apache.ratis.util.SizeInBytes; | ||
|
||
/** | ||
* Utilities for Ratis configurations. | ||
*/ | ||
public class RatisConfUtils { | ||
/** For {@link GrpcConfigKeys}. */ | ||
public static class Grpc { | ||
/** For setting {@link GrpcConfigKeys#setMessageSizeMax(RaftProperties, SizeInBytes)}. */ | ||
public static void setMessageSizeMax(RaftProperties properties, int max) { | ||
Preconditions.assertTrue(max > 0, () -> "max = " + max + " <= 0"); | ||
|
||
final long logAppenderBufferByteLimit = RaftServerConfigKeys.Log.Appender.bufferByteLimit(properties).getSize(); | ||
Preconditions.assertTrue(max >= logAppenderBufferByteLimit, | ||
() -> "max = " + max + " < logAppenderBufferByteLimit = " + logAppenderBufferByteLimit); | ||
|
||
// Need an 1MB gap; see RATIS-2135 | ||
GrpcConfigKeys.setMessageSizeMax(properties, SizeInBytes.valueOf(max + SizeInBytes.ONE_MB.getSize())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/conf/TestRatisConfUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.hdds.conf; | ||
|
||
import org.apache.ratis.conf.RaftProperties; | ||
import org.apache.ratis.grpc.GrpcConfigKeys; | ||
import org.apache.ratis.server.RaftServerConfigKeys; | ||
import org.apache.ratis.util.SizeInBytes; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Test {@link RatisConfUtils}. | ||
*/ | ||
public class TestRatisConfUtils { | ||
private static final Logger LOG = LoggerFactory.getLogger(TestRatisConfUtils.class); | ||
|
||
@Test | ||
void testGrpcSetMessageSizeMax() { | ||
final RaftProperties properties = new RaftProperties(); | ||
|
||
final int logAppenderBufferByteLimit = 1000; | ||
|
||
// setMessageSizeMax without setBufferByteLimit | ||
Assertions.assertThrows(IllegalStateException.class, | ||
() -> RatisConfUtils.Grpc.setMessageSizeMax(properties, logAppenderBufferByteLimit)); | ||
|
||
RaftServerConfigKeys.Log.Appender.setBufferByteLimit(properties, SizeInBytes.valueOf(logAppenderBufferByteLimit)); | ||
|
||
// setMessageSizeMax with a value smaller than logAppenderBufferByteLimit | ||
Assertions.assertThrows(IllegalStateException.class, | ||
() -> RatisConfUtils.Grpc.setMessageSizeMax(properties, logAppenderBufferByteLimit - 1)); | ||
|
||
// setMessageSizeMax with the correct logAppenderBufferByteLimit | ||
RatisConfUtils.Grpc.setMessageSizeMax(properties, logAppenderBufferByteLimit); | ||
|
||
final SizeInBytes max = GrpcConfigKeys.messageSizeMax(properties, LOG::info); | ||
Assertions.assertEquals(SizeInBytes.ONE_MB.getSize(), max.getSize() - logAppenderBufferByteLimit); | ||
} | ||
} |
Oops, something went wrong.