ArcadeData / arcadedb

ArcadeDB Multi-Model Database, one DBMS that supports SQL, Cypher, Gremlin, HTTP/JSON, MongoDB and Redis. ArcadeDB is a conceptual fork of OrientDB, the first Multi-Model DBMS. ArcadeDB supports Vector Embeddings.
https://arcadedb.com
Apache License 2.0
505 stars 63 forks source link

Cannot drop full-text index #1288

Closed linozen closed 1 year ago

linozen commented 1 year ago

ArcadeDB Version:

v23.10.1-SNAPSHOT

OS and JDK Version:

Linux 6.5.6-76060506-generic - OpenJDK 64-Bit Server VM 11.0.20.1

Expected behavior

Drop the index

Actual behavior

Throw the following error:

com.arcadedb.exception.SchemaException: Cannot drop the index 'Beer[name]' (error=java.lang.ClassCastException: class com.arcadedb.index.lsm.LSMTreeFullTextIndex cannot be cast to class com.arcadedb.index.lsm.LSMTreeIndex (com.arcadedb.index.lsm.LSMTreeFullTextIndex and com.arcadedb.index.lsm.LSMTreeIndex are in unnamed module of loader 'app'))
    at com.arcadedb.schema.EmbeddedSchema.lambda$dropIndex$2(EmbeddedSchema.java:470)
    at com.arcadedb.database.EmbeddedDatabase.executeInWriteLock(EmbeddedDatabase.java:1427)
    at com.arcadedb.database.EmbeddedDatabase.recordFileChanges(EmbeddedDatabase.java:1467)
    at com.arcadedb.schema.EmbeddedSchema.recordFileChanges(EmbeddedSchema.java:1288)
    at com.arcadedb.schema.EmbeddedSchema.dropIndex(EmbeddedSchema.java:432)
    at com.arcadedb.query.sql.parser.DropIndexStatement.executeDDL(DropIndexStatement.java:63)
    at com.arcadedb.query.sql.executor.DDLExecutionPlan.executeInternal(DDLExecutionPlan.java:60)
    at com.arcadedb.query.sql.parser.DDLStatement.execute(DDLStatement.java:60)
    at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:73)
    at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:101)
    at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1334)
    at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:467)
    at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:123)
    at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:91)
    at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:99)
    at com.arcadedb.server.http.handler.AbstractServerHttpHandler.handleRequest(AbstractServerHttpHandler.java:126)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
    at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
    at java.base/java.lang.Thread.run(Thread.java:829)

Steps to reproduce

  1. Start up with docker:
    docker run --rm  -p 2480:2480 -p 2424:2424 -p 6379:6379 -p 5432:5432 -p 8182:8182 \
                 --env JAVA_OPTS="-Darcadedb.server.rootPassword=playwithdata \
    -Darcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz} \
    -Darcadedb.server.plugins=Postgres:com.arcadedb.postgres.PostgresProtocolPlugin,GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin " \
             arcadedata/arcadedb:latest
  2. Create property and full-text index on OpenBeer dataset
    CREATE PROPERTY Beer.name STRING; 

    BTW: Why do I need to do this? The property already exists but without this step, I cannot create the index.

CREATE INDEX ON Beer (name) FULL_TEXT

Then if you try to delete the index the error reproduced above occurs:

DROP INDEX `Beer[name]`

Thanks!

lvca commented 1 year ago

Reproduced.

lvca commented 1 year ago

Fixed, thanks for reporting it!

linozen commented 1 year ago

Wow, I'm impressed :100:

lvca commented 1 year ago

Thanks for the detailed report @linozen. It helps a lot!