Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

DeleteDestination does not apply TTL on some fields #202

Merged
merged 2 commits into from
May 11, 2017
Merged
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
11 changes: 6 additions & 5 deletions clients/metadata/metadata_cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ const (
columnZoneConfigs + `: ?}`

sqlInsertDstByUUID = `INSERT INTO ` + tableDestinations +
`(` + columnUUID + `, ` + columnIsMultiZone + `, ` + columnDestination + `, ` + columnKafkaCluster + `, ` + columnKafkaTopics + `, ` + columnDLQConsumerGroup + `) ` +
` VALUES (?, ?, ` + sqlDstType + `, ?, ?, ?)`
`(` + columnUUID + `, ` + columnIsMultiZone + `, ` + columnDestination + `, ` + columnKafkaCluster + `, ` + columnKafkaTopics + `, ` + columnDLQConsumerGroup + `, ` + columnDLQPurgeBefore + `, ` + columnDLQMergeBefore + `) ` +
` VALUES (?, ?, ` + sqlDstType + `, ?, ?, ?, ?, ?)`

sqlInsertDstByPath = `INSERT INTO ` + tableDestinationsByPath +
`(` +
Expand Down Expand Up @@ -385,9 +385,7 @@ const (
sqlDeleteDst = `DELETE FROM ` + tableDestinationsByPath +
` WHERE ` + columnDirectoryUUID + `=? and ` + columnPath + `=?`

sqlDeleteDstUUID = `INSERT INTO ` + tableDestinations +
`(` + columnUUID + `, ` + columnIsMultiZone + `, ` + columnDestination + `, ` + columnDLQConsumerGroup + `, ` + columnDLQPurgeBefore + `, ` + columnDLQMergeBefore + `) ` +
` VALUES (?, ?, ` + sqlDstType + `, ?, ?, ?) USING TTL ?`
sqlDeleteDstUUID = sqlInsertDstByUUID + ` USING TTL ?`
)

// CreateDestination implements the corresponding TChanMetadataServiceClient API
Expand Down Expand Up @@ -433,6 +431,7 @@ func (s *CassandraMetadataService) CreateDestinationUUID(ctx thrift.Context, uui
request.KafkaCluster,
request.KafkaTopics,
request.DLQConsumerGroupUUID, // may be nil
int64(0), int64(0), // dlq_{purge,merge}_before default to '0'
).Exec(); err != nil {
return nil, &shared.InternalServiceError{
Message: fmt.Sprintf("CreateDestination failure while inserting into destinations: %v", err),
Expand Down Expand Up @@ -879,6 +878,8 @@ func (s *CassandraMetadataService) DeleteDestinationUUID(ctx thrift.Context, del
existing.GetChecksumOption(),
existing.GetIsMultiZone(),
marshalDstZoneConfigs(existing.GetZoneConfigs()),
existing.KafkaCluster,
existing.KafkaTopics,
existing.DLQConsumerGroupUUID, // May be nil
existing.DLQPurgeBefore, // May be nil
existing.DLQMergeBefore, // May be nil
Expand Down