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

[Database error, worked fine after deleting ____] #3534

Closed
xiaoluofa opened this issue Mar 22, 2024 · 4 comments
Closed

[Database error, worked fine after deleting ____] #3534

xiaoluofa opened this issue Mar 22, 2024 · 4 comments
Labels
Bug Issues that contain unintended behavior

Comments

@xiaoluofa
Copy link

image
有什么办法迁移在线的历史记录数据吗?
image
我不知道是哪一个表
image

@xiaoluofa xiaoluofa added the Bug Issues that contain unintended behavior label Mar 22, 2024
@AuroraLS3
Copy link
Collaborator

Please send a copy of this file
image

@AuroraLS3 AuroraLS3 changed the title 我不知道为什么数据库报错,删除后正常 [Database error, worked fine after deleting ____] Mar 22, 2024
@AuroraLS3
Copy link
Collaborator

You can copy data from one database to another with mysqldump or mariadbdump (depending on your database)

@xiaoluofa
Copy link
Author

8ca6519994 - Last occurred: 2024-03-22 Occurrences: 1
---- Context 1 ----
Plan v5.6 build 2825
Velocity 3.3.0-SNAPSHOT (git-62c6ec04-b367)
Server v3.3.0-SNAPSHOT (git-62c6ec04-b367)

Report this, there is an SQL Constraint Violation.
Transaction: class com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction
DB State: CLOSED - fatal: true
Error code: 1215
CREATE TABLE IF NOT EXISTS plan_allowlist_bounce (id integer NOT NULL AUTO_INCREMENT,uuid varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL UNIQUE,name varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,server_id integer NOT NULL,times integer NOT NULL DEFAULT 0,last_bounce bigint NOT NULL,PRIMARY KEY (id),FOREIGN KEY(server_id) REFERENCES plan_servers(id))
Constraint Violation

---- Stacktrace ----
java.util.concurrent.CompletionException: com.djrapitops.plan.exceptions.database.FatalDBException: com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction failed to execute and database could not be opened: SQL Failure: Cannot add foreign key constraint
java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java.base/java.lang.Thread.run(Thread.java:1583)
Caused by:
com.djrapitops.plan.exceptions.database.FatalDBException: com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction failed to execute and database could not be opened: SQL Failure: Cannot add foreign key constraint
com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction.executeTransaction(OperationCriticalTransaction.java:41)
com.djrapitops.plan.storage.database.SQLDB.lambda$executeTransaction$4(SQLDB.java:373)
com.djrapitops.plan.storage.database.DBAccessLock.performDatabaseOperation(DBAccessLock.java:61)
com.djrapitops.plan.storage.database.DBAccessLock.performDatabaseOperation(DBAccessLock.java:56)
com.djrapitops.plan.storage.database.SQLDB.lambda$executeTransaction$5(SQLDB.java:372)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java.base/java.lang.Thread.run(Thread.java:1583)
Caused by:
java.sql.SQLException: Cannot add foreign key constraint
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130)
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:912)
com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354)
plan.com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
plan.com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
com.djrapitops.plan.storage.database.transactions.ExecStatement.callExecute(ExecStatement.java:72)
com.djrapitops.plan.storage.database.transactions.ExecStatement.execute(ExecStatement.java:64)
com.djrapitops.plan.storage.database.transactions.ExecStatement.execute(ExecStatement.java:55)
com.djrapitops.plan.storage.database.transactions.Transaction.execute(Transaction.java:223)
com.djrapitops.plan.storage.database.transactions.Transaction.execute(Transaction.java:231)
com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransaction.performOperations(CreateTablesTransaction.java:62)
com.djrapitops.plan.storage.database.transactions.Transaction.executeTransaction(Transaction.java:89)
com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction.executeTransaction(OperationCriticalTransaction.java:36)
com.djrapitops.plan.storage.database.SQLDB.lambda$executeTransaction$4(SQLDB.java:373)
com.djrapitops.plan.storage.database.DBAccessLock.performDatabaseOperation(DBAccessLock.java:61)
com.djrapitops.plan.storage.database.DBAccessLock.performDatabaseOperation(DBAccessLock.java:56)
com.djrapitops.plan.storage.database.SQLDB.lambda$executeTransaction$5(SQLDB.java:372)
java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java.base/java.lang.Thread.run(Thread.java:1583)
java.base/java.lang.Thread.getStackTrace(Thread.java:2450)
com.djrapitops.plan.storage.database.SQLDB.executeTransaction(SQLDB.java:359)
com.djrapitops.plan.storage.database.SQLDB.setupDatabase(SQLDB.java:262)
com.djrapitops.plan.storage.database.SQLDB.init(SQLDB.java:162)
com.djrapitops.plan.storage.database.DBSystem.enable(DBSystem.java:103)
com.djrapitops.plan.PlanSystem.enableSystems(PlanSystem.java:181)
com.djrapitops.plan.PlanSystem.enableOtherThanCommands(PlanSystem.java:138)
com.djrapitops.plan.PlanSystem.enable(PlanSystem.java:176)
com.djrapitops.plan.PlanVelocity.onEnable(PlanVelocity.java:112)
com.djrapitops.plan.PlanVelocity.onProxyStart(PlanVelocity.java:94)
com.djrapitops.plan.Lmbda$118.execute(Unknown Source)
com.velocitypowered.proxy.event.UntargetedEventHandler$VoidHandler.lambda$buildHandler$0(UntargetedEventHandler.java:56)
com.velocitypowered.proxy.event.VelocityEventManager.fire(VelocityEventManager.java:597)
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
java.base/java.lang.reflect.Method.invoke(Method.java:580)
net.frankheijden.serverutils.dependencies.minecraftreflection.Reflection.invoke(Reflection.java:90)
net.frankheijden.serverutils.velocity.reflection.RVelocityEventManager.lambda$fireForPlugins$1(RVelocityEventManager.java:69)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
java.base/java.lang.Thread.run(Thread.java:1583)

@AuroraLS3
Copy link
Collaborator

The possible causes:

  • Database engine is different for different tables or InnoDB is not used

This can help https://stackoverflow.com/a/41603128/20825073

@AuroraLS3 AuroraLS3 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that contain unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants