Skip to content

Commit

Permalink
Merge pull request #617 from aerospike/Nodejs-Release-5.12.0
Browse files Browse the repository at this point in the history
Nodejs-Release-5.12.0
  • Loading branch information
DomPeliniAerospike authored Apr 22, 2024
2 parents 8680a05 + d6255ae commit b205634
Show file tree
Hide file tree
Showing 25 changed files with 1,259 additions and 442 deletions.
62 changes: 62 additions & 0 deletions .github/actions/run-ee-server/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Run EE Server'
description: 'Run EE server'
inputs:
# All inputs in composite actions are strings
use-server-rc:
required: true
default: false
server-tag:
required: true
default: 'latest'
# Github Composite Actions can't access secrets
# so we need to pass them in as inputs
docker-hub-username:
required: false
docker-hub-password:
required: false

runs:
using: "composite"
steps:
- name: Create config folder to store configs in
run: mkdir configs
shell: bash

- name: Use release server
if: ${{ inputs.use-server-rc == 'false' }}
run: echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise" >> $GITHUB_ENV
shell: bash

- name: Use release candidate server
if: ${{ inputs.use-server-rc == 'true' }}
run: echo "SERVER_IMAGE=aerospike/aerospike-server-enterprise-rc" >> $GITHUB_ENV
shell: bash

- name: Log into Docker Hub to get server RC
if: ${{ inputs.use-server-rc == 'true' }}
run: docker login --username ${{ inputs.docker-hub-username }} --password ${{ inputs.docker-hub-password }}
shell: bash

- name: Get default aerospike.conf from Docker server EE container
run: |
docker run -d --name aerospike -p 3000-3002:3000-3002 $SERVER_IMAGE:${{ inputs.server-tag }}
sleep 5
docker cp aerospike:/etc/aerospike/aerospike.conf ./configs/aerospike.conf
docker container stop aerospike
docker container rm aerospike
shell: bash

- name: Enable security features using aerospike.conf
# Security stanza
run: echo -e "security {\n\tenable-quotas true\n}\n" >> ./aerospike.conf
working-directory: ./configs
shell: bash

- name: Run enterprise edition server
run: docker run -tid -v $(pwd)/configs:/opt/aerospike/etc -p 3000:3000 --name aerospike $SERVER_IMAGE:${{ inputs.server-tag }} asd --config-file /opt/aerospike/etc/aerospike.conf
shell: bash

- name: Create user in database for tests
# Use default admin user to create another user for testing
run: docker exec aerospike asadm --user admin --password admin --enable -e "manage acl create user superuser password superuser roles read-write-udf sys-admin user-admin data-admin"
shell: bash
12 changes: 6 additions & 6 deletions .github/workflows/build-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ jobs:

- name: Modify the package.json
run: |
npm install -g json
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
run: |
mkdir -p testDir
cd testDir
npm install ..
sudo npm install ..
test-yarn-install:
runs-on: ubuntu-latest
Expand All @@ -455,7 +455,7 @@ jobs:

- name: Modify the package.json
run: |
npm install -g json
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
Expand Down Expand Up @@ -483,7 +483,7 @@ jobs:

- name: Modify the package.json
run: |
npm install -g json
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
Expand Down Expand Up @@ -512,7 +512,7 @@ jobs:

- name: Modify the package.json
run: |
npm install -g json
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
Expand Down Expand Up @@ -555,7 +555,7 @@ jobs:

- name: Modify the package.json
run: |
npm install -g json
sudo npm install -g json
json -I -f package.json -e "this.scripts.install=\"npm-run-all removeExtraBinaries build\""
- name: Run tests
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ jobs:

- name: Run lowest supported server
run: |
SERVER_VERSION=$(curl -s "https://registry.hub.docker.com/v2/repositories/aerospike/aerospike-server/tags?page_size=100" | jq '.results[] | select(.name | startswith("6.0")).name' -r | head -n 1)
SERVER_VERSION=$(curl -s "https://registry.hub.docker.com/v2/repositories/aerospike/aerospike-server/tags?page_size=100" | jq '.results[] | select(.name | startswith("6.1")).name' -r | head -n 1)
docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server:$SERVER_VERSION
- name: Wait for database to be ready
Expand Down Expand Up @@ -299,13 +299,19 @@ jobs:
- name: Download aerospike-client-python repository
run: git clone https://github.com/aerospike/aerospike-client-python.git

- name: debugging
run: |
ls;
ls .github;
docker ps;
- name: Run ee server
uses: ./aerospike-client-python/.github/actions/run-ee-server/
uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ contains(github.event.pull_request.labels.*.name, 'new-server-features') }}
docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }}
docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }}


