diegomrsantos commented on code in PR #4092:
URL: https://github.com/apache/iggy/pull/4092#discussion_r3983437781


##########
core/server/src/http/handlers.rs:
##########
@@ -1405,17 +1427,18 @@ pub(in crate::http) async fn send_messages(
         .map_err(PartitionWriteError::Rejected)?;
     match query.ack {
         ProduceAck::Replicated => {
+            let policy = topic_durability(&state, &stream_id, &topic_id);
             let (reply, header) = SendWrapper::new(partition_write_replicated(
                 &state,
                 &identity.session,
                 Operation::SendMessages,
                 &body,
             ))
             .await?;
-            let durability = [(
-                DURABILITY_HEADER,
-                HeaderValue::from_static(DURABILITY_REPLICATED_MEMORY),
-            )];
+            let policy = policy.map_or(iggy_common::Durability::Replicated, 
|policy| {
+                policy.confirmed_policy(&state)

Review Comment:
   I found a separate case from the [earlier policy 
discussion](https://github.com/apache/iggy/pull/4092#discussion_r3983323849): 
neither topic's durability changes, but a rename changes which topic the 
request reaches.
   
   With a caller authorized for both topics:
   
   1. Topic A is named `orders` with `durability=persisted`; topic B is named 
`fast` with `durability=replicated`.
   2. An awaited produce to `orders` captures A's policy, then waits on the 
session's data gate.
   3. During that wait, A is renamed to `archived` and B to `orders`.
   4. Dispatch resolves `orders` to B. After B commits, policy confirmation 
checks A's saved identity and creation revision. A still exists, so the 
response advertises `persisted` for B's replicated write.
   
   The 
[reproducer](https://github.com/diegomrsantos/iggy/blob/9e144b843a643bee5dc59c76238bad44114064c7/core/server/src/http/reads.rs#L507)
 creates the stream and topics and performs both renames through the production 
metadata handlers. It still fails at the final assertion: the name resolves to 
B, but confirmation returns `Persisted` from A.
   
   This tests the metadata and policy helpers; it does not execute a full HTTP 
request. The waiting sequence follows from the handler capturing policy before 
the data gate and dispatch resolving the name afterward.
   
   Could we retain the policy together with the same resolved topic and 
incarnation used for dispatch, through to the response?



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