alter database prints "command failed" even when everything is ok

Open Beginner friendly
#9,317 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
cli, databases

Research direction

Start in tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java, specifically sqlcommand, and reproduce the ALTER DATABASE TIMEZONE command shown in the issue. Trace how the command handles results when output is suppressed. Done means a successful command prints a success message rather than "Command failed."

Written by the indexing model from the issue text.

Description

OrientDB Version: 3.1.0 and develop (b15f84f1400c26a7895999bf4194555c7fbcd039)
Java Version: 8
OS: debian testing

Expected behavior

$ ./bin/console.sh
orientdb> create database plocal:databases/test
orientdb {db=test}> alter database TIMEZONE "Europe/Paris"

Everything is OK

Actual behavior

It actually works, but it shows
"Command failed."

Investigation

Being new to orientdb, I spent several hours trying to understand what I did wrong. I eventually debugged the code to understand what I did wrong.

After the command successfully ends, the code in tools/src/main/java/com/orientechnologies/orient/console/OConsoleDatabaseApp.java/sqlcommand

Writes command failed because it is asked to avoid printing the results and the code looks like

if (iIncludeResult)                                                                                                                    |                                                                                      
  message(iMessageSuccess, result, elapsedSeconds);                                                                                    |                                                                                      
else                                                                                                                                   |                                                                                      
  message(iMessageFailure, elapsedSeconds);   

Therefore, everything is ok but the code still writes "command failed"...

Dominant language
Java
Stars
5k
Forks
868
Avg merge
15h 6m
Merged PRs (30d)
18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from orientechnologies/orientdb

All issues in orientechnologies/orientdb

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.