Skip to content

Commit

Permalink
Merge pull request #227 from alex268/develop
Browse files Browse the repository at this point in the history
Merge from master with small updates
  • Loading branch information
alex268 authored Jan 31, 2024
2 parents 9b42969 + d23e153 commit e685237
Show file tree
Hide file tree
Showing 19 changed files with 500 additions and 167 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
MAVEN_ARGS: --batch-mode --update-snapshots -Dstyle.color=always

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
Expand All @@ -44,10 +44,10 @@ jobs:
MAVEN_ARGS: --batch-mode --update-snapshots -Dstyle.color=always

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
MAVEN_ARGS: --batch-mode --update-snapshots -Dstyle.color=always

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: sdk

- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
Expand All @@ -53,7 +53,7 @@ jobs:
working-directory: ./sdk
run: mvn $MAVEN_ARGS install

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ydb-platform/ydb-java-yc
ref: develop
Expand All @@ -67,7 +67,7 @@ jobs:
working-directory: ./yc
run: mvn $MAVEN_ARGS -Dydb.auth-api.version=$AUTH_API_VERSION install

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ydb-platform/ydb-java-examples
ref: develop
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
Expand Down Expand Up @@ -71,12 +71,12 @@ jobs:
gpg --list-secret-keys --keyid-format LONG
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Maven Central Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
* Core: Operation manager
* Table: Added readRows operation in table service

## 2.1.11 ##

* Transports: Add option withGrpcKeepAliveTime to enable grpc keep-alives
* Table: Fixed creation and altering of dataColumns indexes in createTable/alterTable
* Upgraded version of yc-auth to avoid jackson-databind vulnerability

## 2.1.10 ##

* Topics: Added message metadata support
Expand Down
14 changes: 0 additions & 14 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,3 @@ Copyright 2022 YANDEX LLC
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2022 YANDEX LLC

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.
13 changes: 13 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2019 YANDEX LLC

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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Firstly you can import YDB Java BOM to specify correct versions of SDK modules.
<dependency>
<groupId>tech.ydb</groupId>
<artifactId>ydb-sdk-bom</artifactId>
<version>2.1.10</version>
<version>2.1.11</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
26 changes: 14 additions & 12 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,33 @@
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-proto-extension</artifactId>
<scope>test</scope>
</dependency>-->

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.74</version>
<version>1.77</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.74</version>
<version>1.77</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>

<profiles>
<profile>
<!-- https://github.com/grpc/grpc-java/blob/master/SECURITY.md#tls-on-non-android -->
Expand Down
21 changes: 21 additions & 0 deletions core/src/main/java/tech/ydb/core/grpc/GrpcTransportBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class GrpcTransportBuilder {
* can cause leaks https://github.com/grpc/grpc-java/issues/9340
*/
private boolean grpcRetry = false;
private Long grpcKeepAliveTimeMillis = 10_000L;

GrpcTransportBuilder(@Nullable String endpoint, @Nullable HostAndPort host, @Nonnull String database) {
this.endpoint = endpoint;
Expand Down Expand Up @@ -132,6 +133,10 @@ public boolean isEnableRetry() {
return grpcRetry;
}

public Long getGrpcKeepAliveTimeMillis() {
return grpcKeepAliveTimeMillis;
}

public boolean useDefaultGrpcResolver() {
return useDefaultGrpcResolver;
}
Expand Down Expand Up @@ -236,6 +241,22 @@ public GrpcTransportBuilder withDiscoveryTimeout(long timeout, TimeUnit unit) {
return this;
}

public GrpcTransportBuilder withGrpcKeepAliveTime(Duration time) {
if (time == null) {
this.grpcKeepAliveTimeMillis = null;
} else {
this.grpcKeepAliveTimeMillis = time.toMillis();
Preconditions.checkArgument(grpcKeepAliveTimeMillis > 0, "grpcKeepAliveTime must be greater than 0");
}
return this;
}

public GrpcTransportBuilder withGrpcKeepAliveTime(long time, TimeUnit unit) {
this.grpcKeepAliveTimeMillis = unit.toMillis(time);
Preconditions.checkArgument(grpcKeepAliveTimeMillis > 0, "grpcKeepAliveTime must be greater than 0");
return this;
}

public GrpcTransportBuilder withCallExecutor(Executor executor) {
this.callExecutor = Objects.requireNonNull(executor);
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tech.ydb.core.impl.pool;

import java.io.ByteArrayInputStream;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;

import javax.net.ssl.SSLException;
Expand Down Expand Up @@ -39,6 +40,7 @@ public class ManagedChannelFactory {
private final boolean retryEnabled;
private final long connectTimeoutMs;
private final boolean useDefaultGrpcResolver;
private final Long grpcKeepAliveTimeMillis;

private ManagedChannelFactory(GrpcTransportBuilder builder) {
this.database = builder.getDatabase();
Expand All @@ -49,6 +51,7 @@ private ManagedChannelFactory(GrpcTransportBuilder builder) {
this.retryEnabled = builder.isEnableRetry();
this.connectTimeoutMs = builder.getConnectTimeoutMillis();
this.useDefaultGrpcResolver = builder.useDefaultGrpcResolver();
this.grpcKeepAliveTimeMillis = builder.getGrpcKeepAliveTimeMillis();
}

public long getConnectTimeoutMs() {
Expand Down Expand Up @@ -80,6 +83,10 @@ public ManagedChannel newManagedChannel(String host, int port) {
.defaultLoadBalancingPolicy(DEFAULT_BALANCER_POLICY);
}

if (grpcKeepAliveTimeMillis != null) {
channelBuilder.keepAliveTime(grpcKeepAliveTimeMillis, TimeUnit.MILLISECONDS);
}

if (channelInitializer != null) {
channelInitializer.accept(channelBuilder);
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/tech/ydb/core/utils/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private Version() {
public static Optional<String> getVersion() {
try {
Properties prop = new Properties();
InputStream in = Version.class.getResourceAsStream("/version.properties");
InputStream in = Version.class.getResourceAsStream("/ydb_sdk_version.properties");
prop.load(in);
return Optional.ofNullable(prop.getProperty("version"));
} catch (Exception ex) {
Expand Down
1 change: 0 additions & 1 deletion core/src/main/resources/version.properties

This file was deleted.

1 change: 1 addition & 0 deletions core/src/main/resources/ydb_sdk_version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=${project.version}
13 changes: 10 additions & 3 deletions table/src/main/java/tech/ydb/table/description/ColumnFamily.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ public final class ColumnFamily {
private final String name;
private final StoragePool data;
private final Compression compression;
private final boolean keepInMemory;

@Deprecated
public ColumnFamily(String name, StoragePool data, Compression compression, boolean keepInMemory) {
this.name = name;
this.data = data;
this.compression = compression;
this.keepInMemory = keepInMemory;
// this.keepInMemory = keepInMemory;
}

public ColumnFamily(String name, StoragePool data, Compression compression) {
this.name = name;
this.data = data;
this.compression = compression;
}

public String getName() {
Expand All @@ -25,8 +31,9 @@ public Compression getCompression() {
return compression;
}

@Deprecated
public boolean isKeepInMemory() {
return keepInMemory;
return false;
}

public enum Compression {
Expand Down
Loading

0 comments on commit e685237

Please sign in to comment.