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

Lighten the load of cluster updates using CL.LOCAL_ONE #1504

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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 @@ -117,6 +117,10 @@ public Collection<Cluster> getClusters() {

@Override
public boolean addCluster(Cluster cluster) {
return addCluster(cluster, ConsistencyLevel.QUORUM);
}

public boolean addCluster(Cluster cluster, ConsistencyLevel consistencyLevel) {
assert addClusterAssertions(cluster);
try {
session.execute(
Expand All @@ -126,7 +130,7 @@ public boolean addCluster(Cluster cluster) {
cluster.getSeedHosts(),
objectMapper.writeValueAsString(cluster.getProperties()),
cluster.getState().name(),
Date.valueOf(cluster.getLastContact())));
Date.valueOf(cluster.getLastContact())).setConsistencyLevel(consistencyLevel));
} catch (IOException e) {
LOG.error("Failed serializing cluster information for database write", e);
throw new IllegalStateException(e);
Expand All @@ -136,7 +140,7 @@ public boolean addCluster(Cluster cluster) {

@Override
public boolean updateCluster(Cluster newCluster) {
return addCluster(newCluster);
return addCluster(newCluster, ConsistencyLevel.LOCAL_ONE);
}

public boolean addClusterAssertions(Cluster cluster) {
Expand Down
Loading