Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GORA-676 Upgrade Aerospike 5.0.6 #237

Merged
merged 1 commit into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@

import com.aerospike.client.policy.GenerationPolicy;
import com.aerospike.client.policy.Policy;
import com.aerospike.client.policy.ReadModeAP;
import com.aerospike.client.policy.ReadModeSC;
import com.aerospike.client.policy.RecordExistsAction;
import com.aerospike.client.policy.CommitLevel;
import com.aerospike.client.policy.Priority;
import com.aerospike.client.policy.ConsistencyLevel;
import com.aerospike.client.policy.Replica;
import com.aerospike.client.policy.WritePolicy;
import org.jdom.Document;
Expand Down Expand Up @@ -118,14 +119,13 @@ public void readMappingFile(String mappingFile, Class<?> keyClass, Class<?> pers
else if (policy.equals(AerospikePolicyConst.READ_POLICY_NAME)) {

Policy readPolicy = new Policy();
if (policyElement.getAttributeValue(AerospikePolicyConst.PRIORITY_NAME) != null) {
readPolicy.priority = getPriority(
policyElement.getAttributeValue(AerospikePolicyConst.PRIORITY_NAME));
if (policyElement.getAttributeValue(AerospikePolicyConst.READ_MODE_AP_NAME) != null) {
readPolicy.readModeAP = getReadModeAP(policyElement
.getAttributeValue(AerospikePolicyConst.READ_MODE_AP_NAME));
}
if (policyElement.getAttributeValue(AerospikePolicyConst.CONSISTENCY_LEVEL_NAME)
!= null) {
readPolicy.consistencyLevel = getConsistencyLevel(
policyElement.getAttributeValue(AerospikePolicyConst.CONSISTENCY_LEVEL_NAME));
if (policyElement.getAttributeValue(AerospikePolicyConst.READ_MODE_SC_NAME) != null) {
readPolicy.readModeSC = getReadModeSC(policyElement
.getAttributeValue(AerospikePolicyConst.READ_MODE_SC_NAME));
}
if (policyElement.getAttributeValue(AerospikePolicyConst.REPLICA_POLICY_NAME) != null) {
readPolicy.replica = getReplicaPolicy(
Expand Down Expand Up @@ -307,24 +307,30 @@ private Priority getPriority(String priority) {
return Priority.DEFAULT;
}

/**
* Returns the corresponding consistency level from the user specified consistency level name.
* The default value is CONSISTENCY_ONE
*
* @param consistencyLevel user specified consistency level name
* @return corresponding consistency level
*/
private ConsistencyLevel getConsistencyLevel(String consistencyLevel) {
if (consistencyLevel == null)
return ConsistencyLevel.CONSISTENCY_ONE;
private ReadModeAP getReadModeAP(String readModeAP) {
if (readModeAP == null)
return ReadModeAP.ONE;

for (ReadModeAP readModeAPEnum : ReadModeAP.values()) {
if (readModeAP.equalsIgnoreCase(readModeAPEnum.toString())) {
return readModeAPEnum;
}
}
LOG.warn("Invalid consistency level provided, using the default ReadModeAP level.");
return ReadModeAP.ONE;
}

private ReadModeSC getReadModeSC(String readModeSC) {
if (readModeSC == null)
return ReadModeSC.SESSION;

for (ConsistencyLevel consistencyLevelEnum : ConsistencyLevel.values()) {
if (consistencyLevel.equalsIgnoreCase(consistencyLevelEnum.toString())) {
return consistencyLevelEnum;
for (ReadModeSC readModeSCEnum : ReadModeSC.values()) {
if (readModeSC.equalsIgnoreCase(readModeSCEnum.toString())) {
return readModeSCEnum;
}
}
LOG.warn("Invalid consistency level provided, using the default consistency level.");
return ConsistencyLevel.CONSISTENCY_ONE;
LOG.warn("Invalid consistency level provided, using the default ReadModeSC level.");
return ReadModeSC.SESSION;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public class AerospikePolicyConst {

public static final String READ_POLICY_NAME = "read";

public static final String PRIORITY_NAME = "priority";
public static final String READ_MODE_AP_NAME = "readModeAP";

public static final String CONSISTENCY_LEVEL_NAME = "consistencyLevel";
public static final String READ_MODE_SC_NAME = "readModeSC";

public static final String REPLICA_POLICY_NAME = "replica";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class TestAerospikeStoreCountQuery {

private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:4.3.1.4";
private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:5.5.0.7";

@ClassRule
public static GenericContainer aerospikeContainer = new GenericContainer(DOCKER_CONTAINER_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class TestAerospikeStoreMapReduceSerialization {

private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:4.3.1.4";
private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:5.5.0.7";

@ClassRule
public static GenericContainer aerospikeContainer = new GenericContainer(DOCKER_CONTAINER_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
public class TestAerospikeStoreWordCount {

private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:4.3.1.4";
private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:5.5.0.7";

@ClassRule
public static GenericContainer aerospikeContainer = new GenericContainer(DOCKER_CONTAINER_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public class TestAerospikeStore extends DataStoreTestBase {

private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:4.3.1.4";
private static final String DOCKER_CONTAINER_NAME = "aerospike/aerospike-server:5.5.0.7";

@ClassRule
public static GenericContainer aerospikeContainer = new GenericContainer(DOCKER_CONTAINER_NAME)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@
<flink.version>1.6.2</flink.version>

<spark.version>2.2.1</spark.version>
<aerospike.version>4.2.2</aerospike.version>
<aerospike.version>5.0.6</aerospike.version>
<!-- Misc Dependencies -->
<guava.version>13.0</guava.version>
<commons-lang.version>2.6</commons-lang.version>
Expand Down