You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "WangzJi (via GitHub)" <gi...@apache.org> on 2025/06/16 13:56:59 UTC
[PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
WangzJi opened a new pull request, #7443:
URL: https://github.com/apache/incubator-seata/pull/7443
<!--
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.
-->
<!-- Please make sure you have read and understood the contributing guidelines -->
- [ ] I have registered the PR [changes](../changes).
### Ⅰ. Describe what this PR did
This PR removes the dependency of Saga annotation on @LocalTCC by introducing a new @TransactionParticipant annotation. The changes include:
1. Core Changes:
- Enhanced LocalTCCRemotingParser to support both @LocalTCC and @TransactionParticipant annotations
- Fixed isService(Class<?>) method implementation in both tcc and compatible modules
2. Test Coverage:
- LocalTCCRemotingParserTest: Add unit tests for dual annotation support
- TransactionParticipantIntegrationTest: Add integration tests for runtime behavior
- AnnotationConflictTest: Add boundary tests for edge cases and conflicts
### Ⅱ. Does this pull request fix one issue?
Closes #7439
### Ⅲ. Why don't you add test cases (unit test/integration test)?
### Ⅳ. Describe how to verify it
1. Run the test suite:
```bash
./mvnw test -Dtest=LocalTCCRemotingParserTest,TransactionParticipantIntegrationTest,AnnotationConflictTest
```
2. Verify backward compatibility:
- All existing @LocalTCC annotated services continue to work
- New services can use either @LocalTCC or @TransactionParticipant
- No breaking changes in existing functionality
### Ⅴ. Special notes for reviews
1. Backward Compatibility:
- Maintains 100% compatibility with existing @LocalTCC usage
- No breaking changes to existing services
2. Code Quality:
- All tests pass
- Follows project coding standards
3. Documentation:
- Added clear documentation for @TransactionParticipant usage
- Updated migration guide for existing users
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#issuecomment-2976822126
## [Codecov](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `50.00000%` with `7 lines` in your changes missing coverage. Please review.
> Project coverage is 60.03%. Comparing base [(`bd717a6`)](https://app.codecov.io/gh/apache/incubator-seata/commit/bd717a6b7e77813c72d8fcf9dc43aaa9217b7517?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`2dc3205`)](https://app.codecov.io/gh/apache/incubator-seata/commit/2dc320590be465cdf1002f27e7709bd26191865f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 8 commits behind head on 2.x.
| [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...rm/tcc/remoting/parser/LocalTCCRemotingParser.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&filepath=compatible%2Fsrc%2Fmain%2Fjava%2Fio%2Fseata%2Frm%2Ftcc%2Fremoting%2Fparser%2FLocalTCCRemotingParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29tcGF0aWJsZS9zcmMvbWFpbi9qYXZhL2lvL3NlYXRhL3JtL3RjYy9yZW1vdGluZy9wYXJzZXIvTG9jYWxUQ0NSZW1vdGluZ1BhcnNlci5qYXZh) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...rm/tcc/remoting/parser/LocalTCCRemotingParser.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&filepath=tcc%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Frm%2Ftcc%2Fremoting%2Fparser%2FLocalTCCRemotingParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dGNjL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9ybS90Y2MvcmVtb3RpbmcvcGFyc2VyL0xvY2FsVENDUmVtb3RpbmdQYXJzZXIuamF2YQ==) | 87.50% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 2.x #7443 +/- ##
============================================
+ Coverage 58.62% 60.03% +1.41%
- Complexity 571 652 +81
============================================
Files 1269 1281 +12
Lines 45730 46280 +550
Branches 5548 5582 +34
============================================
+ Hits 26807 27783 +976
+ Misses 16344 15926 -418
+ Partials 2579 2571 -8
```
| [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...rm/tcc/remoting/parser/LocalTCCRemotingParser.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&filepath=tcc%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Frm%2Ftcc%2Fremoting%2Fparser%2FLocalTCCRemotingParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-dGNjL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9ybS90Y2MvcmVtb3RpbmcvcGFyc2VyL0xvY2FsVENDUmVtb3RpbmdQYXJzZXIuamF2YQ==) | `88.23% <87.50%> (+38.23%)` | :arrow_up: |
| [...rm/tcc/remoting/parser/LocalTCCRemotingParser.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&filepath=compatible%2Fsrc%2Fmain%2Fjava%2Fio%2Fseata%2Frm%2Ftcc%2Fremoting%2Fparser%2FLocalTCCRemotingParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29tcGF0aWJsZS9zcmMvbWFpbi9qYXZhL2lvL3NlYXRhL3JtL3RjYy9yZW1vdGluZy9wYXJzZXIvTG9jYWxUQ0NSZW1vdGluZ1BhcnNlci5qYXZh) | `0.00% <0.00%> (ø)` | |
... and [132 files with indirect coverage changes](https://app.codecov.io/gh/apache/incubator-seata/pull/7443/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
[](https://app.codecov.io/gh/apache/incubator-seata/pull/7443?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#issuecomment-3026524794
Hi all,@funky-eyes @YongGoose @pengten.
Based on community feedback, I propose the following approach for decoupling Saga annotation from TCC:
1. Create `SagaTransactional` annotation in saga-annotation module (independent from @LocalTCC)
2. Implement `SagaTransactionalRemotingParser` to handle only `SagaTransactional`
3. Register parser separately via SPI
Does this approach look good to the community? I'll proceed with implementation once confirmed.
Thanks!
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "pengten (via GitHub)" <gi...@apache.org>.
pengten commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2153495102
##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
@@ -63,27 +66,37 @@ public RemotingDesc getServiceDesc(Object bean, String beanName) throws Framewor
@Override
public boolean isService(Class<?> beanClass) throws FrameworkException {
- return isLocalTCC(beanClass);
+ return isTransactionParticipant(beanClass);
}
@Override
public boolean isReference(Object bean, String beanName) {
return isLocalTCC(bean);
}
+ /**
+ * Determine whether there is an annotation on interface or impl {@link LocalTCC} or {@link TransactionParticipant}
+ * @param bean the bean
+ * @return boolean
+ */
private boolean isLocalTCC(Object bean) {
Class<?> classType = bean.getClass();
- return isLocalTCC(classType);
+ return isTransactionParticipant(classType);
}
-
- private boolean isLocalTCC(Class<?> classType) {
+ /**
+ * Determine whether there is a transaction participant annotation ({@link LocalTCC} or {@link TransactionParticipant})
+ * on the given class or its interfaces
+ * @param classType the class type to check
+ * @return true if the class has either LocalTCC or TransactionParticipant annotation
+ */
+ private boolean isTransactionParticipant(Class<?> classType) {
Set<Class<?>> interfaceClasses = ReflectionUtil.getInterfaces(classType);
for (Class<?> interClass : interfaceClasses) {
- if (interClass.isAnnotationPresent(LocalTCC.class)) {
+ if (interClass.isAnnotationPresent(LocalTCC.class) || interClass.isAnnotationPresent(TransactionParticipant.class)) {
Review Comment:
> Thanks for the suggestion!
>
> I agree we should encapsulate the annotation check logic, but I suggest handling it directly in the existing `isLocalTCC()` method rather than creating a new one. This approach has several benefits:
>
> 1. Maintains backward compatibility
> 2. Method name still reflects its core purpose
> 3. Reduces changes needed in other code
>
> If we need to add more annotation types in the future, we can simply extend the condition within this method.
>
> What do you think about this approach?
This is one way, but we need to confirm whether this method needs to change its name.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2159196976
##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
Review Comment:
Fix in [aa9a8eb](https://github.com/apache/incubator-seata/pull/7443/commits/aa9a8ebabb6dedb0f11dd57f536de0a4fe82e436)
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2159196976
##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
Review Comment:
Fix in [e854392](https://github.com/apache/incubator-seata/pull/7443/commits/e8543922adc39701d5f201a31a9d06a6d7384d8c)
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2309041815
##########
tcc/src/test/java/org/apache/seata/rm/tcc/remoting/parser/LocalTCCRemotingParserTest.java:
##########
@@ -16,57 +16,204 @@
*/
package org.apache.seata.rm.tcc.remoting.parser;
+import org.apache.seata.common.exception.FrameworkException;
+import org.apache.seata.integration.tx.api.remoting.Protocols;
import org.apache.seata.integration.tx.api.remoting.RemotingDesc;
-import org.apache.seata.rm.tcc.TccAction;
-import org.apache.seata.rm.tcc.TccActionImpl;
-import org.junit.jupiter.api.Assertions;
+import org.apache.seata.rm.tcc.api.LocalTCC;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
Review Comment:
Do not use wildcard imports.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: Replace @LocalTCC with @SagaTransactional in the saga annotation pattern [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes merged PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2174367123
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
Thank you for the clarification!
I understand the community's decision to create a dedicated annotation for Saga mode. I can easily adapt my current @LocalTransactional implementation to create a Saga-specific annotation.
What do you think about @SagaTransactional as the naming?
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2151232529
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
@funky-eyes, thanks for your review! I'd like to address your concerns:
**Regarding " it is only applied in the TCC and SAGA annotation modes":**
The annotation aims to solve this limitation by being more generic. Here are the location options:
**Option A: Current location** `common/transaction/api`
- ✅ Generic design - not limited to specific transaction modes
- ✅ Future extensibility for other transaction patterns
- ✅ Resolves the scope limitation you mentioned
**Option B: More focused location** `integration-tx-api/annotation`
- ✅ Co-located with other transaction annotations like `AspectTransactional`
- ✅ More focused on annotation-based transaction integration
- ✅ Still maintains proper module dependencies
**Regarding the naming:**
How about `LocalTransactionResource` provides clearer semantics than `TransactionParticipant`:
- "Local" - clearly indicates it's for local (non-remote) resources
- "TransactionResource" - directly relates to its functionality
- Avoids the ambiguity you pointed out
Which approach do you prefer? Or do you have other suggestions for the design?
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2173235863
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
The community's final decision is to separate the Saga annotation mode into a distinct annotation similar to LocalTCC, which will be dedicated exclusively to the Saga annotation mode.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2314967901
##########
tcc/src/main/java/org/apache/seata/rm/tcc/api/TwoPhaseBusinessAction.java:
##########
@@ -27,9 +27,14 @@
/**
* TCC annotation.
* Define a TCC interface, which added on the try method.
- * Must be used with `@LocalTCC`.
+ * Must be used with `@LocalTCC` annotation on the interface or implementation class.
+ * This annotation is specifically designed for TCC (Try-Confirm-Cancel) transaction mode.
*
- * @see org.apache.seata.rm.tcc.api.LocalTCC // TCC annotation, which added on the TCC interface. It can't be left out.
+ * For Saga scenarios with compensation patterns, use `@CompensationBusinessAction` with `@SagaTransactional` instead.
Review Comment:
The documentation mentions using `@CompensationBusinessAction` with `@SagaTransactional` but `@CompensationBusinessAction` is for defining methods, while `@SagaTransactional` is for marking classes/interfaces. Consider clarifying that `@CompensationBusinessAction` is used on methods within classes/interfaces marked with `@SagaTransactional`.
```suggestion
* For Saga scenarios with compensation patterns, use `@CompensationBusinessAction` on methods within classes or interfaces marked with `@SagaTransactional`.
```
##########
saga/seata-saga-annotation/src/main/resources/META-INF/services/org.apache.seata.integration.tx.api.remoting.RemotingParser:
##########
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+org.apache.seata.saga.rm.remoting.parser.SagaTransactionalRemotingParser
Review Comment:
Remove trailing whitespace at the end of line 17.
```suggestion
org.apache.seata.saga.rm.remoting.parser.SagaTransactionalRemotingParser
```
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2159225613
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
@funky-eyes @YongGoose Thanks for the feedback! I've adopted the `@LocalTransactional` naming as suggested by @YongGoose.
**Regarding transaction mode parameters:**
@funky-eyes Your suggestion about enhancing with transaction mode parameters and AT isolation levels is excellent for future iterations. For this PR, I focused on the core issue #7439 - removing Saga's semantic dependency on `@LocalTCC`. The current simple annotation provides a clean foundation that can be enhanced later.
This keeps the current PR focused while leaving room for those valuable enhancements in follow-up work.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "pengten (via GitHub)" <gi...@apache.org>.
pengten commented on PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#issuecomment-3026572596
> Hi all,@funky-eyes @YongGoose @pengten. Based on community feedback, I propose the following approach for decoupling Saga annotation from TCC:
>
> 1. Create `SagaTransactional` annotation in saga-annotation module (independent from @LocalTCC)
> 2. Implement `SagaTransactionalRemotingParser` to handle only `SagaTransactional`
> 3. Register parser separately via SPI
>
> Does this approach look good to the community? I'll proceed with implementation once confirmed. Thanks!
Sounds good to me.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2152405903
##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
@@ -63,27 +66,37 @@ public RemotingDesc getServiceDesc(Object bean, String beanName) throws Framewor
@Override
public boolean isService(Class<?> beanClass) throws FrameworkException {
- return isLocalTCC(beanClass);
+ return isTransactionParticipant(beanClass);
}
@Override
public boolean isReference(Object bean, String beanName) {
return isLocalTCC(bean);
}
+ /**
+ * Determine whether there is an annotation on interface or impl {@link LocalTCC} or {@link TransactionParticipant}
+ * @param bean the bean
+ * @return boolean
+ */
private boolean isLocalTCC(Object bean) {
Class<?> classType = bean.getClass();
- return isLocalTCC(classType);
+ return isTransactionParticipant(classType);
}
-
- private boolean isLocalTCC(Class<?> classType) {
+ /**
+ * Determine whether there is a transaction participant annotation ({@link LocalTCC} or {@link TransactionParticipant})
+ * on the given class or its interfaces
+ * @param classType the class type to check
+ * @return true if the class has either LocalTCC or TransactionParticipant annotation
+ */
+ private boolean isTransactionParticipant(Class<?> classType) {
Set<Class<?>> interfaceClasses = ReflectionUtil.getInterfaces(classType);
for (Class<?> interClass : interfaceClasses) {
- if (interClass.isAnnotationPresent(LocalTCC.class)) {
+ if (interClass.isAnnotationPresent(LocalTCC.class) || interClass.isAnnotationPresent(TransactionParticipant.class)) {
Review Comment:
Thanks for the suggestion!
I agree we should encapsulate the annotation check logic, but I suggest handling it directly in the existing `isLocalTCC()` method rather than creating a new one. This approach has several benefits:
1. Maintains backward compatibility
2. Method name still reflects its core purpose
3. Reduces changes needed in other code
If we need to add more annotation types in the future, we can simply extend the condition within this method.
What do you think about this approach?
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "YongGoose (via GitHub)" <gi...@apache.org>.
YongGoose commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2151959434
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
If it can also enable local transaction features like a unified commit, I'd cast my vote for `LocalTransactional`.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2150105062
##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
Review Comment:
The new features do not necessitate any changes to the compatible module. Its sole responsibility is to maintain compatibility with Seata versions prior to 2.1.
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
Firstly, it is only applied in the TCC and SAGA annotation modes. Secondly, this naming is rather ambiguous and doesn't clearly relate to its functionality.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2315363802
##########
changes/en-us/2.x.md:
##########
@@ -49,6 +49,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#7608](https://github.com/seata/seata/pull/7608)] modify the parameter name in refreshToken method
- [[#7603](https://github.com/seata/seata/pull/7603)] upgrade Apache Tomcat dependency from 9.0.106 to 9.0.108
- [[#7614](https://github.com/seata/seata/pull/7614)] update README.md
+- [[#7443](https://github.com/seata/seata/pull/7443)] remove Saga annotation dependency on @LocalTCC
Review Comment:
```suggestion
- [[#7443](https://github.com/seata/seata/pull/7443)] Replace @LocalTCC with @SagaTransactional in the saga annotation pattern
```
Wouldn't a description like "Replace @LocalTCC with @SagaTransactional in the saga annotation pattern" be more appropriate?
##########
changes/zh-cn/2.x.md:
##########
@@ -48,6 +48,7 @@
- [[#7608](https://github.com/seata/seata/pull/7608)] 修改refreshToken方法中的参数名称
- [[#7603](https://github.com/seata/seata/pull/7603)] 将Apache Tomcat依赖项从9.0.106升级到9.0.108
- [[#7614](https://github.com/seata/seata/pull/7614)] 更新 README.md
+- [[#7443](https://github.com/seata/seata/pull/7443)] 移除Saga注解对 @LocalTCC 的依赖
Review Comment:
```suggestion
- [[#7443](https://github.com/seata/seata/pull/7443)] 将saga注释模式中的@LocalTCC替换为@SagaTransactional
```
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#issuecomment-3216839445
> Hi all,@funky-eyes @YongGoose @pengten. Based on community feedback, I propose the following approach for decoupling Saga annotation from TCC:
>
> 1. Create `SagaTransactional` annotation in saga-annotation module (independent from @LocalTCC)
> 2. Implement `SagaTransactionalRemotingParser` to handle only `SagaTransactional`
> 3. Register parser separately via SPI
>
> Does this approach look good to the community? I'll proceed with implementation once confirmed. Thanks!
> Hi all,@funky-eyes @YongGoose @pengten. Based on community feedback, I propose the following approach for decoupling Saga annotation from TCC:
>
> 1. Create `SagaTransactional` annotation in saga-annotation module (independent from @LocalTCC)
> 2. Implement `SagaTransactionalRemotingParser` to handle only `SagaTransactional`
> 3. Register parser separately via SPI
>
> Does this approach look good to the community? I'll proceed with implementation once confirmed. Thanks!
I agree
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2159889037
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
> @funky-eyes @YongGoose Thanks for the feedback! I've adopted the `@LocalTransactional` naming as suggested by @YongGoose.
>
> **Regarding transaction mode parameters:** @funky-eyes Your suggestion about enhancing with transaction mode parameters and AT isolation levels is excellent for future iterations. For this PR, I focused on the core issue #7439 - removing Saga's semantic dependency on `@LocalTCC`. The current simple annotation provides a clean foundation that can be enhanced later. This keeps the current PR focused while leaving room for those valuable enhancements in follow-up work.
I agree with your opinion. However, the name of this annotation may need to be approved by the majority of the community at the next weekly meeting before this PR can be merged.
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2151696037
##########
common/src/main/java/org/apache/seata/common/transaction/api/TransactionParticipant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.seata.common.transaction.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Transaction Participant annotation.
+ * A general annotation for marking beans that participate in distributed transactions.
+ * This annotation is designed to replace the specific usage of @LocalTCC in Saga scenarios
+ * to avoid confusion, while also being applicable to TCC and other transaction modes.
+ * <p>
+ * In distributed transaction terminology, a "participant" is any component that takes part
+ * in the transaction protocol, making this name semantically accurate across different
+ * transaction patterns (TCC, Saga, XA, etc.).
+ *
+ * @see org.apache.seata.rm.tcc.api.LocalTCC // the original TCC-specific annotation, still supported for backward compatibility
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface TransactionParticipant {
Review Comment:
> @funky-eyes, thanks for your review! I'd like to address your concerns:
>
> **Regarding " it is only applied in the TCC and SAGA annotation modes":**
>
> The annotation aims to solve this limitation by being more generic. Here are the location options:
>
> **Option A: Current location** `common/transaction/api`
>
> * ✅ Generic design - not limited to specific transaction modes
> * ✅ Future extensibility for other transaction patterns
> * ✅ Resolves the scope limitation you mentioned
>
> **Option B: More focused location** `integration-tx-api/annotation`
>
> * ✅ Co-located with other transaction annotations like `AspectTransactional`
> * ✅ More focused on annotation-based transaction integration
> * ✅ Still maintains proper module dependencies
>
> **Regarding the naming:** How about `LocalTransactionResource` provides clearer semantics than `TransactionParticipant`:
>
> * "Local" - clearly indicates it's for local (non-remote) resources
> * "TransactionResource" - directly relates to its functionality
> * Avoids the ambiguity you pointed out
>
> Which approach do you prefer? Or do you have other suggestions for the design?
Regarding the naming, I lean towards TransactionParticipant instead of LocalTransactionResource. We could enhance TransactionParticipant with a parameter for the transaction mode. This would also allow it to handle more common settings in the future, like AT mode's isolation level. Consequently, configuring the lock retry interval via @GlobalTransaction would become unnecessary, since @GlobalTransaction is primarily for TM, not for RM. This new annotation could also enable local transaction features, like connection reuse until the aspect finishes and a unified commit. Or could it be changed to LocalTransactional? Or SeataLocalTransactional?
@slievrly @xingfudeshi @YongGoose @xjlgod PTAL
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "pengten (via GitHub)" <gi...@apache.org>.
pengten commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2151822628
##########
compatible/src/main/java/io/seata/rm/tcc/remoting/parser/LocalTCCRemotingParser.java:
##########
@@ -63,27 +66,37 @@ public RemotingDesc getServiceDesc(Object bean, String beanName) throws Framewor
@Override
public boolean isService(Class<?> beanClass) throws FrameworkException {
- return isLocalTCC(beanClass);
+ return isTransactionParticipant(beanClass);
}
@Override
public boolean isReference(Object bean, String beanName) {
return isLocalTCC(bean);
}
+ /**
+ * Determine whether there is an annotation on interface or impl {@link LocalTCC} or {@link TransactionParticipant}
+ * @param bean the bean
+ * @return boolean
+ */
private boolean isLocalTCC(Object bean) {
Class<?> classType = bean.getClass();
- return isLocalTCC(classType);
+ return isTransactionParticipant(classType);
}
-
- private boolean isLocalTCC(Class<?> classType) {
+ /**
+ * Determine whether there is a transaction participant annotation ({@link LocalTCC} or {@link TransactionParticipant})
+ * on the given class or its interfaces
+ * @param classType the class type to check
+ * @return true if the class has either LocalTCC or TransactionParticipant annotation
+ */
+ private boolean isTransactionParticipant(Class<?> classType) {
Set<Class<?>> interfaceClasses = ReflectionUtil.getInterfaces(classType);
for (Class<?> interClass : interfaceClasses) {
- if (interClass.isAnnotationPresent(LocalTCC.class)) {
+ if (interClass.isAnnotationPresent(LocalTCC.class) || interClass.isAnnotationPresent(TransactionParticipant.class)) {
Review Comment:
```
interClass.isAnnotationPresent(LocalTCC.class) || interClass.isAnnotationPresent(TransactionParticipant.class)
```
This condition determines whether it would be more comfortable to encapsulate a method separately 🤔
It seems that this conditional judgment may continue to evolve in the future. Now it appears in multiple locations. Perhaps it would be better to converge?
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on code in PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#discussion_r2312229478
##########
tcc/src/test/java/org/apache/seata/rm/tcc/remoting/parser/LocalTCCRemotingParserTest.java:
##########
@@ -16,57 +16,204 @@
*/
package org.apache.seata.rm.tcc.remoting.parser;
+import org.apache.seata.common.exception.FrameworkException;
+import org.apache.seata.integration.tx.api.remoting.Protocols;
import org.apache.seata.integration.tx.api.remoting.RemotingDesc;
-import org.apache.seata.rm.tcc.TccAction;
-import org.apache.seata.rm.tcc.TccActionImpl;
-import org.junit.jupiter.api.Assertions;
+import org.apache.seata.rm.tcc.api.LocalTCC;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
Review Comment:
Done
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: remove Saga annotation dependency on @LocalTCC [incubator-seata]
Posted by "WangzJi (via GitHub)" <gi...@apache.org>.
WangzJi commented on PR #7443:
URL: https://github.com/apache/incubator-seata/pull/7443#issuecomment-3244002138
> Please register your PR in those two files : https://github.com/apache/incubator-seata/blob/2.x/changes/zh-cn/2.x.md https://github.com/apache/incubator-seata/blob/2.x/changes/en-us/2.x.md
Done in [10acfb5](https://github.com/apache/incubator-seata/pull/7443/commits/10acfb56faf514b83a18854c0c5f765bae67edac).
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org