- name: Wait for server to start
run: sleep 5
Expand Down Expand Up @@ -344,7 +350,10 @@ jobs:
run: npm install mocha

- name: install valgrind
run: sudo apt install valgrind
run: |
sudo apt-get update;
sudo apt update;
sudo apt install valgrind;
- name: Install client
#fix the convention here
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "aerospike-client-c"]
path = aerospike-client-c
url = https://github.com/aerospike/aerospike-client-c.git
branch = master
branch = stage
2 changes: 1 addition & 1 deletion aerospike-client-c
Submodule aerospike-client-c updated 52 files
+3 −0 Makefile
+1 −1 modules/common
+1 −1 modules/mod-lua
+2 −0 src/include/aerospike/aerospike.h
+27 −3 src/include/aerospike/aerospike_stats.h
+3 −3 src/include/aerospike/as_address.h
+11 −2 src/include/aerospike/as_async.h
+6 −6 src/include/aerospike/as_bit_operations.h
+1 −1 src/include/aerospike/as_cdt_ctx.h
+173 −11 src/include/aerospike/as_cluster.h
+7 −5 src/include/aerospike/as_command.h
+9 −3 src/include/aerospike/as_event_internal.h
+52 −3 src/include/aerospike/as_exp.h
+66 −0 src/include/aerospike/as_latency.h
+3 −2 src/include/aerospike/as_map_operations.h
+191 −0 src/include/aerospike/as_metrics.h
+81 −0 src/include/aerospike/as_metrics_writer.h
+89 −3 src/include/aerospike/as_node.h
+153 −4 src/include/aerospike/as_policy.h
+1 −1 src/include/aerospike/version.h
+10 −1 src/main/aerospike/aerospike.c
+67 −90 src/main/aerospike/aerospike_batch.c
+37 −16 src/main/aerospike/aerospike_key.c
+20 −4 src/main/aerospike/aerospike_query.c
+13 −3 src/main/aerospike/aerospike_scan.c
+38 −40 src/main/aerospike/aerospike_stats.c
+3 −3 src/main/aerospike/as_bit_operations.c
+150 −6 src/main/aerospike/as_cluster.c
+40 −8 src/main/aerospike/as_command.c
+58 −7 src/main/aerospike/as_event.c
+22 −16 src/main/aerospike/as_event_ev.c
+22 −16 src/main/aerospike/as_event_event.c
+5 −1 src/main/aerospike/as_event_uv.c
+42 −0 src/main/aerospike/as_latency.c
+52 −0 src/main/aerospike/as_metrics.c
+688 −0 src/main/aerospike/as_metrics_writer.c
+109 −4 src/main/aerospike/as_node.c
+3 −3 src/main/aerospike/as_pipe.c
+1 −1 src/main/aerospike/version.c
+55 −1 src/test/aerospike_batch/batch.c
+5 −5 src/test/aerospike_bit/bit.c
+60 −1 src/test/aerospike_key/key_basics.c
+62 −1 src/test/aerospike_key/key_operate.c
+77 −162 src/test/aerospike_map/map_sort.c
+15 −2 src/test/aerospike_test.c
+1 −1 vs/aerospike-client-c-libevent.nuspec
+1 −1 vs/aerospike-client-c-libuv.nuspec
+1 −1 vs/aerospike-client-c.nuspec
+6 −0 vs/aerospike/aerospike.vcxproj
+18 −0 vs/aerospike/aerospike.vcxproj.filters
+1 −1 vs/props/base.props
+24 −0 xcode/aerospike.xcodeproj/project.pbxproj
3 changes: 2 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@
'src/main/enums/config_enum.cc',
'src/main/enums/exp_enum.cc',
'src/main/enums/batch_type.cc',
'src/main/enums/query_duration.cc',
'src/main/enums/privilege_code.cc',
'src/main/enums/exp_read_flags.cc',
'src/main/enums/exp_write_flags.cc',
'src/main/stats.cc',
'src/main/util/conversions.cc',
'src/main/util/conversions_batch.cc',
'src/main/util/log.cc'
'src/main/util/log.cc',
],
'configurations': {
'Release': {
Expand Down
16 changes: 16 additions & 0 deletions lib/policies/batch_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ class BatchPolicy extends BasePolicy {
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
*/
this.readModeSC = props.readModeSC

/**
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
* within this interval of the record’s end of life will generate a touch.
*
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
* recent write) will result in a touch, resetting the TTL to another 10 hours.
* *
* @type number
* @default 0
*/
this.readTouchTtlPercent = props.readTouchTtlPercent

/**
* Determine if batch commands to each server are run in parallel threads.
*
Expand Down
15 changes: 15 additions & 0 deletions lib/policies/batch_read_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ class BatchReadPolicy {
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
*/
this.readModeSC = props.readModeSC

/**
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
* within this interval of the record’s end of life will generate a touch.
*
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
* recent write) will result in a touch, resetting the TTL to another 10 hours.
* *
* @type number
* @default 0
*/
this.readTouchTtlPercent = props.readTouchTtlPercent
}
}

Expand Down
15 changes: 15 additions & 0 deletions lib/policies/operate_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ class OperatePolicy extends BasePolicy {
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
*/
this.readModeSC = props.readModeSC

/**
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
* within this interval of the record’s end of life will generate a touch.
*
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
* recent write) will result in a touch, resetting the TTL to another 10 hours.
* *
* @type number
* @default 0
*/
this.readTouchTtlPercent = props.readTouchTtlPercent
}
}

