|
|
Comments and Discussions
|
|
 |

|
Hi,
First thanks for this great project. I've only started looking at it recently but I like what I see so far.
I was having issues retrieving a particular type of object from the db with the following stack trace
System.NullReferenceException: Object reference not set to an instance of an object.
at fastBinaryJSON.BJSON.CreateGenericList(List`1 data, Type pt, Type bt, Dictionary`2 globalTypes) in v1.8.3\RaptorDB.Common\fastBinaryJSON\BJSON.cs:line 508
at fastBinaryJSON.BJSON.ParseDictionary(Dictionary`2 d, Dictionary`2 globaltypes, Type type, Object input) in v1.8.3\RaptorDB.Common\fastBinaryJSON\BJSON.cs:line 426
at fastBinaryJSON.BJSON.ParseDictionary(Dictionary`2 d, Dictionary`2 globaltypes, Type type, Object input) in v1.8.3\RaptorDB.Common\fastBinaryJSON\BJSON.cs:line 453
at fastBinaryJSON.BJSON.ToObject(Byte[] json, Type type) in v1.8.3\RaptorDB.Common\fastBinaryJSON\BJSON.cs:line 171
at fastBinaryJSON.BJSON.ToObject(Byte[] json) in v1.8.3\RaptorDB.Common\fastBinaryJSON\BJSON.cs:line 149
at RaptorDB.RaptorDB.CreateObject(Byte[] b) in v1.8.3\RaptorDB\RaptorDB.cs:line 464
at RaptorDB.RaptorDB.Fetch(Guid docID) in v1.8.3\RaptorDB\RaptorDB.cs:line 219
After a bit of investigation in appears that it is because the object that I'm retrieving has a property with a public getter and a private setter. Changing this private setter back to being public fixed this issue but I'm trying to see if there is a better way of doing this? I'd prefer to not have to make this setter public.
Some sample code to show the structure of my object. In reality my code is a lot more complicated and the getter has a lot more logic in it so it's not possible to have the setter actually set the value of "property2".
public class Sample
{
public string property1;
private string _property2;
public string property2
{
get
{
return _property2;
}
private set
{
}
}
public Sample(string initProp)
{
_property2 = prop;
}
}
I get the error with the code above when I try to retrieve an object of type Sample. If I change the line "private set" to "set" then I can retrieve objects of type sample.
Thanks in advance for the help.
|
|
|
|

|
What are the chances a shared hosting provider is going to have this?
-MickeyB
|
|
|
|
|

|
Mehdi, Thanks for update 1.83. Is it possible to use the FullText attribute with a string field that consists of a single word? I get an IndexOutOfRange exception when I try to do so. For example, can a search of a forename field using Jo* return John, Joe etc?
|
|
|
|

|
Hi Mehdi.
I do not want to bore you. Sorry.
One of the most common operation using a storage system is to count objects/records that meet certain criteria or more simply to get a total count of objects present.
Your StorageFile's performances are very impressive but obviously deserializing object it's time and resources consuming.
In order to get a simple count of a very large set of object ViewHandler.Query method still creates a full populed list of objects. To get a count of milions object store could be very slow, could consume a very great qty of memory and only to get a simply "2,000,000 of record are presents" message.
If I can I'd like to submit to you a possible solution to lazyload data mantaining a fully backward compatible interface for the clients.
Obviously this is only one of the possible solutions ad a bit of additional work has to be done in order to be sure to make consistent the ViewHandler object state since data are loaded from the client.
The solution consist of a new class to be able to define a typed lazyload object (In this case I preferred to non use the System.Lazy class in order to have the complete control for implicit casting):
public class LazyLoader<T>
{
T value;
Func<T> loader;
public LazyLoader(T value) { this.value = value; }
public LazyLoader(Func<T> loader) { this.loader = loader; }
T Value
{
get
{
if (loader != null)
{
value = loader();
loader = null;
}
return value;
}
}
public static implicit operator T(LazyLoader<T> lazy)
{
return lazy.Value;
}
public static implicit operator LazyLoader<T>(T value)
{
return new LazyLoader<T>(value);
}
}
Result class changed as below
public class Result
{
private LazyLoader<List<object>> lazyRows = null;
public Result()
{
}
public Result(bool ok)
{
OK = ok;
}
public Result(bool ok, Exception ex)
{
OK = ok;
EX = ex;
}
/// <summary>
/// T=Values return, F=exceptions occurred
/// </summary>
public bool OK { get; set; }
public Exception EX { get; set; }
/// <summary>
/// Total number of rows of the query
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// Rows returned
/// </summary>
public int Count { get; set; }
public void SetLazyRows(LazyLoader<List<object>>
lazyResultRows)
{
this.lazyRows = lazyResultRows;
}
public List<object> Rows
{
get
{
return lazyRows;
}
set
{
this.lazyRows = new LazyLoader<List<object>> (value);
}
}
// FEATURE : data pending in results
///// <summary>
///// Data is being indexed, so results will not reflect
all documents
///// </summary>
//public bool DataPending { get; set; }
}
Some changes in Query e ReturnRows methods of ViewHandler class and a new Global variable to indicate if to use or not lazy loading... It's a bit frustrating to write code using this editor so if you 'd like to discuss about the matter we can choose an'other way to comunicate.
Thanks for your attention
Antonello
|
|
|
|

|
Inserting a large amount of data RabptorDB.FileLogger.Log method returns an "Source array was not long enough".
This could be caused by a bad access to to the _que member. To enque data in Queue the usafe code Array.Copy is used. in case of concurrent access from multiple threads to _que it's possible to get that kind of exception.
A possible solution could consist of lock the _que member directly instead of using different objects (_lock, _writelock) to syncronize access.
Below one possible solution to apply to FileLogger class methods involved.
Obviously it has to be evalued as valid.
public void Log(string logtype, string type, string meth, string msg, params object[] objs)
{
lock(_que) _que.Enqueue(FormatLog(logtype, type, meth, msg, objs));
}
private void WriteData()
{
if (_output == null)
return;
lock(_que) {
..
..
..
..
}
}
|
|
|
|

|
When Adding a new View on existing data or in order to rebuild index deleting the "view" folder ViewManager.RebuildFromScratch method is invoked.
MethodInfo view is never setted cause the bad BindingFlag used. "Insert" is marked as internal so BindingFlags.NonPublic must be added in order to get it.
Old statement in RebuildFromScratch method:
view = this.GetType().GetMethod("Insert", BindingFlags.Instance | BindingFlags.Public );
should be:
view = this.GetType().GetMethod("Insert", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic );
modified 18 Sep '12 - 10:06.
|
|
|
|

