huaxingao commented on code in PR #3915:
URL: https://github.com/apache/polaris/pull/3915#discussion_r2898321428


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/IdempotencyStore.java:
##########
@@ -131,29 +132,53 @@ ReserveResult reserve(
   HeartbeatResult updateHeartbeat(
       String realmId, String idempotencyKey, String executorId, Instant now);
 
+  /**
+   * Cancels (deletes) an in-progress idempotency reservation owned by {@code 
executorId}.
+   *
+   * <p>This is used for cases where an idempotency key was reserved but the 
request should not be
+   * tracked for replay (for example, 401/403/408/429 responses per the 
proposal). Implementations
+   * should only cancel the record if it is still in-progress (i.e., not 
finalized) and owned by the
+   * given executor.
+   *
+   * @param realmId logical tenant or realm identifier
+   * @param idempotencyKey application-provided idempotency key
+   * @param executorId identifier of the executor that owns the reservation
+   * @return {@code true} if a record was cancelled, {@code false} otherwise

Review Comment:
   Cancel is best-effort. The caller doesn't need the return value: the HTTP 
response is already decided by the time cancel runs. If it fails or throws, the 
record just expires on its own. Java docs was updated



##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/IdempotencyStoreFactory.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.core.persistence;
+
+/**
+ * Factory for creating an {@link IdempotencyStore} backend.
+ *
+ * <p>Implementations are selected by the runtime wiring layer (e.g. Quarkus 
CDI) using an
+ * identifier, similar to other Polaris factories.
+ */
+public interface IdempotencyStoreFactory {
+  /** Create an {@link IdempotencyStore} instance. */
+  IdempotencyStore create();

Review Comment:
   The call site is in the next PR, where ServiceProducers calls 
factory.create() to produce the IdempotencyStore bean. Same pattern as 
MetaStoreManagerFactory.



-- 
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]

Reply via email to