Expand Down
10 changes: 10 additions & 0 deletions lib/policies/query_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ class QueryPolicy extends BasePolicy {
* @override
*/
this.totalTimeout = props.totalTimeout

/**
* Expected query duration. The server treats the query in different ways depending on the expected duration.
* This field is ignored for aggregation queries, background queries and server versions < 6.0.
*
* @see {@link module:aerospike/policy.queryDuration} for supported policy values.
* @type {@link module:aerospike/policy.queryDuration}
* @default {@link module:aerospike/policy.queryDuration.LONG}
*/
this.expectedDuration = props.expectedDuration
}
}

Expand Down
15 changes: 15 additions & 0 deletions lib/policies/read_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ class ReadPolicy extends BasePolicy {
*/
this.readModeSC = props.readModeSC

/**
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
* within this interval of the record’s end of life will generate a touch.
*
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
* recent write) will result in a touch, resetting the TTL to another 10 hours.
* *
* @type number
* @default 0
*/
this.readTouchTtlPercent = props.readTouchTtlPercent

/**
* Should CDT data types (Lists / Maps) be deserialized to JS data types
* (Arrays / Objects) or returned as raw bytes (Buffer).
Expand Down
8 changes: 8 additions & 0 deletions lib/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ exports.readModeSC = as.policy.readModeSC
*/
exports.commitLevel = as.policy.commitLevel

/**
* The {@link module:aerospike/policy.queryDuration|aerospike/policy.query_duration}
* module contains a list of query duration enumerations.
*
* @summary {@link module:aerospike/policy.queryDuration|aerospike/policy.query_duration} module
*/
exports.queryDuration = require('./query_duration')

/**
* A base class extended to client policies.
*
Expand Down
71 changes: 71 additions & 0 deletions lib/query_duration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// *****************************************************************************
// Copyright 2022-2023 Aerospike, Inc.
//
// 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.
// *****************************************************************************

'use strict'

const as = require('bindings')('aerospike.node')
const queryDuration = as.queryDuration

/**
* @module aerospike/queryDuration
*
* @description Expected query duration. The server treats the query in different ways depending on the expected duration.
* This enum is ignored for aggregation (UDF) queries, background queries and server versions < 6.0.
*/

// ========================================================================
// Constants
// ========================================================================
module.exports = {
/**
* The query is expected to return more than 100 records per node. The server optimizes for a
* large record set in the following ways:
* <ul>
* <li>Allow query to be run in multiple threads using the server's query threading configuration.</li>
* <li>Do not relax read consistency for AP namespaces.</li>
* <li>Add the query to the server's query monitor.</li>
* <li>Do not add the overall latency to the server's latency histogram.</li>
* <li>Do not allow server timeouts.</li>
* </ul>
*
* @const {number}
*/
LONG: queryDuration.LONG,

/**
* The query is expected to return less than 100 records per node. The server optimizes for a
* small record set in the following ways:
* <ul>
* <li>Always run the query in one thread and ignore the server's query threading configuration.</li>
* <li>Allow query to be inlined directly on the server's service thread.</li>
* <li>Relax read consistency for AP namespaces.</li>
* <li>Do not add the query to the server's query monitor.</li>
* <li>Add the overall latency to the server's latency histogram.</li>
* <li>Allow server timeouts. The default server timeout for a short query is 1 second.</li>
* </ul>
*
* @const {number}
*/
SHORT: queryDuration.SHORT,

/**
* Treat query as a LONG query, but relax read consistency for AP namespaces.
* This value is treated exactly like LONG for server versions &lt; 7.1.
*
* @const {number}
*/
LONG_RELAX_AP: queryDuration.LONG_RELAX_AP
}
Loading

0 comments on commit b205634

Please sign in to comment.