-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-8760 PostgresJdbcChannelMessageStore using DELETE ... RETURNING
#8762
GH-8760 PostgresJdbcChannelMessageStore using DELETE ... RETURNING
#8762
Conversation
Test results are in!
|
} | ||
|
||
@Override | ||
public void setChannelMessageStoreQueryProvider(ChannelMessageStoreQueryProvider channelMessageStoreQueryProvider) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to assume that there any other ChannelMessageStoreQueryProvider
impl but not just PostgresChannelMessageStoreQueryProvider
.
Let's just override those poll methods in the PostgresChannelMessageStoreQueryProvider
and allow to set only that one it this PostgresJdbcMessageStore
having a new setPostgresChannelMessageStoreQueryProvider
(if you think someone may provide their own impl) with an UnsupportedOperationException
for this overridden setChannelMessageStoreQueryProvider()
!
I mean that we don't need extra DeleteReturning...
abstraction. I doubt any other RDBMS have something similar to worry right now about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that we don't need extra DeleteReturning... abstraction. I doubt any other RDBMS have something similar to worry right now about.
At least Oracle has it: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/DELETE.html#GUID-156845A5-B626-412B-9F95-8869B988ABD7
Therefore, I'd favor adding the "single statement poll" as a concept in the JDBCMessageChannelStore over specialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just commented about generic nature of the ChannelMessageStoreQueryProvider
.
We can look into Oracle feature later on.
...test/java/org/springframework/integration/jdbc/store/channel/DataSource-postgres-context.xml
Outdated
Show resolved
Hide resolved
...org/springframework/integration/jdbc/store/channel/PostgresJdbcChannelMessageStoreTests.java
Outdated
Show resolved
Hide resolved
…... RETURNING` Fixes spring-projects#8760 * Add PostgresJdbcChannelMessageStore and tests
459f163
to
1755cc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point now about:
isSingleStatementPoll()
to theChannelMessageStoreQueryProvider
and no extra DeleteReturning
and specific PostgresJdbcChannelMessageStore
!
Can you rework that way?
Or do I miss anything else?
Thanks
...org/springframework/integration/jdbc/store/channel/PostgresJdbcChannelMessageStoreTests.java
Outdated
Show resolved
Hide resolved
...org/springframework/integration/jdbc/store/channel/PostgresJdbcChannelMessageStoreTests.java
Outdated
Show resolved
Hide resolved
Please, don't do commits squash: Github doesn't notify us about such a push into the PR. |
…nnelMessageStore specialization
8e7ab93
to
3ee09d8
Compare
...ava/org/springframework/integration/jdbc/store/channel/ChannelMessageStoreQueryProvider.java
Outdated
Show resolved
Hide resolved
.../integration/jdbc/store/channel/DeleteReturningPostgresChannelMessageStoreQueryProvider.java
Outdated
Show resolved
Hide resolved
...test/java/org/springframework/integration/jdbc/store/channel/DataSource-postgres-context.xml
Outdated
Show resolved
Hide resolved
...org/springframework/integration/jdbc/store/channel/PostgresJdbcChannelMessageStoreTests.java
Show resolved
Hide resolved
@@ -633,6 +633,10 @@ protected Message<?> doPollForMessage(String groupIdKey) { | |||
} | |||
|
|||
private boolean doRemoveMessageFromGroup(Object groupId, Message<?> messageToRemove) { | |||
if (this.channelMessageStoreQueryProvider.isSingleStatementForPoll()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree with this expression being present in this method.
It really does not reflect the purpose of this method.
Please, consider to implement this if
in the pollMessageFromGroup()
instead.
and %PREFIX%CHANNEL_MESSAGE.REGION = :region | ||
and %PREFIX%CHANNEL_MESSAGE.MESSAGE_ID not in (:message_ids) | ||
order by CREATED_DATE, MESSAGE_SEQUENCE | ||
limit 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that we don't need FOR UPDATE
. But how about SKIP LOCKED
?
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I don't know. I think I'll run my performance tests if it makes a difference. Keep you posted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Would you mind coming back with results as soon as possible?
We have a release today, so would be great to have this merged.
...org/springframework/integration/jdbc/store/channel/PostgresJdbcChannelMessageStoreTests.java
Show resolved
Hide resolved
OK... running with the skip locked in delete returning gives some additional boost when using multi reader threads...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import order is wrong in the PostgresJdbcChannelMessageStoreTests
, but everything else is OK with me, so I'm pulling your PR locally for final review, clean up and merging.
Thank you!
A first draft of a PostgresJdbcChannelMessageStore implementation using a single statement - designed as proposed in #8760 (comment)
I wonder if other DBMS have similar operations. If yes, we could add a
isSingleStatementPoll()
to theChannelMessageStoreQueryProvider
interface and if true theJdbcChannelMessageStore
omits the delete. Also, that would prevent using the wrong query provider with the wrong store. WDYT?Fixes #8760