Skip to content

Commit

Permalink
upgrading client version to 6.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
idantavor committed Feb 21, 2023
1 parent c601c8b commit ff9968a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 126 deletions.
44 changes: 1 addition & 43 deletions .github/workflows/build_test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,49 +48,7 @@ jobs:

test:
needs: build
runs-on: ubuntu-22.04
timeout-minutes: 5
services:
aerospike-test:
image: aerospike:4.9.0.11
ports:
- 3000:3000
- 3001:3001
- 3002:3002
- 3003:3003
env:
AEROSPIKE_HOST: localhost
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 8

- name: Restore local Maven repository from cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Unit and integration tests
run: lein eftest :all

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Unit Test Results
path: |
target/junit.xml
uses: ./.github/workflows/test.yml

event_file:
needs: test
Expand Down
36 changes: 1 addition & 35 deletions .github/workflows/ci_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,7 @@ jobs:

test:
needs: build
runs-on: ubuntu-22.04
timeout-minutes: 5
services:
aerospike-test:
image: aerospike:4.9.0.11
ports:
- 3000:3000
- 3001:3001
- 3002:3002
- 3003:3003
env:
AEROSPIKE_HOST: localhost
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 8

- name: Restore local Maven repository from cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Unit and Integration tests
run: lein eftest :all
uses: ./.github/workflows/test.yml

deploy:
needs: test
Expand Down
36 changes: 1 addition & 35 deletions .github/workflows/ci_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,7 @@ jobs:

test:
needs: build
runs-on: ubuntu-22.04
timeout-minutes: 5
services:
aerospike-test:
image: aerospike:4.9.0.11
ports:
- 3000:3000
- 3001:3001
- 3002:3002
- 3003:3003
env:
AEROSPIKE_HOST: localhost
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 8

- name: Restore local Maven repository from cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Unit and Integration tests
run: lein eftest :all
uses: ./.github/workflows/test.yml

deploy:
needs: test
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on: [workflow_call]

jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 5
services:
aerospike-test:
image: aerospike:ee-6.2.0.3
ports:
- 3000:3000
- 3001:3001
- 3002:3002
- 3003:3003
env:
AEROSPIKE_HOST: localhost
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 8

- name: Restore local Maven repository from cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles( 'project.clj' ) }}
restore-keys: |
${{ runner.os }}-maven-
- name: Unit and Integration tests
run: lein eftest :all
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.appsflyer/aerospike-clj "2.0.7-SNAPSHOT"
(defproject com.appsflyer/aerospike-clj "3.0.0-SNAPSHOT"
:description "An Aerospike Clojure client."
:url "https://github.com/AppsFlyer/aerospike-clj"
:license {:name "Eclipse Public License"
Expand All @@ -14,7 +14,7 @@
:password :env/clojars_password
:sign-releases false}]]
:dependencies [[org.clojure/tools.logging "1.2.4"]
[com.aerospike/aerospike-client "4.4.15"]
[com.aerospike/aerospike-client "6.1.7"]
[funcool/promesa "8.0.450"]]
:profiles {:dev {:plugins [[jonase/eastwood "0.3.5"]
[lein-ancient "0.6.15"]
Expand Down
5 changes: 2 additions & 3 deletions src/main/clojure/aerospike_clj/policy.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns aerospike-clj.policy
(:import [com.aerospike.client AerospikeClient]
[com.aerospike.client.async EventPolicy]
#_{:clj-kondo/ignore [:unused-import]}
#_{:clj-kondo/ignore [:unused-import]}
[com.aerospike.client.policy Policy ClientPolicy WritePolicy RecordExistsAction
GenerationPolicy BatchPolicy CommitLevel
AuthMode ReadModeAP ReadModeSC Priority Replica]))
AuthMode ReadModeAP ReadModeSC Replica]))

(defmacro set-java [obj conf obj-name]
`(when (some? (get ~conf ~obj-name))
Expand All @@ -30,7 +30,6 @@
(set-java-enum p conf "ReadModeAP")
(set-java-enum p conf "ReadModeSC")
(set-java p conf "maxRetries")
(set-java-enum p conf "Priority")
(set-java-enum p conf "Replica")
(set-java p conf "sendKey")
(set-java p conf "sleepBetweenRetries")
Expand Down
13 changes: 5 additions & 8 deletions test/aerospike_clj/integration_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(:import [com.aerospike.client Value AerospikeClient]
[com.aerospike.client.cdt ListOperation ListPolicy ListOrder ListWriteFlags ListReturnType
MapOperation MapPolicy MapOrder MapWriteFlags MapReturnType CTX]
[com.aerospike.client.policy Priority ReadModeSC ReadModeAP Replica GenerationPolicy RecordExistsAction
[com.aerospike.client.policy ReadModeSC ReadModeAP Replica GenerationPolicy RecordExistsAction
WritePolicy BatchPolicy Policy]
[java.util HashMap ArrayList]
[java.util.concurrent ExecutionException]
Expand Down Expand Up @@ -529,15 +529,14 @@

(deftest default-read-policy
(let [rp (.getReadPolicyDefault ^AerospikeClient (.-client ^SimpleAerospikeClient *c*))]
(is (= Priority/DEFAULT (.priority rp))) ;; Priority of request relative to other transactions. Currently, only used for scans.
(is (= ReadModeAP/ONE (.readModeAP rp))) ;; Involve single node in the read operation.
;; Involve single node in the read operation.
(is (= Replica/SEQUENCE (.replica rp))) ;; Try node containing master partition first.
;; If connection fails, all commands try nodes containing replicated partitions.
;; If socketTimeout is reached, reads also try nodes containing replicated partitions,
;; but writes remain on master node.)))
;; This option requires ClientPolicy.requestProleReplicas to be enabled in order to function properly.
(is (= 30000 (.socketTimeout rp))) ;; 30 seconds default
(is (zero? (.totalTimeout rp))) ;; no time limit
(is (= 1000 (.totalTimeout rp))) ;; no time limit
(is (= 3000 (.timeoutDelay rp))) ;; no delay, connection closed on timeout
(is (= 2 (.maxRetries rp))) ;; initial attempt + 2 retries = 3 attempts
(is (zero? (.sleepBetweenRetries rp))) ;; do not sleep between retries
Expand All @@ -563,7 +562,6 @@

rp ^Policy (.getReadPolicyDefault ^AerospikeClient (.-client ^SimpleAerospikeClient c))
bp ^BatchPolicy (.getBatchPolicyDefault ^AerospikeClient (.-client ^SimpleAerospikeClient c))]
(is (= Priority/DEFAULT (.priority rp)))
(is (= ReadModeAP/ALL (.readModeAP rp)))
(is (= Replica/RANDOM (.replica rp)))
(is (= 1000 (.socketTimeout rp)))
Expand All @@ -586,8 +584,9 @@
;; If socketTimeout is reached, reads also try nodes containing replicated partitions,
;; but writes remain on master node.)))
;; This option requires ClientPolicy.requestProleReplicas to be enabled in order to function properly.
;; This option requires ClientPolicy.requestProleReplicas to be enabled in order to function properly.
(is (= 30000 (.socketTimeout rp))) ;; 30 seconds default
(is (zero? (.totalTimeout rp))) ;; no time limit
(is (= 1000 (.totalTimeout rp))) ;; no time limit
(is (= 3000 (.timeoutDelay rp))) ;; no delay, connection closed on timeout
(is (= 2 (.maxRetries rp))) ;; initial attempt + 2 retries = 3 attempts
(is (zero? (.sleepBetweenRetries rp))) ;; do not sleep between retries
Expand All @@ -606,7 +605,6 @@
"respondAllOps" true})})

wp ^WritePolicy (.getWritePolicyDefault ^AerospikeClient (.-client ^SimpleAerospikeClient c))]
(is (= Priority/DEFAULT (.priority wp)))
(is (= ReadModeAP/ONE (.readModeAP wp)))
(is (true? (.durableDelete wp)))
(is (= 1000 (.expiration wp)))
Expand Down Expand Up @@ -695,7 +693,6 @@
@(pt/put-multiple *c* [k k2 k3] (repeat _set) [10 20 30] (repeat ttl) conf)

@(pt/scan-set *c* aero-namespace _set {:callback callback})

(let [res @(pt/get-batch *c* [{:index k :set _set}
{:index k2 :set _set}
{:index k3 :set _set}])]
Expand Down

0 comments on commit ff9968a

Please sign in to comment.