RavenDB on Ubuntu with Mono

664 views
Skip to first unread message

Beaker

unread,
May 22, 2012, 8:43:25 AM5/22/12
to ravendb
I know it's been done before, and I can see chunks of code in the git
repo where Mono is taken into consideration, but something is evading
me.

I have the latest stable Mono release, latest stable Mono Develop, and
the latest RavenDB source all on Ubuntu 12.04. I can compile just
fine. But when I try to run the server, it fails when it tries to
invoke the MEF calls for SatisfyImportsOnce. After doing a google
search, I found one other individual, about a year ago, who faced a
similar issue, who solved it, and then published his repo. Sadly, his
repo fails the same way. It's the same exact error
"MissingManifestResourceException".

Since I am new to RavenDB, and knew the MEF, but obviously you guys
have been working on this (or have gotten it to work) can someone
tell me what I am doing wrong?

Thanks!
Beaker

Oren Eini (Ayende Rahien)

unread,
May 22, 2012, 9:12:43 AM5/22/12
to rav...@googlegroups.com
This indicate that MEF had some issue, tried to throw an error, then threw an error trying to throw an error.

You need to look at the stack trace of the error to see if you can figure out what is wrong there.

Beaker

unread,
May 22, 2012, 9:54:26 AM5/22/12
to ravendb
There's only two ravenDB calls in the stack trace. I'll run them and
display -> I think I'm just going to need to step through the code to
get to the root of the problem. I think at the heart of this is going
to be some small fundamental difference between how mono and .NET
actually implement the MEF structure.

On May 22, 9:12 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
> This indicate that MEF had some issue, tried to throw an error, then threw
> an error trying to throw an error.http://lists.ximian.com/pipermail/mono-bugs/2011-June/112020.html

Oren Eini (Ayende Rahien)

unread,
Jun 24, 2012, 12:39:38 AM6/24/12
to rav...@googlegroups.com
Hi,
We intend to do major work on that post 1.2

If anyone wants to jump in, the major pieces would be building a transactional storage on top of BDB and then just testing.

On Sat, Jun 23, 2012 at 11:46 PM, clayton collie <gbo...@gmail.com> wrote:
Is there any movement on this. I really want to use Raven, but everything else in my infrastructure(rabbit, redis, etc) are geared toward linux.

clayton collie

unread,
Jun 24, 2012, 9:37:34 AM6/24/12
to rav...@googlegroups.com
May make for some interesting weekend hacking !!

Oren Eini (Ayende Rahien)

unread,
Jun 24, 2012, 9:59:01 AM6/24/12
to rav...@googlegroups.com
Agree, let us know if you need any help

Michael Weber

unread,
Aug 16, 2012, 12:33:37 PM8/16/12
to rav...@googlegroups.com
Is there a reason that transactional storage couldn't be built upon sqlite instead of bdb.  It seems like bdb is so low-level as to make the port much harder.

mike

Oren Eini (Ayende Rahien)

unread,
Aug 16, 2012, 12:35:46 PM8/16/12
to rav...@googlegroups.com
SQLite can't handle threading properly

Michael Weber

unread,
Aug 16, 2012, 12:55:50 PM8/16/12
to rav...@googlegroups.com
That's originally what I thought as well, but from their faq.

"SQLite is threadsafe. We make this concession since many users choose to ignore the advice given in the previous paragraph. But in order to be thread-safe, SQLite must be compiled with the SQLITE_THREADSAFE preprocessor macro set to 1. Both the Windows and Linux precompiled binaries in the distribution are compiled this way. If you are unsure if the SQLite library you are linking against is compiled to be threadsafe you can call the sqlite3_threadsafe() interface to find out."

Oren Eini (Ayende Rahien)

unread,
Aug 16, 2012, 12:57:03 PM8/16/12
to rav...@googlegroups.com
It is thread safe in the sense that it won't corrupt your data.
It isn't using thread properly because it is basically using locks all over the place.

Michael Weber

unread,
Aug 16, 2012, 1:03:28 PM8/16/12
to rav...@googlegroups.com
ah, got it

Michael Weber

