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

list_databases immediately after InfluxDB creation throws error #9

Open
MarcMush opened this issue Mar 12, 2021 · 0 comments
Open

list_databases immediately after InfluxDB creation throws error #9

MarcMush opened this issue Mar 12, 2021 · 0 comments

Comments

@MarcMush
Copy link
Contributor

MarcMush commented Mar 12, 2021

I don't know if this should really considered a bug, but I scratched my head quite a lot on this, before understanding what was happening so here it is:

calling list_databases immediately after creation of an empty influxdb docker throws an error.

I guess the influxdb didn't create its default database _internal yet, so the field "values" doesn't exist in influx's responses

julia> using InfluxDB

julia> begin
       global container_id = chomp(read(`docker run -d --rm -p 8086:8086 influxdb`, String))
       list_databases(InfluxServer("localhost"))
       end
ERROR: KeyError: key "values" not found
Stacktrace:
  [1] getindex
    @ .\dict.jl:482 [inlined]
  [2] (::InfluxDB.var"#series_df#17")(series_dict::Dict{String, Any})
    @ InfluxDB ~\.julia\packages\InfluxDB\xL7Dy\src\server.jl:73
  [3] _broadcast_getindex_evalf
    @ .\broadcast.jl:648 [inlined]
  [4] _broadcast_getindex
    @ .\broadcast.jl:621 [inlined]
  [5] getindex
    @ .\broadcast.jl:575 [inlined]
  [6] macro expansion
    @ .\broadcast.jl:984 [inlined]
  [7] macro expansion
    @ .\simdloop.jl:77 [inlined]
  [8] copyto!
    @ .\broadcast.jl:983 [inlined]
  [9] copyto!
    @ .\broadcast.jl:936 [inlined]
 [10] copy(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, InfluxDB.var"#series_df#17", Tuple{Vector{Any}}})
    @ Base.Broadcast .\broadcast.jl:908
 [11] materialize
    @ .\broadcast.jl:883 [inlined]
 [12] query(server::InfluxServer, query_data::Dict{String, String}; type::Symbol)
    @ InfluxDB ~\.julia\packages\InfluxDB\xL7Dy\src\server.jl:79
 [13] query
    @ ~\.julia\packages\InfluxDB\xL7Dy\src\server.jl:49 [inlined]
 [14] #query#19
    @ ~\.julia\packages\InfluxDB\xL7Dy\src\server.jl:83 [inlined]
 [15] query
    @ ~\.julia\packages\InfluxDB\xL7Dy\src\server.jl:83 [inlined]
 [16] list_databases(server::InfluxServer)
    @ InfluxDB ~\.julia\packages\InfluxDB\xL7Dy\src\database.jl:8
 [17] top-level scope
    @ REPL[2]:3

julia> list_databases(InfluxServer("localhost"))
1-element Vector{DataFrames.DataFrame}:
 1×1 DataFrame
 Row │ name
     │ String
─────┼───────────
   1 │ _internal

On my computer, it takes 10 to 15 seconds for the database to initialize

julia> begin
       global container_id = chomp(read(`docker run -d --rm -p 8086:8086 influxdb`, String))

       a = true
       @time while a
           a = try
               list_databases(InfluxServer("localhost"))
               false
           catch
               sleep(1)
               true
           end
       end
       end
 12.534306 seconds (5.61 k allocations: 529.078 KiB)

At least a more explicit error message would be helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant