My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Example  
Hello world using tcerl.
Featured
Updated Jun 13, 2009 by paul.min...@gmail.com

Prerequisities

Example

% erl
Erlang (BEAM) emulator version 5.6.5 [source] [smp:2] [async-threads:0] [kernel-poll:false]

Eshell V5.6.5  (abort with ^G)
1> tcerl:start ().
ok
2> mnesia:start ().
ok
3> mnesia:change_table_copy_type (schema, node (), disc_copies).
{atomic,ok}
4> mnesia:create_table (testtab, [ { type, { external, ordered_set, tcbdbtab } }, { external_copies, [ node () ] }, { user_properties, [ { deflate, true }, { bucket_array_size, 10000 } ] } ]).
{atomic,ok}
5> mnesia:table_info (testtab, type).
ordered_set
6> mnesia:dirty_write ({ testtab, hello, world }), mnesia:dirty_read (testtab, hello).
[{testtab,hello,world}]
7> f (), Start = now (), [ mnesia:dirty_write ({ testtab, N, N }) || N <- lists:seq (1, 100000) ], End = now (), timer:now_diff (End, Start).
5590639
8> {ok, Port} = tcbdbsrv:get_tab (testtab), tcbdbets:sync (Port). 
ok
9>              
User switch command
 --> q
% ls -l Mnesia.nonode@nohost
total 1872
-rw-r--r--   1 pmineiro  admin     154 Jun 12 20:45 DECISION_TAB.LOG
-rw-r--r--   1 pmineiro  admin   48231 Jun 12 20:46 LATEST.LOG
-rw-r--r--   1 pmineiro  admin    9339 Jun 12 20:45 schema.DAT
-rw-r--r--   1 pmineiro  admin  892672 Jun 12 20:46 testtab.tcb
Comment by krzyszto...@gmail.com, Sep 20, 2008

If you shutdown Mnesia without flushing buffers it will not store all data on disk. It is good idea to sync a table with disk before leaving Erlang shell:

Port = mnesia_lib:val({testtab, tcbdb_port}), tcbdbets:sync(Port).

Comment by hbayhant...@gmail.com, Sep 21, 2008

The 4th command did not work for me. Erlang says {aborted,{no_exists,{testtab,cstruct}}}

(erlang 5.6.3, mnesia 4.3.5ext2)

Comment by ytakanos...@gmail.com, Sep 22, 2008

I encountered same error of "{aborted,{no_exists,{testtab,cstruct}}}".

Comment by menhelv...@gmail.com, Jan 26, 2009

As the two posts above I also got the error "{aborted,{no_exists,{testtab,cstruct}}}" at 4th command :(

My erlang installation directory is a custom one so I used the --prefix when I ran the ./configure. Before I start tcerl I make the command application:set_env(tcerl, tcerldrvprefix, CustomDir) so tcerl is able to load the driver. (Can the driver find tokyocabinet?)

What can be wrong?

My specs are: Debian Erlang/OTP R12B5? Mnesia 4.4.7 tcerl 1.3.1

Comment by menhelv...@gmail.com, Jan 28, 2009

I solved the issue above by recompiling tcbdbtab.erl and replaced the old .beam-file with the new one. After that it worked excellent.

Comment by bigzha...@gmail.com, Feb 24, 2009

In tcbdbtab.erl:

-include_lib ("mnesia/src/mnesia.hrl").

The fixed path there might cause you problems. Remove the fixed path for mnesia.hrl if you see badrecord error.

Comment by whw...@gmail.com, Mar 4, 2009

I'm a beginner of tcerl. 1. Now, I have installed mnesiaex mnesia-4.4.7.6, tcerl-1.3.1e and tcerldrv-1.3.1e under FreeBSD 7.1(i386) 2. In the Erlang shell, I get the following results: Eshell V5.6.5 (abort with ^G) 1> application:set_env(tcerl, tcerldrvprefix, "/usr/local"). ok 2> tcerl:start().

INFO REPORT==== 5-Mar-2009::10:38:07

application: tcerl exited: {shutdown,{tcerl,start,[normal,]}} type: temporary

{error,{shutdown,{tcerl,start,[normal,]}}}

Can anybody help me?

Comment by kptzoom@gmail.com, Mar 11, 2009

Check if the environment variable tcerldrvprefix has been correctly set:

application:get_env(tcerl, tcerldrvprefix).

Comment by kptzoom@gmail.com, Mar 24, 2009

Hello! I need to know whether tcerl has support for any bag type?

When creating a new table with type bag there a {atomic,ok} in response. And adding items goes fine, in terms of that there are no errormessage, although retrieving them can't be done... Shouldn't it be an error message when creating a table with unsupported types?

Regards Rickard

Comment by kptzoom@gmail.com, May 15, 2009

As #1 post,krzysztof.klis, said:

"If you shutdown Mnesia without flushing buffers it will not store all data on disk. It is good idea to sync a table with disk before leaving Erlang shell.."

The new command would be:

{ok, Port} = tcbdbsrv:get_tab(testtab), tcbdbets:sync(Port).

Comment by juliadot...@gmail.com, Oct 19, 2009

I found I had to

code:add_patha("/path_to/tcerl-1.3.1h/src").

Does that mean it didn't install properly or is that normal?


Sign in to add a comment
Powered by Google Project Hosting