Wednesday, September 26, 2012

RavenDB Expiration Bundle

In RavenDB there is an expiration bundle.  This is great, think of it as a document retention policy.  Delete me in 90 days from now.  There is an issue in build 960 when you have both replication and expiration bundles installed.  Save ten documents test/1, test/2, and so on.  Set the expiration for 1 minute from now.

In Silverlight you will see the documents, but in 60 seconds you won’t.  The collection will still show a count of 10 documents.  Not the end of the world, the app still works, and no one can READ the documents that have expired.  But they still exist, they will be delete later.

Suppose you want to see the expired documents using the Expired Docs index.  Can’t the Read task prevents this from happening.  They are there and indexed, but there is a trigger that is preventing reads from happening.

This issue is fixed in the next release, but if you have a bunch of deletes on a large data set… it will be interesting to see if the counts are still a bit off in the admin console, possibly even query counts for pagination, just until the index catches up.

Sunday, September 23, 2012

RavenDB Replication

Doing some pre release testing or RavenDB Replication in build 960.  Thought I’d log and share my results.


  • Create Two folders 8080 and 8081
  • unzip code base into each one
  • In server folder –> create plugins folder
  • from bundles folder –> copy the dlls for  –> replication, expiration
  • copy in my custom replication conflict resolution dll
  • edit server config -> change ‘get’ to ‘all’
    • change port setting from * to 8080 and 8081 depending on which folder I’m in.
  • Start Servers –> things look good.
  • Testing
    • Stop and start servers, look at logs.


I have a series of single task executable files I need to run.  Some set up our environment, others push data.

Testing Create Tenants exe
  1. Run exe against server:8080 then server:8081
  2. Check to see if databases are there –> they are all good.
Replication Configuration and Testing
  1. Create a document Test/101 on server:8080, using the Silverlight tool.
  2. Configure Replication and Server:8081 –> follow help docs on
  3. Wait a bit -> type reset in command line –> nothing happens –> 8081 is not reaching out to 8080 and pulling in the documents
  4. Configure replication on server 8080 to reach out to 8081
  5. Still no replication happening
  6. Added document Test/102 to 8081
  7. Found the error, copy and paste problem
  8. Checking logs after fixed typo
  9. Documents are still not replicating – Adding document test/105 to 8080
  10. Replication was working, but was replication from server:8080/databases/ClientA to server:8081 /databases/default
  11. Changed the Raven/Replication/Destinations documents on both servers to
    {"Url": “http://dfrfrm025080:8080/databases/ClientA/”}
  12. Success, Replication is working.  Going to delete replicated records out of default database to prevent future confusion.
Replication Conflict Resolution Testing
  1. Turn off server:8081 –> using q command in console so I don’t get a bunch of index errors when I start again
  2. server:8080 edit Test/105 –> Change Name from “Jane” to “Tarzan” and Save
  3. Turn off server:8080
  4. start server:8081
  5. Make sure in ClientA database (database and tenant are about the same thing)
  6. Edit Test/105 –> change Name from “Jane” to “Superman” save
  7. Start Server:8080 and wait a bit for things to mesh
  8. Both documents say superman
  9. Now going to do the same thing but in reverse order, since the conflict resolution dll’s are installed on both servers.
  10. server:8081  test/105 – name “IronMan”
  11. server:8080  test/105 – name “Batman”
  12. Restarted both servers to speed things up
  13. Looks good now both say “Batman”
  14. Since I issued a restart, the test is not entirely valid, I’ll monitor this later when I start pushing large amounts of data.