|
First of all. Great Work!!!
I'm experimenting RaptorDB but it seems to have some trouble using double type.
Storing a class containing double property i get an Null reference exception during page save process (IndexFile::SavePage) when I shutdown the engine.
"Double" type is not handled ( no corresponding handler is returned by RDBDataType.ByteHandler().Is there some reason ?
foreach (var kp in keys)
{
var val = node.tree[kp];
int idx = index + _rowSize * i++;
byte[] kk = _T.GetBytes(kp);
byte size = (byte)kk.Length;
if (size > _maxKeySize)
size = _maxKeySize;
My simple class :
public class BaseStore
{
public Guid UNIQUEID { get; private set; }
public BaseStore()
{
UNIQUEID = Guid.NewGuid();
}
}
public class TestClass : BaseStore
{
public int id { get; set; }
public String Description { get; set; }
public int intero { get; set; }
public decimal decimale { get; set; }
public float floating { get; set; }
public long lungo { get; set; }
public double doppio { get; set; }
}
[RegisterView]
public class TestClassView : RaptorDB.View<TestClass>
{
public class RowSchema : RaptorDB.RDBSchema
{
public int id { get; set; }
public String Description { get; set; }
public decimal decimale { get; set; }
public double doppio { get; set; }
}
public TestClassView()
{
this.Name = "TestClass";
this.Schema = typeof(RowSchema);
this.isActive = true;
this.isPrimaryList = true;
this.AddFireOnTypes(typeof(TestClass));
this.Mapper = (api, docid, doc) => { api.Emit(docid,doc.id, doc.Description,doc.decimale,doc.doppio); };
}
}
Any Idea ?
Best Regards
Thanks in advance
Antonello
modified 18 Sep '12 - 5:24.
|
|
|
|

|
Hi,
How does RaptorDB compare to RavenDB?
(sorry if the question has been asked before)
Thanks
John
|
|
|
|

|
Mehdi, thanks for your help. In your example application, it would appear that the Class LineItem must have a default constructor. Changing the class definition to initialise its properties by way of arguments in the constructor seems to give rise to a null reference exception when inserting data in server mode. Is this correct? Regards, George.
|
|
|
|

|
I am working in NLP, have similar engineering background than you, once programmed 65xx (Rockwell/Commodore) µP, also did a lot of Pascal (USCD) Delphi, wrote some Database myself (non-sql in Pascal) on the '80s
The fast indexing Bit-mechanism might be used to implement a simple (but fast) RDF storage system (triplets) and implementing some sort of super-fast queries like SPARQL, to make good reasoning systems. Backchaining and Formward chaining algorithms suffer from database access time, and here the thing might be solved in a glimpse!
If you want, check my website (sorry in Spanish) but some Articles are in plain english! and Goggle Translate is very good to take a look to my ideas adn work, mighjt be interested by curiosity!
My Personal Page is there[^]
best!
|
|
|
|

|
Hi,
I created a database of 100,000 records, then I tried to insert other 100,000 records, but I got an error after some seconds. Please help!
Thanks a lot
p/s: Here's the stacktrace
System.AggregateException was unhandled
Message=A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.TaskExceptionHolder.Finalize()
InnerException: System.ArgumentNullException
Message=Value cannot be null.
Parameter name: key
Source=System
ParamName=key
StackTrace:
at System.Collections.Generic.SortedList`2.IndexOfKey(TKey key)
at System.Collections.Generic.SortedList`2.Remove(TKey key)
at RaptorDB.Common.SafeSortedList`2.Remove(T key) in D:\raptordb-8cae451eb90e\RaptorDB.Common\SafeDictionary.cs:line 104
at RaptorDB.MGIndex`1.SplitPage(Page`1 page) in D:\raptordb-8cae451eb90e\RaptorDB\Indexes\MGIndex.cs:line 385
at RaptorDB.MGIndex`1.Set(T key, Int32 val) in D:\raptordb-8cae451eb90e\RaptorDB\Indexes\MGIndex.cs:line 159
at RaptorDB.TypeIndexes`1.Set(Object key, Int32 recnum) in D:\raptordb-8cae451eb90e\RaptorDB\Indexes\Indexes.cs:line 23
at RaptorDB.Views.ViewHandler.IndexRow(Guid docid, Object[] row, Int32 rownum) in D:\raptordb-8cae451eb90e\RaptorDB\Views\ViewHandler.cs:line 549
at RaptorDB.Views.ViewHandler.InsertRowsWithIndexUpdate(Guid guid, List`1 rows) in D:\raptordb-8cae451eb90e\RaptorDB\Views\ViewHandler.cs:line 513
at RaptorDB.Views.ViewHandler.SaveAndIndex(Dictionary`2 rows) in D:\raptordb-8cae451eb90e\RaptorDB\Views\ViewHandler.cs:line 149
at RaptorDB.Views.ViewHandler.Insert[T](Guid guid, T doc) in D:\raptordb-8cae451eb90e\RaptorDB\Views\ViewHandler.cs:line 141
at RaptorDB.Views.ViewManager.<>c__DisplayClass2`1.b__0() in D:\raptordb-8cae451eb90e\RaptorDB\Views\ViewManager.cs:line 126
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
|
|
|
|

|
Thanks for the interesting article.When running in Server Mode, I get the following exception when adding items in the sample application
System.InvalidCastException: Unable to cast object of type 'SampleViews.SalesInvoice' to type 'System.Object[]'.RaptorDBServer.cs:line 92. Best wishes.
|
|
|
|

|
Well written article 5'd
|
|
|
|

|
Hi!
I was trying to use RaptorDB in a hobby project of mine but I can't figure out how to properly use query filter. It's most likely because Im doin someting wrong
string hash = "0fc78f69a080459b142c31f6ce7637db";
Expression<Predicate<MyTable>> qFilter = ( MyTable s ) => (s.hash == "0fc78f69a080459b142c31f6ce7637db");
Expression<Predicate<MyTable>> qFilterParam = ( MyTable s ) => (s.hash == hash);
var q1 = rdb.Query ( typeof ( MyTableView ),(MyTable s) => (s.hash == "0fc78f69a080459b142c31f6ce7637db"));
var q2 = rdb.Query ( typeof ( MyTableView ),qFilter);
var q3 = rdb.Query ( typeof ( MyTableView ),qFilterParam);
q1 and q2 both works but as soon as I try to use a variable (hash) the query throws an expection "Specified cast is not valid.".
Any hints on what Im doin wrong ?
Br
Jimmy
|
|
|
|
|

|
For the life of me I couldn't get the LINQ parser to work right.
So, I had to do a work-around:
static void read_corporation()
{
RaptorDB.RaptorDB p = RaptorDB.RaptorDB.Open( @"C:\WhizbangComputers2\RapDoc" );
p.RegisterView( new CorporationView() );
IRaptorDB rap = p;
var q = rap.Query( typeof( CorporationView ) );
IQueryable<CorporationView.RowSchema> empList = q.Rows.Cast<CorporationView.RowSchema>().AsQueryable();
var el = empList.Where( c => c.name == "CCC Company" ); Console.WriteLine( "read number of corporation rows: " + q.Rows.Count );
Console.ReadLine();
}
"Try?! Try, Not! Do... or DO NOT!!" - Master Yoda
"Learn=>Know... Know=>Learn... " - YO, Foo!!
|
|
|
|

|
Is RaptorDB thread safe? Can I issue multiple concurrent saves and reads with out possibility of dead lock? If so, how does it handle shared file locking?
|
|
|
|

|
What's the best way to handle the inclusion of enumerations into the RowSchema object?
Thanks
"Try?! Try, Not! Do... or DO NOT!!" - Master Yoda
"Learn=>Know... Know=>Learn... " - YO, Foo!!
|
|
|
|

|
Since this is far and above the most simple of all the "NoSQL" dB's I've found (and the fastest, too), I've decided to start playing around with it.
I like to make all my Entity objects of type struct so that they are completely initialized and they should run orders of magnitude faster than their heavier counterparts, classes.
Unfortunately, I get an Error in BJasonSerializer WriteObject() on this line of code:
var o = p.Getter(obj);
The error is: System.Security.VerificationException: Operation could destabilize the runtime.
That said, however, it works beautifully with classes so it looks like that's what I'll be sticking with. No party tonight! Ha! Ha!
Can I put this on the "Wish List" for the next iteration?! That'd be Awesome!!
Thank you, kindly.
"Seeing The Vision Clearly"
|
|
|
|

|
On codeplex you use GPLv2 and here CPOL license.
I think it would make sense to use only one license project.
Also LGPL would be better because else everyone would have to open-source their applications using RaptorDB, too.
|
|
|
|

|
This is absolutely amazing stuff. The examples look very easy to use; too. Great job! Can't wait to use it on my new Site! Thank you!
|
|
|
|
|

|
Hi Mehdi,
Does the design of the Raptor bitmap index allow the possibility of supporting K Nearest Neighbor (KNN) searches? I noticed that this "hierarchical" bitmap index supports it, but maybe a very different animal to Raptors bitmap index method?
I may of asked this previously quite a while ago, apologies if so (I could not remember/see any post history here for me).
--
Keith
|
|
|
|

|
Looks very interesting and worthy of at least 5. Will bookmark and review later but nicely done.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|

|
I've recently come across a very fast compression algorithm that might be an interesting alternative to LZ0.
Because you are using LZ0, and all of your articles posted here are very fast and awesome, I felt you might be interested in checking it out.
http://code.google.com/p/lz4/[^]
|
|
|
|

|
Very interesting stuff, interesting project and reading, well written article. It has very important rationale, well explained.
I can see one problem with the logo and name, but I'm afraid it's too late. The word "raptor" informally means an animal from velociraptor genus, which is well known, its appearance is also pretty well known and… it looked very far from the image shown on the logo. First thing I did after a first look at the article: the logo image seemed suspicious to me, so I immediately found it in Wikepedia to see how the animal looks. If you ever think about re-branding it, take it into account.
Thank you for sharing.
—SA
Sergey A Kryukov
|
|
|
|

|
Very good project! Thanks! Very inspirational
|
|
|
|
|

|
This project is an excellent computer science tutorial as well as a great utility.
Well done.
|
|
|
|

|
Great article, great database
However, could you add optional removal of deleted documents from the database files, when updating/deleting?
I ask because my database file would grow bigger and bigger if I would use it for my purpose. I'm developing a mmorpg game server, and want to save the player state every 5 minutes.
|
|
|
|

|
I read your other articles, excellent and well explained. A little appreciation, my 5!
|
|
|
|

|
Hi. First, your DB looks great, and I'm looking into how I can use it for a new project.
For this project the user can enter through various screens (wizard like interface) data. The trick is that multiple passes thru the wizard together form a block of data which must be processed as one item (or fail) - just like transactions.
The RaptorDB doesn't support transactions (by design) so I wonder if that would rule out your DB for this kind of processing. The other attributes of it are appealing, but 'transaction-like processing' is required for what I need to build. Any ideas?
|
|
|
|

|
Nice article. Thanks for posting to CP!
|
|
|
|

|
Just wondering why RegisterView returns a status object instead of throwing on failure...
rap.RegisterView(new SalesItemRowsView()).OK == false
Just curious.
|
|
|
|

|
Hi Mehdi,
It's me again .
I think a general database running life-cycle shall be like this:
db.start();
db.doSomething();
db.shutdown();
As you know, rap don't have a start function.Yes,it has a Open function,when invoke this function, rap will running background indexing(before indexing finish, db is not ready for querying, I mean we can't execute our query base on the full records), and we never know when this indexing will finish. We can't always guess things. we shall have a function like db.ready() or something else to tell us the indexing is finish and database is ready for querying.
My advice is add a start() function, when we pass this step, everything is ready to go.
Thanks,
Jack
|
|
|
|

|
First of all, let me say that this looks fantastic and you have my 5!
Can RaptorDB deal with views that are not known at compile time?
Background:
I have an application that currently gives the user the ability to add modify the structure of my Document object by adding fields to it at run time. It has a core set of properties and a collection of user defined ones. The user defined property values are simply stored in a dictionary when they are retrieved from the database.
Procrastination can be fun - Just wait and see.
|
|
|
|

|
There are two aspects to migration to new versions - RaptorDB updates and MyApplication updates.
Can a new RaptorDB version use the files of a previous - or is the answer, it depends.
Does that mean it would be wise to use a loader that reads from old and writes to new instances.
In the case of new versions of MyApp where entities have new fields, in SQL DBs you add a column and populate with default data.
What happens for RaptorDB - is a loader the best method?
thanks
John
|
|
|
|

|
First of all, great job!!! I vote 5 stars.
I found below issue:
If you rerun the test case in the second time and comment below code:
which mean we don't need to add any new data in the second round.
You will find below query is incorrect:
"
q = rap.Query("SalesItemRows", (LineItem l) => (l.Product == "prod 1" || l.Product == "prod 3"));
Console.WriteLine("Count = " + q.Count);
"
Count value always be 0, but we have fill 100000 records in the first round test. Could you double check and fix it?
thanks,
Jack
|
|
|
|

|
Good article, thanks for sharing!
|
|
|
|

|
Hi,
Very thought provoking article - I'm definitely a relational DB guy....
In a Business App, if a user accesses Customer's Order's Details and it's not quite up to date yet, can the end user be informed or the client enforce a wait?
How does Raptor compare with VistaDB and Eloquera?
Thanks
John
|
|
|
|

|
First of all hi there and many thanks for a great article. I am trying to develop a database that will mainly be used to save image files (.bmp,.jpeg,etc) and was wondering how RaptorDB deals with these file formats.
Thanking you in advance
Cheers
Peter
|
|
|
|

|
This is a must read for those learning Nosql, thanks for sharing, Mehdi
|
|
|
|

|
Good job and Thanks for explaining the LINQ provider.
|
|
|
|

|
You finally got that LINQ provider kicked! Awesome! I could tell it was bugging you, and I know how great it feels to win personal battles like that! Kick ass, as usual. (Excuse my american colloquial phraseology.)
|
|
|
|

|
Looks very promising. I remember reading in one of your previous articles that RaptorDB does not update previous records. Does this version allow records to be updated?
Did you have a chance to look at the IQueryable Toolkit (http://iqtoolkit.codeplex.com/) for the LINQ implementation?
modified 30 Apr '12 - 2:21.
|
|
|
|

|
Nice work!
I am sure I will find a number of uses for this
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|

|
Looks cool, but before I dive in too much I'm wondering about licensing. On the codeplex site it says the license is GPLv2 (which means I most likely won't be able to use it), but this article says the source is CPOL. Which is it?
|
|
|
|

|
You recently released v2.4, but this is labelled 1.0.
Are they different branches?
|
|
|
|

|
Excellent article on your brilliant raptorDB
|
|
|
|

|
Excellent, again
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
NoSql, JSON based, Document store database with compiled .net map functions and automatic hybrid bitmap indexing and LINQ query filters (now with standalone Server mode, Backup and Active Restore, Transactions, Server side queries, MonoDroid support)
| Type | Article |
| Licence | CPOL |
| First Posted | 29 Apr 2012 |
| Views | 159,539 |
| Downloads | 5,277 |
| Bookmarked | 230 times |
|
|