How do I use DocumentDatabase.StartBackup() in conjunction with an RavenDB EmbeddableDocumentStore? - automation

I read the Backup and Restore doc at RavenDB website and tried it in my code.
In the doc we have:
Initiating a backup
When running in embedded mode, all you need is to call the method
DocumentDatabase.StartBackup().
The above line of code just won't compile with error:
An object reference is required for the non-static field, method, or property
'Raven.Database.DocumentDatabase.StartBackup(string, bool)'
So I tried this just to test:
new DocumentDatabase(_documentStore.Configuration).
StartBackup(#"~\App_Data\Backup", true);
The code compiles but when the app starts I get this error:
Could not open transactional storage: C:\Project\trunk\MyApp\App_Data\Database\Data
Can someone please share some working code about how can one do a full backup of an online embedded document store? Is it even possible without using RavenDB server?
My only option is doing a manual backup of the database folder?

Leniel,
You need to use the StartBackup method on the actual instance that you are running.
If you are using the EmbeddableDocumentStore, you need to do:
embeddableDocumentStore.DocumentDatabase.StartBackup(...);

Related

Cusom Activity in Azure data factory

I am creating c# program and want to execute it from custom activity azure data factory. However, I am not getting the steps that I should follow.
I have followed a Microsoft site for the same, but the steps are not clear. So please help.
The deployment happens at runtime. Basically, Data Factory passes the executable to the Batch service. If you haven't already done so, create an Azure Batch Linked Service to your Batch Account and reference it in the Custom Activity's "Azure Batch" tab.
You will need to load the executable package to a folder in Azure Blob Storage. Make sure to include the EXE and any dependent DLLs. In the "Settings" tab, do the following:
Reference the Blob Storage Linked Service
Reference the folder path that holds the executable(s).
Specify the command to execute (which should be the ConsoleAppName.exe).
Here is a screen shot of the Settings:
If you need to pass parameters from ADF to Batch, they are called "Extended properties", and are handled differently in your Console app than typical parameters. More information can be found at this answer.

IBM Urbancode Deploy - Supply values to parameters at runtime using properties

I have created a process in IBM UCD to deploy a .Net application.
My Scenario is that i should be able to provide different application name at run time each time i run the process. How can we do this using property in IBM UCD.
I have tried enabling "Prompt on use" option and also created component property and mapped it to the parameter say ${p:component/application.name} but doesn't seem to work. May be i missing out some sequence of steps.
It would be great if i get detailed steps to making this working.
I take it that you are on version 4.x (uDeploy)?
I would steer clear of the prompt on use approach, that feature was removed in 6.x. While there is a migration in place, its simpler to just avoid it.
Using a property on the component process itself is the way to go. So go to your process configuration, and go to the properties / configuration tab. Create a property there. You'll be prompted for a value whenever you run an application process that uses this component process.
If the property is named "iis.app.name" you would reference it with just ${p:iss.app.name}.
Don't use the property "application.name". That is an automatically created property that gets the name of the UCD Application that you are deploying. If you ever can't find out the right way to reference a property, look at your executed process (at component / application levels). The normal view that lists out all the steps that were run and how long they took is sitting on a tab called "Log". Right next to it is "Properties" tab. Click that and you'll see what properties were available to the process.
Also, you'll have better luck getting fast answers about UC Deploy using their own forum: https://developer.ibm.com/answers/?community=urbancode
Did you tried using process plugin for updating the property file ?
Application >> Process >> Select Process >> Process Editor -- From left panel you can Utility plugins , try with update property option.

Squirrel SQL Exception Logging

I am developing a JDBC driver which is a wrapper for a web service. My unit tests work fine and I can write my own Java code that uses the driver to do useful things.
When I plug it into Squirrel SQL it is able to connect and get its initial batch of metadata (properties, schemas/catalogs, etc), but a simple SELECT query does not work. I receive an InvocationTargetException. This means a reflective call failed inside the method or constructor being invoked: this exception always wraps another exception which shows what really failed.
However, the error window in Squirrel SQL simply shows the exception name: no wrapped exception/cause, no stack trace. The log in my user directory contains no information regarding what happened.
Looking through the global properties and connection properties, I have not found any settings that would increase logging. I am using Squirrel SQL version 3.5.3 on Java 7 64-bit, Windows 7 64-bit.
How can I get Squirrel SQL to provide more information to help me find the cause of this error? I do not care if it outputs to the log file or the error window, just so I have something to go by.
The easiest way to change the log level is to edit the log4j.properties file. This file is in the same folder as the batch file that starts SquirrelSQL.
Simply change the line
log4j.rootLogger=info, SquirrelAppender
to
log4j.rootLogger = debug, SquirrelAppender

PouchDB corruption detection

I am building up a webapp with offline functionality. I am using combination of webcache and pouchDB to achieve it.
Currently I am testing recovery mechanisms against DB corruption. My premise is that since pouchDB is running in client, it is exposed to anyone who by mistake or on purpose can corrupt the DB. Also maybe in case of bugs or similar, DB could get corrupted. Then, if DB gets corrupted, unless it gets detected and clean by webapp, this will never work correctly.
Test is quite simple:
- Create PouchDB:
var dbOptions = {
auto_compaction : false,
cache : false
};
var db = new PouchDB('myDB',dbOptions);
With Developer Tools delete part of the database.
On loading the application it tries to read all documents:
db.allDocs({include_docs : true}, function(_err,_response){
(certain code here)
}
It is at this point when "Uncaught TypeError: Cannot set property '_rev' of undefined " is thrown. I tried to catch exception and using provided promise by pouchDB but none did work.
Did any of you fellows have similar problem? How did you solve it?
EDIT:
When PouchDB returns 500 Internal error, how is the application supposed to recover from it? I tried to destroy the database
db.destroy(function(err,info){console.log(err||info);}
but it does not work. It returns 500 Internal error as well.
It indeed sounds like your database got corrupted. Sorry about that; we try to write bulletproof code, but since we're working against the WebSQL/IndexedDB APIs, there's always the possibility that something goes wrong at that interface, the browser crashes, lightning strikes your computer, etc.
500 errors indicate an internal PouchDB error, so you're not supposed to recover from them. Probably the best way to protect against corruption like that is just to set up continual sync with a CouchDB server (kind of the point of PouchDB anyway). CouchDB is a full database implemented from top to bottom and is very robust – since it uses append-only database files, your database can never get corrupted. So if you use continuous sync, you can always delete the PouchDB database and recover from CouchDB.
That being said, if you could let us know which version of PouchDB you're running, which browser you saw this on, or even a code snippet to reproduce, that would be really helpful. If you're using Firefox, you can also send us the storage files themselves for IDB by following the instructions here to find the Profile folder and then sending us the contents of the storage/persistent/<my_site>/idb folder. Thanks!
I got this error while adding a new schema to my RxDB database. It turned out I included the primary key and wrong property names into encrypted fields. I removed the primary key and put proper names and it worked fine after that.

Write files to S3 through Java

I have a program which takes input from S3, generates a text file, and then sends it to the mapper class. I am unable to write the file to S3, from where the mapper can read it later. Now, I realize that we cannot write files to S3 directly, so I am trying to upload the text file created to S3 using copyFromLocalFile(). However, I get a null pointer exception in the following line:
fs.copyFromLocalFile(true, new Path(tgiPath), mapIP);
I am creating the text file in main function, so I am not sure where exactly it's being created. The only reason behind the null pointer exception, that I can think of is that the text file is not being written on the local disk. So my question is: How do I write files on the local disk? If I just specify the name of the file while creating it, where is it created and how do I access it?
Have a look at Jets3t
This seems to be exactly what you need.
Jets3t is awesome, but I am using Google's App Engine, and it doesn't work on there because of threading limitations.
I banged my head against the wall until I came up with a solution that worked on App Engine by combining a bunch of existing libraries: http://socialappdev.com/using-amazon-s3-with-google-app-engine-02-2011