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

Update the ConsistencyLevel of tracking records #57

Merged
merged 1 commit into from
Jul 31, 2024
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 @@ -15,11 +15,7 @@
*/
package org.commonjava.indy.service.tracking.data.cassandra;

import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.*;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.MappingManager;
import org.commonjava.indy.service.tracking.exception.ContentException;
Expand All @@ -41,6 +37,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import static com.datastax.driver.core.ConsistencyLevel.QUORUM;
import static org.commonjava.indy.service.tracking.data.cassandra.CassandraFoloUtil.TABLE_FOLO;
import static org.commonjava.indy.service.tracking.data.cassandra.CassandraFoloUtil.TABLE_FOLO_LEGACY;
import static org.commonjava.indy.service.tracking.data.cassandra.DtxTrackingRecord.fromCassandraRow;
Expand Down Expand Up @@ -107,23 +104,28 @@ public void init()

getTrackingRecord = session.prepare( "SELECT * FROM " + keySpace + "." + TABLE_FOLO
+ " WHERE tracking_key=? AND store_key=? AND path=? AND store_effect=?;" );
getTrackingRecord.setConsistencyLevel( QUORUM );

getTrackingKeys = session.prepare( "SELECT distinct tracking_key FROM " + keySpace + "." + TABLE_FOLO + ";" );
getTrackingKeys.setConsistencyLevel( QUORUM );

getLegacyTrackingKeys = session.prepare(
"SELECT distinct tracking_key FROM " + keySpace + "." + TABLE_FOLO_LEGACY + ";" );

getTrackingRecordsByTrackingKey =
session.prepare( "SELECT * FROM " + keySpace + "." + TABLE_FOLO + " WHERE tracking_key=?;" );
getTrackingRecordsByTrackingKey.setConsistencyLevel( QUORUM );

getLegacyTrackingRecordsByTrackingKey = session.prepare(
"SELECT * FROM " + keySpace + "." + TABLE_FOLO_LEGACY + " WHERE tracking_key=?;" );
getLegacyTrackingRecordsByTrackingKey.setConsistencyLevel( QUORUM );

isTrackingRecordExist = session.prepare(
"SELECT count(*) FROM " + keySpace + "." + TABLE_FOLO + " WHERE tracking_key=?;" );

deleteTrackingRecordsByTrackingKey =
session.prepare( "DELETE FROM " + keySpace + "." + TABLE_FOLO + " WHERE tracking_key=?;" );
deleteTrackingRecordsByTrackingKey.setConsistencyLevel( QUORUM );

logger.info( "-- Cassandra Folo Records Keyspace and Tables created" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import static org.commonjava.indy.service.tracking.data.cassandra.CassandraFoloUtil.TABLE_FOLO;

@Table( name = TABLE_FOLO )
@Table( name = TABLE_FOLO, readConsistency = "QUORUM", writeConsistency = "QUORUM" )
public class DtxTrackingRecord
{

Expand Down
Loading