unread,
Aug 17, 2012, 12:07:51 AM8/17/12
to rav...@googlegroups.com
Just a heads up that I have started hacking the storage engine for use with BDB.  I have gotten it to the point of being able to store a document and retrieve it, but that is about it, there's obviously quite a lot left to do, but it's a start.  I am using Berkeley DB for .NET (http://sourceforge.net/projects/libdb-dotnet/) as the .net interface to the native dll.  It's a BSD licence, so I hope that's compatible with RavenDB.

For anyone interested, you can track progress at  https://github.com/mweber26/ravendb/tree/bdb-storage 

mike

Oren Eini (Ayende Rahien)

unread,
Aug 17, 2012, 12:25:31 AM8/17/12
to rav...@googlegroups.com
That is just awesome

Oren Eini (Ayende Rahien)

unread,
Aug 17, 2012, 12:25:39 AM8/17/12
to rav...@googlegroups.com
Would love to see you write some posts about it

Itamar Syn-Hershko

unread,
Aug 17, 2012, 6:27:09 AM8/17/12
to rav...@googlegroups.com
A while back I did some reading on LevelDB and it seemed to be a better fit, and a more stable option. Worth comparing the two, especially in a multi-threaded scenarios.

On Fri, Aug 17, 2012 at 7:07 AM, Michael Weber <mtw...@gmail.com> wrote:

Michael Weber

unread,
Aug 17, 2012, 7:08:33 AM8/17/12
to rav...@googlegroups.com
I just poked around the code for LevelDB a bit and it looks like it has the same problem sqlite.  All multithreaded access is protected by global locks.  I will do some more digging through the code, but at first glance at least that's what it seems like.

mike

Michael Weber

unread,
Aug 17, 2012, 9:44:26 AM8/17/12
to rav...@googlegroups.com

Matt Warren

unread,
Aug 17, 2012, 12:17:49 PM8/17/12
to rav...@googlegroups.com
I also spent a bit of time looking at LevelDB

The main issue I found was that it doesn't support transactions (see https://groups.google.com/d/msg/leveldb/O_iNRkAoObg/GsDzBdjZ_McJ and http://stackoverflow.com/a/9037073/4500).

So transactions would have to be implemented as a custom layer on top of LevelDB. This is what IndexedDB does inside Chrome, you can see the code here  http://code.metager.de/source/xref/WebKit/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp

Oren Eini (Ayende Rahien)

unread,
Aug 17, 2012, 2:35:49 PM8/17/12
to rav...@googlegroups.com
Awesome.

Oren Eini (Ayende Rahien)

unread,
Aug 17, 2012, 2:36:22 PM8/17/12
to rav...@googlegroups.com
I already implemented transactions for Munin, that was... touchy.
It is something that I would like to avoid.

Oren Eini (Ayende Rahien)

unread,
Aug 17, 2012, 2:48:30 PM8/17/12
to rav...@googlegroups.com
Regarding your blog post.
Note that actually saving to disk is a bit more complex than that.
We no longer do things like this:

using(var ms = new MemoryStream()) { data.WriteTo(ms); dataBuffer = ms.ToArray(); } 

We have users that uses documents that are several MB in size, and we have to stream it to disk, instead of copying the data several times.

Also, you aren't using codecs here, which are required so we can use things like encryption & compression.

Also, what build are you working off?

Michael Weber

unread,
Aug 17, 2012, 3:15:24 PM8/17/12
to rav...@googlegroups.com
I don't know about streaming yet with respect to BDB, all examples seems to be full-buffer, but I will have to do more research to figure out streaming writing.

Yes, I am using the codecs, the code in that post is out-dated.

I am working off of the github master branch : https://github.com/ravendb/ravendb/tree/ 

Oren Eini (Ayende Rahien)

unread,
Aug 17, 2012, 3:56:47 PM8/17/12
to rav...@googlegroups.com
Please use the one from my fork, github.com/ayende/ravendb
The 1.2 branch

Michael Weber

unread,
Aug 17, 2012, 4:45:45 PM8/17/12
to rav...@googlegroups.com
Ok -- I will switch over to that branch (for the facet changes as well, and issue a new pull request).

It looks like there is a way to do partial writes in BDB.  I will try to figure out how to integrate it with c# streams.

Michael Weber

unread,
Aug 18, 2012, 8:06:59 PM8/18/12
to rav...@googlegroups.com
Oren,

After playing with the BDB port of the storage engine for a while now, I've begun to thing that some of the things that the storage engine is responsible for is duplicated in all storage engines.  For example: EnsureDocumentEtagMatchInTransaction or EnsureNotLockedByTransaction.  If the logic of these ever changes then changes to all storage engines have to be made.   It seems like this logic should be pulled out of the storage engine and the storage engine should simply be responsible for getting the data.  I was thinking something along the lines of:

interface IDocumentReader {
   Document FindDocument(string key);
   void AddDocument(Document a);
   void DeleteDocument(string key);
}

class Document {
public int MetadataSize { get }
public int DocumentSize { get }
public Guid Etag { get }
public Guid LockedByTransaction { get }
public string Key { get }
public DateTime LastModifiedTime { get }
public RavenJObject Metadata { get }
public Stream DocumentStream { get }
}

Again this is just an example and we would have to look a little closer at the operations.  Even a simple IDocumentStorageActions.AddDocument has tons of logic associated with verifying etags, checking for active transactions, this is complicated stuff and seems like it should be outside the storage engine.

mike

Oren Eini (Ayende Rahien)

unread,
Aug 19, 2012, 12:13:48 AM8/19/12
to rav...@googlegroups.com
There are some utility functions there that are used, but most of the time, those things are _really_ tied to the internal of how the storage engine actually does things.

Sergey Shumov

unread,
Jan 26, 2013, 10:19:05 AM1/26/13
to rav...@googlegroups.com
Any updates on the topic? https://github.com/mweber26/ravendb/commits/bdb-1.2 seems to be abandoned.

Michael Weber

unread,
Feb 9, 2013, 8:38:38 AM2/9/13
to rav...@googlegroups.com
It's not 100% dead, it was waiting on Oren to finish the final push for 2.0.  But it now looks like he may have other ideas for mono support.


mike

clayton collie

unread,
Feb 9, 2013, 9:57:07 AM2/9/13
to rav...@googlegroups.com

Oren Eini (Ayende Rahien)

unread,
Feb 10, 2013, 4:01:45 AM2/10/13
to ravendb
That looks nice, yes.


--
You received this message because you are subscribed to the Google Groups "ravendb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Khalid Abuhakmeh

unread,
Feb 13, 2013, 4:42:09 PM2/13/13
to rav...@googlegroups.com
Just read the link on BangDB. How would its performance match up to Esent. Would it be faster, and would it still be ACID?

Oren Eini (Ayende Rahien)

unread,
Feb 13, 2013, 4:48:20 PM2/13/13
to ravendb
No idea to all questions.

Matt Johnson

unread,
Feb 13, 2013, 5:42:27 PM2/13/13
to rav...@googlegroups.com
BangDB looks pretty awesome, but it's pure C++.  We would have to write our own managed wrapper assembly (C++/CLI).  BerkeleyDB already has a C# API.

Given the choice, I'd still go for BangDB - but there's certainly more work involved.

clayton collie

unread,
Feb 13, 2013, 5:46:00 PM2/13/13
to rav...@googlegroups.com
Only question, from a brief look at the API, is whether streaming/chunking is possible for large values. Didn't want to download the whole kit and kaboodle to find out.

Oren Eini (Ayende Rahien)

unread,
Feb 14, 2013, 1:31:49 AM2/14/13
to ravendb
Matt,
From the time that I deal with BDB C# API.
It was like swimming in the sewers.

Just to give you some ideas, The _esent_ managed library had a bunch of bugs in it that we discovered early on.
I shudder to think what is the current status there.

Oren Eini (Ayende Rahien)

unread,
Feb 14, 2013, 1:31:54 AM2/14/13
to ravendb
Not following you.

Ryan Heath

unread,
Feb 14, 2013, 2:48:58 AM2/14/13
to rav...@googlegroups.com
From the docu on that site it seams to always return the whole data blob/chunk when one calls the get method. But perhaps the docu is not thorough or not up-to-date with its current state. 

// Ryan

Sent from my iPhone 

Ryan Heath

unread,
Feb 14, 2013, 2:51:58 AM2/14/13
to rav...@googlegroups.com
Hmm, if we manage to create our own managed wrapper, we can at least control the odeur ;)

// Ryan


On Thursday, February 14, 2013, Oren Eini (Ayende Rahien) wrote:
Reply all
Reply to author
Forward
0 new messages