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

Cannot insert with PENDING_COMMIT_TIMESTAMP if that column is part of an index #216

Open
bloveless opened this issue Feb 25, 2025 · 0 comments

Comments

@bloveless
Copy link

bloveless commented Feb 25, 2025

This issue is about a regression that was introduces in 1.5.17 which fixed #25.

I've reproduced this issue in the following example.

go test -v shows the following (condensed) output

=== RUN   TestSpanner1516Passing
    main_test.go:85: Created database [testdb]
--- PASS: TestSpanner1516Passing (21.97s)
=== RUN   TestSpanner1517Failing
    main_test.go:85: Created database [testdb]
    main_test.go:99: failed to insert data: spanner: code = "InvalidArgument", desc = "Table _index_data_table_AK_SingersCreatedTime cannot be accessed because it, or its associated index, has a pending CommitTimestamp", requestID = "1.77b04ab44b49316e.2.3.6.1"
--- FAIL: TestSpanner1517Failing (21.48s)
=== RUN   TestSpanner1529Failing
    main_test.go:85: Created database [testdb]
    main_test.go:99: failed to insert data: spanner: code = "InvalidArgument", desc = "Table _index_data_table_AK_SingersCreatedTime cannot be accessed because it, or its associated index, has a pending CommitTimestamp", requestID = "1.77b04ab44b49316e.3.2.6.1"
--- FAIL: TestSpanner1529Failing (21.49s)
FAIL
exit status 1
FAIL    commitrepro     65.951s

commitrepro.tgz

In this example you can see that using spanner emulator 1.5.16 it works to insert a pending commit timestamp into a column which exists in an index. All versions after that do not allow this functionality. I specifically tested the next version 1.5.17 and the latest version 1.5.29 and they both fail.

The summary of the issue is that the following used to work in the emulator but doesn't anymore:

CREATE TABLE Singers (
    SingerId   INT64 NOT NULL,
    FirstName  STRING(1024),
    CreatedAt  TIMESTAMP OPTIONS (allow_commit_timestamp=true),
) PRIMARY KEY (SingerId);
CREATE UNIQUE INDEX AK_SingersCreatedTime ON Singers (CreatedAt);
INSERT INTO Singers (SingerId, FirstName, CreatedAt) VALUES (1, 'Marc', PENDING_COMMIT_TIMESTAMP());

I believe this is was mentioned as the final comment on issue #25.

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

1 participant