Skip to content

Commit

Permalink
Merge branch 'main' into strict-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Sa1Gur authored Mar 19, 2024
2 parents 8d6c015 + 77eb9ef commit 82ce620
Show file tree
Hide file tree
Showing 20 changed files with 463 additions and 35 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,17 @@ jobs:

- name: test hybrid node modules - commonjs
run: |
cd hybrid-node-tests
cd commonjs-test
npm install
npm install --package-lock-only
npm ci
npm run build-and-test
working-directory: ./node
working-directory: ./node/hybrid-node-tests/commonjs-test

- name: test hybrid node modules - ecma
run: |
cd hybrid-node-tests
cd ecmascript-test
npm install
npm install --package-lock-only
npm ci
npm run build-and-test
working-directory: ./node
working-directory: ./node/hybrid-node-tests/ecmascript-test

- name: test redis modules
run: npm run test-modules -- --load-module=$GITHUB_WORKSPACE/redisearch.so --load-module=$GITHUB_WORKSPACE/redisjson.so
Expand All @@ -109,7 +107,7 @@ jobs:

build-macos-latest:
runs-on: macos-latest
timeout-minutes: 15
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
if: github.repository_owner == 'aws'
name: Publish packages to PyPi
runs-on: ${{ matrix.build.RUNNER }}
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:

build-macos-latest:
runs-on: macos-latest
timeout-minutes: 15
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@
* Python, Node: Added ZPOPMAX command ([#996](https://github.com/aws/glide-for-redis/pull/996), [#1009](https://github.com/aws/glide-for-redis/pull/1009))
* Python: Added ZRANGE command ([#906](https://github.com/aws/glide-for-redis/pull/906))
* Python, Node: Added PTTL command ([#1036](https://github.com/aws/glide-for-redis/pull/1036), [#1082](https://github.com/aws/glide-for-redis/pull/1082))
* Node: Added HVAL command ([#1022](https://github.com/aws/glide-for-redis/pull/1022))
* Node: Added PERSIST command ([#1023](https://github.com/aws/glide-for-redis/pull/1023))
* Python, Node: Added HVAL command ([#1130](https://github.com/aws/glide-for-redis/pull/1130)), ([#1022](https://github.com/aws/glide-for-redis/pull/1022))
* Python, Node: Added PERSIST command ([#1129](https://github.com/aws/glide-for-redis/pull/1129)), ([#1023](https://github.com/aws/glide-for-redis/pull/1023))
* Node: Added ZREMRANGEBYSCORE command ([#926](https://github.com/aws/glide-for-redis/pull/926))
* Node: Added ZREMRANGEBYRANK command ([#924](https://github.com/aws/glide-for-redis/pull/924))
* Node: Added Xadd, Xtrim commands. ([#1057](https://github.com/aws/glide-for-redis/pull/1057))
* Python: Added json module and JSON.SET JSON.GET commands ([#1056](https://github.com/aws/glide-for-redis/pull/1056))
* Node: Added Time command. ([#1114](https://github.com/aws/glide-for-redis/pull/1114))
* Python, Node: Added LINDEX command ([#1058](https://github.com/aws/glide-for-redis/pull/1058), [#999](https://github.com/aws/glide-for-redis/pull/999))
* Python: Added ZRANK command ([#1065](https://github.com/aws/glide-for-redis/pull/1065))
* Core: Enabled Cluster Mode periodic checks by default ([#1089](https://github.com/aws/glide-for-redis/pull/1089))

#### Features

* Python: Allow chaining function calls on transaction. ([#987](https://github.com/aws/glide-for-redis/pull/987))
* Node: Adding support for GLIDE's usage in projects based on either `CommonJS` or `ECMAScript` modules. ([#1132](https://github.com/aws/glide-for-redis/pull/1132))
* Python: Added Cluster Mode configuration for periodic checks interval ([#1089](https://github.com/aws/glide-for-redis/pull/1089))


## 0.2.0 (2024-02-11)

Expand Down
5 changes: 5 additions & 0 deletions csharp/tests/Integration/GetAndSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/


using System.Runtime.InteropServices;

using System.Runtime.InteropServices;

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 6.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 6.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 8.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 8.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 6.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 6.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 8.0, ubuntu-latest)

Using directive is unnecessary.

Check failure on line 8 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 8.0, ubuntu-latest)

Using directive is unnecessary.

using Glide;
Expand Down Expand Up @@ -61,7 +63,10 @@ public async Task GetReturnsEmptyString()
[Test]
public async Task HandleVeryLargeInput()
{
// TODO invesitage and fix
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 6.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 6.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 8.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 8.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 6.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 6.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 8.0, ubuntu-latest)

Add braces to 'if' statement.

Check failure on line 67 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 8.0, ubuntu-latest)

Add braces to 'if' statement.
Assert.Ignore("Flaky on MacOS");
using (var client = new AsyncClient("localhost", TestConfiguration.STANDALONE_PORTS[0], false))

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 6.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 6.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 8.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (6.2.14, 8.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 6.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 6.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 8.0, ubuntu-latest)

Use explicit type instead of 'var'

Check failure on line 69 in csharp/tests/Integration/GetAndSet.cs

View workflow job for this annotation

GitHub Actions / run-tests (7.2.3, 8.0, ubuntu-latest)

Use explicit type instead of 'var'
{
Assert.Ignore("Flaky on MacOS");
}
Expand Down
4 changes: 2 additions & 2 deletions glide-core/THIRD_PARTY_LICENSES_RUST
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: async-trait:0.1.77
Package: async-trait:0.1.78

The following copyrights and licenses were found in the source code of this package:

Expand Down Expand Up @@ -27447,7 +27447,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: syn:2.0.52
Package: syn:2.0.53

The following copyrights and licenses were found in the source code of this package:

Expand Down
39 changes: 36 additions & 3 deletions glide-core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/
use crate::connection_request::{
ConnectionRequest, NodeAddress, ProtocolVersion, ReadFrom, TlsMode,
connection_request, ConnectionRequest, NodeAddress, ProtocolVersion, ReadFrom, TlsMode,
};
use crate::scripts_container::get_script;
use futures::FutureExt;
Expand All @@ -26,6 +26,7 @@ pub const HEARTBEAT_SLEEP_DURATION: Duration = Duration::from_secs(1);

pub const DEFAULT_RESPONSE_TIMEOUT: Duration = Duration::from_millis(250);
pub const DEFAULT_CONNECTION_ATTEMPT_TIMEOUT: Duration = Duration::from_millis(250);
pub const DEFAULT_PERIODIC_CHECKS_INTERVAL: Duration = Duration::from_secs(60);
pub const INTERNAL_CONNECTION_TIMEOUT: Duration = Duration::from_millis(250);

pub(super) fn get_port(address: &NodeAddress) -> u16 {
Expand Down Expand Up @@ -284,11 +285,23 @@ async fn create_cluster_client(
.collect();
let read_from = request.read_from.enum_value().unwrap_or(ReadFrom::Primary);
let read_from_replicas = !matches!(read_from, ReadFrom::Primary,); // TODO - implement different read from replica strategies.
let periodic_checks = match request.periodic_checks {
Some(periodic_checks) => match periodic_checks {
connection_request::Periodic_checks::PeriodicChecksManualInterval(interval) => {
Some(Duration::from_secs(interval.duration_in_sec.into()))
}
connection_request::Periodic_checks::PeriodicChecksDisabled(_) => None,
},
None => Some(DEFAULT_PERIODIC_CHECKS_INTERVAL),
};
let mut builder = redis::cluster::ClusterClientBuilder::new(initial_nodes)
.connection_timeout(INTERNAL_CONNECTION_TIMEOUT);
if read_from_replicas {
builder = builder.read_from_replicas();
}
if let Some(interval_duration) = periodic_checks {
builder = builder.periodic_topology_checks(interval_duration);
}
builder = builder.use_protocol(convert_to_redis_protocol(
request.protocol.enum_value_or_default(),
));
Expand Down Expand Up @@ -388,7 +401,6 @@ fn sanitized_request_string(request: &ConnectionRequest) -> String {
let connection_retry_strategy = request.connection_retry_strategy.0.as_ref().map(|strategy|
format!("\nreconnect backoff strategy: number of increasing duration retries: {}, base: {}, factor: {}",
strategy.number_of_retries, strategy.exponent_base, strategy.factor)).unwrap_or_default();

let protocol = request
.protocol
.enum_value()
Expand All @@ -397,9 +409,30 @@ fn sanitized_request_string(request: &ConnectionRequest) -> String {
let client_name = chars_to_string_option(&request.client_name)
.map(|client_name| format!("\nClient name: {client_name}"))
.unwrap_or_default();
let periodic_checks = if request.cluster_mode_enabled {
match request.periodic_checks {
Some(ref periodic_checks) => match periodic_checks {
connection_request::Periodic_checks::PeriodicChecksManualInterval(interval) => {
format!(
"\nPeriodic Checks: Enabled with manual interval of {:?}s",
interval.duration_in_sec
)
}
connection_request::Periodic_checks::PeriodicChecksDisabled(_) => {
"\nPeriodic Checks: Disabled".to_string()
}
},
None => format!(
"\nPeriodic Checks: Enabled with default interval of {:?}",
DEFAULT_PERIODIC_CHECKS_INTERVAL
),
}
} else {
"".to_string()
};

format!(
"\nAddresses: {addresses}{tls_mode}{cluster_mode}{request_timeout}{rfr_strategy}{connection_retry_strategy}{database_id}{protocol}{client_name}",
"\nAddresses: {addresses}{tls_mode}{cluster_mode}{request_timeout}{rfr_strategy}{connection_retry_strategy}{database_id}{protocol}{client_name}{periodic_checks}",
)
}

Expand Down
11 changes: 11 additions & 0 deletions glide-core/src/protobuf/connection_request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ enum ProtocolVersion {
RESP2 = 1;
}

message PeriodicChecksManualInterval {
uint32 duration_in_sec = 1;
}

message PeriodicChecksDisabled {
}

// IMPORTANT - if you add fields here, you probably need to add them also in client/mod.rs:`sanitized_request_string`.
message ConnectionRequest {
repeated NodeAddress addresses = 1;
Expand All @@ -41,6 +48,10 @@ message ConnectionRequest {
uint32 database_id = 8;
ProtocolVersion protocol = 9;
string client_name = 10;
oneof periodic_checks {
PeriodicChecksManualInterval periodic_checks_manual_interval = 11;
PeriodicChecksDisabled periodic_checks_disabled = 12;
}
}

message ConnectionRetryStrategy {
Expand Down
1 change: 1 addition & 0 deletions glide-core/src/protobuf/redis_request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ enum RequestType {
JsonGet = 89;
ZRemRangeByScore = 90;
Time = 91;
Zrank = 92;
}

message Command {
Expand Down
1 change: 1 addition & 0 deletions glide-core/src/socket_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ fn get_command(request: &Command) -> Option<Cmd> {
RequestType::JsonGet => Some(cmd("JSON.GET")),
RequestType::ZRemRangeByScore => Some(cmd("ZREMRANGEBYSCORE")),
RequestType::Time => Some(cmd("TIME")),
RequestType::Zrank => Some(cmd("ZRANK")),
}
}

Expand Down
67 changes: 64 additions & 3 deletions node/THIRD_PARTY_LICENSES_NODE
Original file line number Diff line number Diff line change
Expand Up @@ -2816,7 +2816,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: async-trait:0.1.77
Package: async-trait:0.1.78

The following copyrights and licenses were found in the source code of this package:

Expand Down Expand Up @@ -29072,7 +29072,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: syn:2.0.52
Package: syn:2.0.53

The following copyrights and licenses were found in the source code of this package:

Expand Down Expand Up @@ -40953,6 +40953,67 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: child_process:1.0.2

The following copyrights and licenses were found in the source code of this package:

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

----

Package: find-free-port:2.0.0

The following copyrights and licenses were found in the source code of this package:

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

----

Package: find-free-ports:3.1.1

The following copyrights and licenses were found in the source code of this package:

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: long:5.2.3

The following copyrights and licenses were found in the source code of this package:
Expand Down Expand Up @@ -41602,7 +41663,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----

Package: @types:node:20.11.26
Package: @types:node:20.11.29

The following copyrights and licenses were found in the source code of this package:

Expand Down
6 changes: 3 additions & 3 deletions python/THIRD_PARTY_LICENSES_PYTHON
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: async-trait:0.1.77
Package: async-trait:0.1.78

The following copyrights and licenses were found in the source code of this package:

Expand Down Expand Up @@ -29512,7 +29512,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----

Package: syn:2.0.52
Package: syn:2.0.53

The following copyrights and licenses were found in the source code of this package:

Expand Down Expand Up @@ -44430,7 +44430,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----

Package: protobuf:4.25.3
Package: protobuf:5.26.0

The following copyrights and licenses were found in the source code of this package:

Expand Down
Loading

0 comments on commit 82ce620

Please sign in to comment.