Skip to content
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

Test oracle 19c TAC got error ORA-25412: transaction replay disabled by call to OCITransStart #437

Open
fhitom opened this issue Apr 21, 2023 · 2 comments

Comments

@fhitom
Copy link

fhitom commented Apr 21, 2023

To verify the TAC(Transparent Application Continuity), I wrote a process that acquires the transaction, executes insert, waits 5 seconds, and commit repeatedly.
At this time, when I kill the session, ORA-25412: transaction replay disabled by call to OCITransStart occurs.
If TAC is installed, I think it will be replayed automatically, but how can I solve this problem?

I wrote like this:

....
for i := 1; i < 20; i++ {
    tx, err := db.BeginTx(ctx, nil)
    if err != nil {
        ....
    }
    defer func() {
        if err != nil {
            tx.Rollback()
            return
        }
    }()
    insertSql := "insert into test_table (id, text) values (" + strconv.Itoa(i) + ", 'text') "
    _, err = tx.ExecContext(ctx, insertSql)
    if err != nil {
        ...
    }
    // 5s sleep
    time.Sleep(time.Second * 5)

    // commit
    if err = tx.Commit(); err != nil {
        fmt.Println("Commit error:", err)
        return
    }
}
...

And I kill the session at Oracle as

alter system kill session '111, 11111, @1' immediate;

I got error as

Commit error: ORA-25412: transaction replay disabled by call to OCITransStart
@mattn
Copy link
Owner

mattn commented Apr 21, 2023

for i := 1; i < 20; i++ {
    tx, err := db.BeginTx(ctx, nil)
    if err != nil {
        ....
    }
    defer func() {
        if err != nil {
            tx.Rollback()
            return
        }
    }()

Is this your expected? This defer will not called for each loops.

@fhitom
Copy link
Author

fhitom commented Apr 21, 2023

@mattn
Thank you for your reply.
Sorry but I made a mistake.
I changed as

for i := 1; i < 20; i++ {
    tx, err := db.BeginTx(ctx, nil)
    if err != nil {
        ....
    }

    insertSql := "insert into test_table (id, text) values (" + strconv.Itoa(i) + ", 'text') "
    _, err = tx.ExecContext(ctx, insertSql)
    if err != nil {
        if err = tx.Rollback(); err != nil {
            return
        }
        return
    }

    // 5s sleep
    time.Sleep(time.Second * 5)

    // commit
    if err = tx.Commit(); err != nil {
        fmt.Println("Commit error:", err)
        return
    }
}

But the error remain the same.

Commit error: ORA-25412: transaction replay disabled by call to OCITransStart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants