-
Notifications
You must be signed in to change notification settings - Fork 12
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
Yoj transactions at ydb topics #80
Comments
Currently YOJ does not use public interface Session implements AutoCloseable {
// <...>
@ExperimentalApi("New table transaction interfaces are experimental and may change without notice")
TableTransaction createNewTransaction(TxMode var1);
@ExperimentalApi("New table transaction interfaces are experimental and may change without notice")
CompletableFuture<Result<TableTransaction>> beginTransaction(TxMode var1, BeginTxSettings var2);
// <...>
} We can try to implement
|
If you implement any solution that would allow to reuse yoj transactions to work with ydb topics, that would be good enough |
@ansirotenko Please try out v2.5.7, it has If this wrapper is sufficient to reuse YOJ transaction to also work with YDB topics, that's great! |
Unfortunately it doesnt work. got following exception. java.lang.IllegalArgumentException: Transaction is not active. Can only write topic messages in already running transactions from other services. My code looks like this.
|
Oh. It seems that the YDB transaction has not been initiated by YOJ, probably because no statements (neither reads nor writes) have been executed. ( YOJ transactions are intentionally lazy (to e.g. execute some data preparation before allocating database resources). Please run any statement in transaction (do anything with a YOJ |
@nvamelichev I have followed your suggestion. Indeed, If I add any statement before writing to topic in same transaction, as a result no exception will be thrown. But apparently operation hangs forever. Im executing this experiment at unit test. Unit test code
ydb docker image is latest. tried to remove and pull image again before experiment. Image describe gives following
|
Transaction support for ydb partitions is expected to be available in the fall. In our project, we use yoj to work with our tables everywhere. It is required to marry yoj transactions and ydb-java-sdk transactions to be able to write topic messages (also commit offset at read) at the same transaction for the table. Currently it is possible to access current transaction of the txManager, but it is not possible to create ydb-java-sdk transaction from it. 2 main issues are statusFuture and sessionId could not be extracted from the yoj transaction. Also it would be great to have txId generated upfront, not lazily (if this is ok, im not sure).
Overall if yoj transaction would provide method like getYdbTransaction that would return instance of tech.ydb.common.transaction.YdbTransaction, it would be the most preferrable way
The text was updated successfully, but these errors were encountered: