Skip to content

Commit

Permalink
don't include raw_block in Cassandra
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-iohk committed Feb 28, 2024
1 parent 6158c73 commit 5c497c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
19 changes: 11 additions & 8 deletions src/delegation_backend/aws_keyspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,17 @@ type KeyspaceContext struct {
// Insert a submission into the Keyspaces database
func (kc *KeyspaceContext) insertSubmission(submission *Submission) error {
return ExponentialBackoff(func() error {
if err := kc.tryInsertSubmission(submission, true); err != nil {
if isRowSizeError(err) {
kc.Log.Warnf("KeyspaceSave: Block too large, inserting without raw_block")
return kc.tryInsertSubmission(submission, false)
}
return err
}
return nil
// if err := kc.tryInsertSubmission(submission, true); err != nil {
// if isRowSizeError(err) {
// kc.Log.Warnf("KeyspaceSave: Block too large, inserting without raw_block")
// return kc.tryInsertSubmission(submission, false)
// }
// return err
// }
// return nil

// don't include raw_block in Cassandra
return kc.tryInsertSubmission(submission, false)
}, maxRetries, initialBackoff)
}

Expand Down
8 changes: 4 additions & 4 deletions src/integration_tests/aws_keyspaces_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import (
)

func checkForSubmissions(session *gocql.Session, keyspace, date string) (bool, error) {
var submitter, blockHash, rawBlock string
var submitter, blockHash string

query := fmt.Sprintf("SELECT submitter, block_hash, raw_block FROM %s.submissions WHERE submitted_at_date='%s' LIMIT 1 ALLOW FILTERING", keyspace, date)
query := fmt.Sprintf("SELECT submitter, block_hash FROM %s.submissions WHERE submitted_at_date='%s' LIMIT 1 ALLOW FILTERING", keyspace, date)

if err := session.Query(query).Scan(&submitter, &blockHash, &rawBlock); err != nil {
if err := session.Query(query).Scan(&submitter, &blockHash); err != nil {
if err == gocql.ErrNotFound {
return false, nil
}
return false, err
}

if submitter == "" || blockHash == "" || rawBlock == "" {
if submitter == "" || blockHash == "" {
log.Printf("Found submission for today with empty required fields\n")
return false, nil // Found a row but required fields are empty
}
Expand Down

0 comments on commit 5c497c2

Please sign in to comment.