-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Labels
backend changes neededChange must be implemented on the Snowflake service, and not in the client driver.Change must be implemented on the Snowflake service, and not in the client driver.bugErroneous or unexpected behaviourErroneous or unexpected behaviourstatus-blockedProgress cannot be made to this issue due to an outside blocking factor.Progress cannot be made to this issue due to an outside blocking factor.status-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team
Description
Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!
-
What version of GO driver are you using?
v1.9.0 -
What operating system and processor architecture are you using?
MacOS 15.0.1 (24A348), M2 Max -
What version of GO are you using?
go version go1.23.2 darwin/arm64
4.Server version:* E.g. 1.90.1
8.40.1
- What did you do?
func Test_TransactionIsNotRollbackWithContextCancelled(t *testing.T) {
sf := OpenSnowflakeDB()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
txIDCh := make(chan int, 1)
cancelledCh := make(chan struct{}, 1)
doneCh := make(chan struct{}, 1)
go func() {
tx, err := sf.BeginTx(ctx, nil) // Using sf.Begin() is fine
if err != nil {
t.Fatal(err)
}
defer func() {
err := tx.Rollback()
if err != nil {
fmt.Printf("Rollback failed: %v\n", err)
}
fmt.Printf("transaction is rollbacked\n")
doneCh <- struct{}{}
}()
var txID int
if err := tx.QueryRowContext(ctx, "SELECT CURRENT_TRANSACTION();").Scan(&txID); err != nil {
t.Fatal(err)
}
txIDCh <- txID
<-cancelledCh
}()
txID := <-txIDCh
cancel()
cancelledCh <- struct{}{}
<-doneCh
if runningTxsCount(t, sf.DB) != 0 { // Use "SHOW TRANSACTIONS;"
t.Error("transaction is still running")
_, err := sf.Exec("SELECT SYSTEM$ABORT_TRANSACTION(?);", txID)
if err != nil {
t.Fatal(err)
}
}
}
-
What did you expect to see?
The transaction should be aborted.
Metadata
Metadata
Assignees
Labels
backend changes neededChange must be implemented on the Snowflake service, and not in the client driver.Change must be implemented on the Snowflake service, and not in the client driver.bugErroneous or unexpected behaviourErroneous or unexpected behaviourstatus-blockedProgress cannot be made to this issue due to an outside blocking factor.Progress cannot be made to this issue due to an outside blocking factor.status-triage_doneInitial triage done, will be further handled by the driver teamInitial triage done, will be further handled by the driver team