-
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
influxdb3 show databases
incorrect json when no databases
#26057
Labels
Comments
mgattozzi
added a commit
that referenced
this issue
Mar 12, 2025
This fixes an issue when querying for data with no values would create incomplete JSON. This first showed up in #26057 due to `influxdb3 show database` having no data on a fresh run of the server. While the code we had, handled the fact that if there was no data written then we should have written `[]`, however, there was a subtle edge case we did not handle. If we got a record batch and wrote it into the writer we would expect it to then write the opening `[` even if there was no data. However, this was not the case. It would only do so once it was actually writing data or we called `finish` which doesn't work for us here since we're hacking around the API in order to stream data back. This took quite a while to track down, but the end result is a simple fix to a hard problem: if we're polling data for the first time and the first record batch is empty just write a `[` into the Body of the request. Our later code will handle closing the bracket and we're all good. If there is data then the JSON writer can handle it as normal. Closes #26057
mgattozzi
added a commit
that referenced
this issue
Mar 12, 2025
This fixes an issue when querying for data with no values would create incomplete JSON. This first showed up in #26057 due to `influxdb3 show database` having no data on a fresh run of the server. While the code we had, handled the fact that if there was no data written then we should have written `[]`, however, there was a subtle edge case we did not handle. If we got a record batch and wrote it into the writer we would expect it to then write the opening `[` even if there was no data. However, this was not the case. It would only do so once it was actually writing data or we called `finish` which doesn't work for us here since we're hacking around the API in order to stream data back. This took quite a while to track down, but the end result is a simple fix to a hard problem: if we're polling data for the first time and the first record batch is empty just write a `[` into the Body of the request. Our later code will handle closing the bracket and we're all good. If there is data then the JSON writer can handle it as normal. Closes #26057
mgattozzi
added a commit
that referenced
this issue
Mar 12, 2025
This fixes an issue when querying for data with no values would create incomplete JSON. This first showed up in #26057 due to `influxdb3 show database` having no data on a fresh run of the server. While the code we had, handled the fact that if there was no data written then we should have written `[]`, however, there was a subtle edge case we did not handle. If we got a record batch and wrote it into the writer we would expect it to then write the opening `[` even if there was no data. However, this was not the case. It would only do so once it was actually writing data or we called `finish` which doesn't work for us here since we're hacking around the API in order to stream data back. This took quite a while to track down, but the end result is a simple fix to a hard problem: if we're polling data for the first time and the first record batch is empty just write a `[` into the Body of the request. Our later code will handle closing the bracket and we're all good. If there is data then the JSON writer can handle it as normal. Closes #26057
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce:
List the minimal actions needed to reproduce the behaviour.
influxdb3 show databases --format json
without any databasesExpected behaviour:
Return valid empty array json
[]
Actual behaviour:
Return only closing bracket
]
The text was updated successfully, but these errors were encountered: