in neptune-export/src/main/java/com/amazonaws/services/neptune/cluster/AddCloneTask.java [246:312]
private DBClusterParameterGroup createDbClusterParameterGroup(NeptuneClusterMetadata sourceClusterMetadata,
AmazonNeptune neptune) {
DBClusterParameterGroup dbClusterParameterGroup;
dbClusterParameterGroup = neptune.createDBClusterParameterGroup(
new CreateDBClusterParameterGroupRequest()
.withDBClusterParameterGroupName(String.format("%s-db-cluster-params", targetClusterId))
.withDescription(String.format("%s DB Cluster Parameter Group", targetClusterId))
.withDBParameterGroupFamily("neptune1")
.withTags(getTags(sourceClusterMetadata.clusterId())));
String neptuneStreamsParameterValue = sourceClusterMetadata.isStreamEnabled() ? "1" : "0";
try {
neptune.modifyDBClusterParameterGroup(new ModifyDBClusterParameterGroupRequest()
.withDBClusterParameterGroupName(dbClusterParameterGroup.getDBClusterParameterGroupName())
.withParameters(
new Parameter()
.withParameterName("neptune_enforce_ssl")
.withParameterValue("1")
.withApplyMethod(ApplyMethod.PendingReboot),
new Parameter()
.withParameterName("neptune_query_timeout")
.withParameterValue("2147483647")
.withApplyMethod(ApplyMethod.PendingReboot),
new Parameter()
.withParameterName("neptune_streams")
.withParameterValue(neptuneStreamsParameterValue)
.withApplyMethod(ApplyMethod.PendingReboot)));
} catch (AmazonNeptuneException e) {
neptune.modifyDBClusterParameterGroup(new ModifyDBClusterParameterGroupRequest()
.withDBClusterParameterGroupName(dbClusterParameterGroup.getDBClusterParameterGroupName())
.withParameters(
new Parameter()
.withParameterName("neptune_query_timeout")
.withParameterValue("2147483647")
.withApplyMethod(ApplyMethod.PendingReboot),
new Parameter()
.withParameterName("neptune_streams")
.withParameterValue(neptuneStreamsParameterValue)
.withApplyMethod(ApplyMethod.PendingReboot)));
}
List<Parameter> dbClusterParameters = neptune.describeDBClusterParameters(
new DescribeDBClusterParametersRequest()
.withDBClusterParameterGroupName(dbClusterParameterGroup.getDBClusterParameterGroupName()))
.getParameters();
while (dbClusterParameters.stream().noneMatch(parameter ->
parameter.getParameterName().equals("neptune_query_timeout") &&
parameter.getParameterValue().equals("2147483647"))) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
dbClusterParameters = neptune.describeDBClusterParameters(
new DescribeDBClusterParametersRequest()
.withDBClusterParameterGroupName(dbClusterParameterGroup.getDBClusterParameterGroupName()))
.getParameters();
}
System.err.println(String.format("DB cluster parameter group : %s", dbClusterParameterGroup.getDBClusterParameterGroupName()));
return dbClusterParameterGroup;
}