chai icon indicating copy to clipboard operation
chai copied to clipboard

I got a painc error when I creating the index

Open startan opened this issue 2 years ago • 2 comments

What version of Genji are you using?

$ genji version
```shell
Genji v0.15.0
Genji CLI v0.15.0
```

What did you do?

CREATE SEQUENCE IF NOT EXISTS seq_cizu;
CREATE TABLE IF NOT EXISTS cizu (
  id INTEGER NOT NULL DEFAULT (NEXT VALUE FOR seq_cizu),
  ci TEXT NOT NULL, -- 词语
  explanation TEXT NOT NULL, -- 含义
  PRIMARY KEY (id)
);
CREATE INDEX IF NOT EXISTS IDX_CI ON cizu(ci);

What did you expect to see?

The table and index should be created successfully.

What did you see instead?

I got a painc error when I creating the index

genji> CREATE INDEX IF NOT EXISTS IDX_CI2 ON cizu(ci);
panic: unreachable

goroutine 35 [running]:
github.com/genjidb/genji/internal/encoding.Skip({0x135308c70ba?, 0x1?, 0xc00041b54a?})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/encoding/helpers.go:69 +0x1af
github.com/genjidb/genji/internal/database.(*EncodedDocument).GetByField(0xc00027efc0, {0xc00041b54a, 0x2})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/database/encoding.go:205 +0x277
github.com/genjidb/genji/document.Path.GetValueFromDocument({0xc0000057d0, 0x1, 0x1}, {0x7ff765b09830?, 0xc00027efc0?})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/document/path.go:80 +0x1a4
github.com/genjidb/genji/internal/stream/index.(*InsertOperator).Iterate.func1(0xc000185801?)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/stream/index/insert.go:52 +0x25b
github.com/genjidb/genji/internal/stream/table.(*ScanOperator).Iterate.func1(0x7ff7657268e8?, {0x7ff765b09830?, 0xc00027efc0?})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/stream/table/scan.go:89 +0x6d
github.com/genjidb/genji/internal/database.(*Table).IterateOnRange.func1(0xc000048f00?, {0x135308c70ba, 0x1, 0x1})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/database/table.go:145 +0xd6
github.com/genjidb/genji/internal/tree.(*Tree).IterateOnRange(0xc000005950, 0x7ff765a40e01?, 0x0, 0xc00007b9e8)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/tree/tree.go:182 +0x439
github.com/genjidb/genji/internal/database.(*Table).IterateOnRange(0xc00027efa0, 0x0, 0x44?, 0xc00007bac0)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/database/table.go:143 +0x116
github.com/genjidb/genji/internal/stream/table.(*ScanOperator).Iterate(0xc0004111d0, 0xc00042a4e0, 0xc0001ff920)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/stream/table/scan.go:85 +0x2ee
github.com/genjidb/genji/internal/stream/index.(*InsertOperator).Iterate(0xc0001ff8f0, 0x7ff7659c2740?, 0x7ff765a71458)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/stream/index/insert.go:39 +0x193
github.com/genjidb/genji/internal/stream.(*DiscardOperator).Iterate(0xc00027ef20?, 0x0?, 0x7ff765b07300?)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/stream/stream.go:129 +0x28
github.com/genjidb/genji/internal/stream.(*Stream).Iterate(...)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/stream/stream.go:34
github.com/genjidb/genji/internal/query/statement.(*StreamStmtIterator).Iterate(0xc0004340b0?, 0xc00027ef20?)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/query/statement/stream.go:70 +0x12d
github.com/genjidb/genji/internal/query/statement.(*Result).Iterate(...)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/query/statement/statement.go:59
github.com/genjidb/genji/cmd/genji/dbutil.ExecSQL.func1({0x7ff765b08640?, 0xc000224d20})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/genji/cmd/[email protected]/dbutil/exec.go:38 +0x1ee
github.com/genjidb/genji/internal/sql/parser.(*Parser).Parse(0xc00027ed80, 0xc00007bd48)
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/[email protected]/internal/sql/parser/parser.go:98 +0x84
github.com/genjidb/genji/cmd/genji/dbutil.ExecSQL({0x7ff765b0af70, 0xc000033400}, 0xc00030a840, {0x7ff765b07700, 0xc00027ed60}, {0x7ff765b07640?, 0xc000006018}) 
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/genji/cmd/[email protected]/dbutil/exec.go:22 +0x115
github.com/genjidb/genji/cmd/genji/shell.(*Shell).runQuery(0xc00016a5a0, {0x7ff765b0af70, 0xc000033400}, {0xc0000ce750, 0x2f})
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/genji/cmd/[email protected]/shell/shell.go:494 +0xa5
github.com/genjidb/genji/cmd/genji/shell.Run.func4()
        C:/Users/StAR/go/pkg/mod/github.com/genjidb/genji/cmd/[email protected]/shell/shell.go:125 +0x29
golang.org/x/sync/errgroup.(*Group).Go.func1()
        C:/Users/StAR/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
        C:/Users/StAR/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:72 +0xa5

startan avatar Jul 03 '22 14:07 startan

I can't reproduce the issue, could you share the (non-private) content of your table please?

In the genji shell, type:

.dump

and copy the output here, after removing any sensitive data.

asdine avatar Jul 04 '22 00:07 asdine

There's no private information. These are all my SQL files. sql.zip

startan avatar Jul 28 '22 16:07 startan

There have been a rework of index creation in v0.16.0, closing this issue. Feel free to re-open if the issue happens again

asdine avatar Dec 25 '23 16:12 asdine