Copilot commented on code in PR #2752:
URL: https://github.com/apache/fluss/pull/2752#discussion_r2870233400
##########
fluss-server/src/main/java/org/apache/fluss/server/replica/ReplicaManager.java:
##########
@@ -1177,6 +1179,12 @@ private Map<TableBucket, ProduceLogResultForBucket>
appendToLocalLog(
TableMetricGroup tableMetrics = null;
try {
Replica replica = getReplicaOrException(tb);
+ if (replica.getTableInfo().hasPrimaryKey()) {
+ throw new InvalidTableException(
+ String.format(
+ "PRODUCE_LOG is only supported on log
table, but %s is a primary key table.",
+ replica.getTablePath()));
Review Comment:
`InvalidTableException` / `NonPrimaryKeyTableException` thrown here will be
treated as “unexpected” by `isUnexpectedException(...)`, which will still emit
an ERROR log + increment failed-request metrics for this expected client
misuse. Consider updating `isUnexpectedException` (or the catch block logic) to
treat these table-type validation exceptions as expected so PRODUCE_LOG/PUT_KV
on the wrong table type doesn’t produce error logs.
##########
fluss-server/src/main/java/org/apache/fluss/server/replica/ReplicaManager.java:
##########
@@ -1228,6 +1236,12 @@ private Map<TableBucket, PutKvResultForBucket>
putToLocalKv(
try {
LOG.trace("Put records to local kv tablet for table bucket
{}", tb);
Replica replica = getReplicaOrException(tb);
+ if (!replica.getTableInfo().hasPrimaryKey()) {
+ throw new NonPrimaryKeyTableException(
+ String.format(
+ "PUT_KV is only supported on primary key
table, but %s is a log table.",
+ replica.getTablePath()));
Review Comment:
Same as above: throwing `NonPrimaryKeyTableException` here will currently be
logged at ERROR as an “unexpected” exception. To align with the PR goal (avoid
noisy logs for wrong-table operations), add this exception to the expected list
in `isUnexpectedException(...)` (or handle `ApiException` separately) so the
server doesn’t log stack traces for this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]