Create a projection when another has been deleted with the same name.

Hi.
I wrote a projection then i deleted it. When i try to create another projection with the same name, the new projection has been created but the status stays to “Prepared/Initial”, i can’t use it, and i’ve got a log error :

[PID:00772:013 2014.05.14 12:17:54.044 ERROR QueuedHandlerMRES ] Error while processing message WRITE COMPLETED: CorrelationId: 948907eb-8e57-4bcd-b4ff-351d70b00ef1, Result: Success, Message: , FirstEventNumber: 2 in queued handler ‘Projections Master’.
System.Exception: Projection version and event number mismatch

Hi Catherine,

If you’re using version 2 of the Event Store then this is a side effect of not being able to reuse stream names (projections are internally stored as streams). If you use version 3 RC then you can do this.

Cheers,

James

Thanks

So i tried with the version 3 RC but it’s the same result and the status is “writing/initial”.

Did you try resetting the projection? I’m thinking deleting the projection does not delete the checkpoint.

Yes, but when the status is “Writing/Initial” i can’t do anything.

What’s the projection you’re running? I’ll test it here locally.

Hi

fromStream(‘Reservations’)
.when({
$init: function () {
return { body : ‘’, }; // initial state
},
ReservationEvent: function(s, e) {
if(e.data.NewReservation !==null)
{
if(e.data.NewReservation.User.Ent.Id == ‘20f3bac6-aa91-4a83-84a1-7f0fe2304b51’)
{
var monthReservation = new Date(e.data.NewReservation.StartDate).getMonth();
var monthReservationInsert = 1;
var yearReservation = new Date(e.data.NewReservation.StartDate).getFullYear();
var yearReservationInsert = 2014;
if((monthReservation == monthReservationInsert) && (yearReservation == yearReservationInsert))
{
s.body += e.bodyRaw;
return s;
}
}
}
}
})

I’m running this projection, it works fine the first time but doesn’t work when i delete and create it again. I’ve tried with the local interface 127.0.0.1:2113 and with an application .NET but i’ve always got the same errors.

Thanks

same thing here using EventStore-Mono-v3.0.0rc2 with the following projection :

fromAll()

.when({

GameCreated : function(s, e) {

linkTo(‘Proj-GamesList’, e);

return s;

}

})

with this command : command= mono EventStore.SingleNode.exe --db ./ESData --run-projections=all

If I see anything new I’ll keep you informed.

Thanks,

Whats the error on delete/recreate? events out of order?

I have a project that create a projection using :

var user = new UserCredentials(username, password);

var log = new EventStore.ClientAPI.Common.Log.ConsoleLogger();

var pm = new EventStore.ClientAPI.ProjectionsManager(log, httpendPoint);

var projectionsPath = ConfigurationManager.AppSettings[“projectionsPath”];

var proj = System.IO.File.ReadAllText( projectionsPath + “gameListProjection.js”);

pm.CreateContinuous(“gameListProjection”, proj, user);

when I run that on an eventstore already running it works fine.

If I restart the eventstore before having deleted the projection, I can see that its state goes from Writing/Initial state to running

If I delete then this projection using the admin web interface not checking delete checkpoint stream , neither delete state stream.

I receive an alert :

couldn’t delete the projection

reason : Not Found

The projection is deleted all the same it has disappeared from the projections list.

If i restart my project , the projection is created anew but hangs on the Writing/Initial state.

The db is a fresh one, no events saved so far. Do you need any logs?