Skip to content

Commit

Permalink
Log warning when returning null TableMetadata
Browse files Browse the repository at this point in the history
If user sets connector up in schemaless mode and forgets
to create the table, the connector tasks will fail with NullPointerException.
Added warning should make it more obvious as to what is the issue.

I am not adding throw here just in case there exists a situation
where table creation could lag behind. Connector should continue
working normally after the table is created.
  • Loading branch information
Bouncheck committed Oct 23, 2023
1 parent 8640368 commit a07252e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/io/connect/scylladb/ScyllaDbSessionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public TableMetadata.Table tableMetadata(String tableName) {
result = new TableMetadataImpl.TableImpl(tableMetadata.get());
this.tableMetadataCache.put(tableName, result);
} else {
log.warn("Could not find metadata for table {} in keyspace {}. Are you sure the table exists?", tableName, keyspaceMetadata.getName().asCql(false));
result = null;
}
}
Expand Down

0 comments on commit a07252e

Please sign in to comment.