-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[jdbc] Add console maintenance commands #13662
Conversation
209a5ea
to
466387d
Compare
3332fb9
to
a5d7e79
Compare
Nice, please add a jar when the addon is in a testable state can do some testing. My database has many issues so it is probably the best test case ever. ;-) |
Sure! Currently I'm progressing with the "auto-repair/cleanup" functionality. Basically I have it working, but I need to tidy up the code a bit and propagate results back to the console. I should be able to provide you with a JAR late evening. :-) |
@lsiepel - basic cleanup for trivial inconsistencies is now ready for testing; see updated description with link to JAR. Please test only on test databases for now. No documentation yet, but there is tab completion available, and the example in the description. Core 3.4M4 is needed because API for completion was added recently in openhab/openhab-core#3111. |
d7657c0
to
f35525c
Compare
Did some testing and have not found any flaw. I'm using 10.5.15-MariaDB-0+deb11u1 - Debian 11 Did some changes and manual fixes. Not something i actually tested yet; but i like the way the cleanup command is leaving the tables with row data as is. You might add a additional argument like 'jdbc forceclean' or similar to skip this rowcount check and force removal. Once the dryrun is completed i'll continue to do some testing. I did read most code and have not found anything specific to comment about. |
f35525c
to
618d39d
Compare
Should the tag "work in progress" be removed now ? |
I had the same thought, and already added that yesterday. 😄
I'm considering continuing with that in another PR to not let this one grow infinitely. So I would consider this PR as a base for additional console work. |
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
f0794b2
to
3a3fd67
Compare
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
ae31789
to
82e64e3
Compare
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
...ersistence.jdbc/src/main/java/org/openhab/persistence/jdbc/console/JdbcCommandExtension.java
Show resolved
Hide resolved
...openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/internal/JdbcMapper.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
* Add console command for listing tables * Query row counts only when needed and while generating output * Add cleanup command * Add documentation Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
* Add console command for listing tables * Query row counts only when needed and while generating output * Add cleanup command * Add documentation Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* Add console command for listing tables * Query row counts only when needed and while generating output * Add cleanup command * Add documentation Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* Add console command for listing tables * Query row counts only when needed and while generating output * Add cleanup command * Add documentation Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
* Add console command for listing tables * Query row counts only when needed and while generating output * Add cleanup command * Add documentation Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
This introduces some basic tools for verifying integrity of persisted items and corresponding tables.
Example
Test
JAR for testing: org.openhab.persistence.jdbc-3.4.0-SNAPSHOT.jar
Place the corresponding database driver into the addons directory. For example, download the MySQL connector and rename it to
mysql-connector-java.jar
or the MariaDB connector and rename it tomariadb-java-client.jar
.Resolves #13661