lamp-town-guy

lamp-town-guy

Mnesia can't create disc copy

I’m running into problem with mnesia table creation. When I’ve called :mnesia.create_table/2 with option disc_only_copies: [Node.self()] I’ve got bad_type error. So I’ve tried :mnesia.change_table_copy_type/3. With bigger success. Now I’m getting {:aborted, {:has_no_disc, :nonode@nohost}} error.

I didn’t specify any host name.
Platform: Mac OS X, M2 CPU
Erlang: 26.0.2
Elixir: 1.15.5

Code snippet:

alias :mnesia, as: Mnesia
Mnesia.stop()
Mnesia.create_schema([Node.self()])
Mnesia.start()

Mnesia.create_table(Pulse,[
    type: :set,
#    disc_only_copies: [Node.self()],
    record_name: Pulse,
    attributes: @record_fields
])

Mnesia.change_table_copy_type(Pulse, Node.self(), :disc_copies)

Line commented out was used when I was creating table with disc persistence.

Most Liked

jchrist

jchrist

Is the directory where you’re running mnesia writable?

You may also want to try running with the environment variable ERL_FLAGS="-mnesia debug trace" set. That way mnesia will give you information about what it’s doing. (-mnesia debug verbose will be less noisy)

lamp-town-guy

lamp-town-guy

I’ve had this in my config. Which caused the bug. Right after I’ve removed mnesia config it just works. I’ve forgotten about it when I was testing elixir libraries interacting with mnesia.

config :mnesia,
  dir: ".mnesia/#{Mix.env()}/#{node()}"

Where Next?

Popular in Questions Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement