You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "brunomendola (via GitHub)" <gi...@apache.org> on 2023/10/18 13:28:14 UTC

[PR] CAMEL-20010 [camel]

brunomendola opened a new pull request, #11759:
URL: https://github.com/apache/camel/pull/11759

   # Description
   
   Preserve default queries in `JdbcMessageIdRepository` to avoid replacing the table name more than once.
   
   Solves CAMEL-20010.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [x] I have run `mvn clean install -DskipTests` locally and I have committed all auto-generated changes
   
   <!--
   You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11759:
URL: https://github.com/apache/camel/pull/11759#issuecomment-1768462881

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions to run
   
   * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #11759:
URL: https://github.com/apache/camel/pull/11759#discussion_r1363924922


##########
components/camel-sql/src/main/java/org/apache/camel/processor/idempotent/jdbc/JdbcMessageIdRepository.java:
##########
@@ -65,12 +75,12 @@ protected void doInit() throws Exception {
 
         if (tableName != null) {
             // update query strings from default table name to the new table name
-            tableExistsString = tableExistsString.replaceFirst(DEFAULT_TABLENAME, tableName);
-            createString = createString.replaceFirst(DEFAULT_TABLENAME, tableName);
-            queryString = queryString.replaceFirst(DEFAULT_TABLENAME, tableName);
-            insertString = insertString.replaceFirst(DEFAULT_TABLENAME, tableName);
-            deleteString = deleteString.replaceFirst(DEFAULT_TABLENAME, tableName);
-            clearString = clearString.replaceFirst(DEFAULT_TABLENAME, tableName);
+            tableExistsString = DEFAULT_TABLE_EXISTS_STRING.replaceFirst(DEFAULT_TABLENAME, tableName);

Review Comment:
   You should use `replace` instead of `replaceFirst` to avoid using a regular expression behind the scenes



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #11759:
URL: https://github.com/apache/camel/pull/11759


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on PR #11759:
URL: https://github.com/apache/camel/pull/11759#issuecomment-1768772742

   doInit ensures its only invoked once


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on PR #11759:
URL: https://github.com/apache/camel/pull/11759#issuecomment-1768755319

   I'm wondering if it is normal that the `JdbcMessageIdRepository` is initialized several times which is maybe more the problem to fix, WDYT?


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on PR #11759:
URL: https://github.com/apache/camel/pull/11759#issuecomment-1768781999

   > doInit ensures its only invoked once
   
   So why do we get what is described in the ticket? I quote:
   
   > JdbcMessageIdRepository is designed to replace the CAMEL_MESSAGEPROCESSED substring in the queries with the  custom table name in the onInit() function, but looks like this function is called multiple times and it keeps replacing the substring that is present also in the custom table name.
   
   If I understand it well, if `onInit()` was called only once as it should, the problem would not occur


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-20010 [camel]

Posted by "brunomendola (via GitHub)" <gi...@apache.org>.
brunomendola commented on PR #11759:
URL: https://github.com/apache/camel/pull/11759#issuecomment-1770121409

   > > doInit ensures its only invoked once
   
   ...
   
   > If I understand it well, if `onInit()` was called only once as it should, the problem would not occur
   
   I think @essobedo has a point.
   
   I mean... the replacement was clearly happening twice, but the `onInit()` function should not be invoked twice by Camel.
   
   Maybe it's something related to some particular condition?
   The fact that the idempotentRepository was a bean, could it produce some unexpected behavior? Maybe something about concurrency? Is the onInit() call synchronized in some way?


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org