Skip to content

Commit 7b58a9e

Browse files
authored
fix: make crdb_internal.gossip_nodes optional to handle virtual clusters (#2)
1 parent ba3050a commit 7b58a9e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/export/exporter.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,16 @@ type Table struct {
7575
Name string
7676
// TimeColumn is the column name used for time-based filtering (empty if not applicable)
7777
TimeColumn string
78+
// Optional indicates that export failures should be logged as warnings rather than errors.
79+
// Use this for tables that may not be available in all cluster configurations (e.g. Cloud virtual clusters).
80+
Optional bool
7881
}
7982

8083
var exportTables = []Table{
8184
Table{Database: "crdb_internal", Name: "statement_statistics", TimeColumn: "aggregated_ts"},
8285
Table{Database: "crdb_internal", Name: "transaction_statistics", TimeColumn: "aggregated_ts"},
8386
Table{Database: "crdb_internal", Name: "transaction_contention_events", TimeColumn: "collection_ts"},
84-
Table{Database: "crdb_internal", Name: "gossip_nodes", TimeColumn: ""},
87+
Table{Database: "crdb_internal", Name: "gossip_nodes", TimeColumn: "", Optional: true},
8588
Table{Database: "", Name: "crdb_internal.table_indexes", TimeColumn: ""}, // Use "" to query across all databases
8689
}
8790

@@ -248,9 +251,12 @@ func (exporter *Exporter) Export() error {
248251

249252
logrus.Info("starting table export")
250253
for _, table := range exportTables {
251-
252254
logrus.Infof(" exporting table '%s.%s'", table.Database, table.Name)
253-
if err := exporter.exportTable(ctx, tempDir, table, agg); err != nil { // exportTableData(ctx, conn, dbName, tableName, dataFile); err != nil {
255+
if err := exporter.exportTable(ctx, tempDir, table, agg); err != nil {
256+
if table.Optional {
257+
logrus.WithError(err).Warnf("skipping optional table %s.%s (not available in this cluster configuration)", table.Database, table.Name)
258+
continue
259+
}
254260
return fmt.Errorf("failed to export data for table %s.%s: %w", table.Database, table.Name, err)
255261
}
256262
}

0 commit comments

Comments
 (0)