-
Notifications
You must be signed in to change notification settings - Fork 880
feat: PostgreSQL support for DomainAudit #7665
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
base: master
Are you sure you want to change the base?
feat: PostgreSQL support for DomainAudit #7665
Conversation
Signed-off-by: Joanna Lau <[email protected]>
- Created data structures of `DomainAuditLogRow` and `DomainAuditLogFilter` - Implemented sqlplugin interfaces for `InsertIntoDomainAuditLog` and `SelectFromDomainAuditLogs` functions - Implemented `InsertIntoDomainAuditLog` and `SelectFromDomainAuditLogs` functions in Postgresql - Updated SQL factory to create `newSQLDomainAuditStore` Signed-off-by: Joanna Lau <[email protected]>
| // InsertIntoDomainAuditLog inserts a single row into domain_audit_log table | ||
| func (mdb *DB) InsertIntoDomainAuditLog(ctx context.Context, row *sqlplugin.DomainAuditLogRow) (sql.Result, error) { | ||
| // TODO: Implement this function | ||
| return nil, nil | ||
| } | ||
|
|
||
| // SelectFromDomainAuditLogs returns audit log entries for a domain, operation type, and time range (optional) | ||
| func (mdb *DB) SelectFromDomainAuditLogs( | ||
| ctx context.Context, | ||
| filter *sqlplugin.DomainAuditLogFilter, | ||
| ) ([]*sqlplugin.DomainAuditLogRow, error) { | ||
| // TODO: Implement this function | ||
| return nil, nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details
The MySQL implementation of InsertIntoDomainAuditLog and SelectFromDomainAuditLogs returns nil, nil without any error, which silently fails. This could lead to data loss since callers would believe the operation succeeded when in fact no data was persisted.
Impact: If MySQL is used as the persistence layer and domain audit logs are enabled, the caller will think the audit log was created successfully, but no data will be stored. This is a silent failure mode that could go undetected in production.
Suggested fix: Return an appropriate error indicating the feature is not yet implemented:
func (mdb *DB) InsertIntoDomainAuditLog(ctx context.Context, row *sqlplugin.DomainAuditLogRow) (sql.Result, error) {
return nil, fmt.Errorf("domain audit log is not implemented for MySQL")
}
func (mdb *DB) SelectFromDomainAuditLogs(ctx context.Context, filter *sqlplugin.DomainAuditLogFilter) ([]*sqlplugin.DomainAuditLogRow, error) {
return nil, fmt.Errorf("domain audit log is not implemented for MySQL")
}Alternatively, consider adding a feature flag or capability check that allows callers to verify if domain audit is supported by the persistence layer.
Was this helpful? React with 👍 / 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MySQL support is not part of this PR; these functions need to be implemented to pass interface checks
Signed-off-by: Joanna Lau <[email protected]>
🔍 CI failure analysis for af86213: Good news: PostgreSQL integration tests now passing after UUID→BYTEA fix! Only remaining failure is the missing breaking change template in PR description.Status Update for Commit af86213PostgreSQL Integration Tests: ✅ SUCCESS The PostgreSQL integration tests (job 62164863742) have completed successfully! This is a significant improvement from earlier test runs. The schema change from UUID to BYTEA for Previous Issue Resolution:
These errors are no longer occurring, indicating the UUID→BYTEA conversion properly handles the binary UUID data. Remaining Issue: Breaking Change TemplateThe only CI failure is the
DetailsAll other CI checks have passed:
Note: Job ID 62164863807 mentioned in the prompt does not exist. The actual postgres integration test job ID is 62164863742 and it passed successfully. Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
What changed?
Implement SQL plugin interface and add PostgreSQL support for DomainAudit.
domain_audit_logtable in Postgresql schemaDomainAuditLogRowandDomainAuditLogFilterin sqlpluginInsertIntoDomainAuditLogandSelectFromDomainAuditLogsfunctionsInsertIntoDomainAuditLogandSelectFromDomainAuditLogsfunctions in PostgresqlnewSQLDomainAuditStoreFixes: #7602
Why?
DomainAudit allows all modifications made to a domain (e.g failovers) to be stored and retrieved. This has previously only been supported by NoSQL databases (Cassandra, MongoDB, DynamoDB). The SQL plugin is now configured to handle DomainAudit requests, so other SQL databases can also be easily configured to support DomainAudit. PostgreSQL support for DomainAudit is now added.
How did you test it?
go test -v ./common/persistence/sql -run TestCreateDomainAuditLog TestGetDomainAuditLogs TestFactoryNewDomainAuditStore TestInsertIntoDomainAuditLog TestSelectFromDomainAuditLogs TestGetDataBlobEncoding TestGetDataBlobBytesTestPostgresSQLDomainAuditPersistenceon github actionsPotential risks
Release notes
Added PostgreSQL support for DomainAudit
Documentation Changes
N/A
Potential Breaking change
Detailed Description
[In-depth description of the changes made to the schema or interfaces, specifying new fields, removed fields, or modified data structures]
domain_audit_logtable in Postgresql schemaDomainAuditLogRowandDomainAuditLogFilterin sqlpluginInsertIntoDomainAuditLogandSelectFromDomainAuditLogsfunctionsInsertIntoDomainAuditLogandSelectFromDomainAuditLogsfunctions in PostgresqlnewSQLDomainAuditStoreImpact Analysis
Testing Plan
go test -v ./common/persistence/sql -run TestCreateDomainAuditLog TestGetDomainAuditLogs TestFactoryNewDomainAuditStore TestInsertIntoDomainAuditLog TestSelectFromDomainAuditLogs TestGetDataBlobEncoding TestGetDataBlobBytesTestPostgresSQLDomainAuditPersistenceon github actionsRollout Plan
nil, nilshould revert effects of all changesReviewer Validation
PR Description Quality (check these before reviewing code):
go testinvocation)