These are chat archives for damianh/Cedar

16th
Jul 2015
blob
not sure how to get around ILMerging NPgsql, might replace the ctor with a connection string or connection string name...
Dan Barua
@danbarua
Jul 16 2015 10:08
Now porting events from NEventStore...
Damian Hickey
@damianh
Jul 16 2015 11:54
I don't think you need to ILMerge NPgsql, think I'd be happy with it being a transitive dependency.
Dan Barua
@danbarua
Jul 16 2015 12:00
I'm using the nightly v3 build (for now) for async support
other users may be on v2
sorry
better
for now it's just me heh
var expectedVersion = commit.StreamRevision == 1 ?
  ExpectedVersion.NoStream  :
   commit.StreamRevision - 2; //NEventStore stream version is 1-based, also we are always one event ahead

                    newStore.AppendToStream(
                        newStreamId, 
                        expectedVersion,
                        commit.Events.Select(
                            e =>
                            new NewStreamEvent(
                                Guid.NewGuid(), e.Body.GetType().FullName, JsonSerializer.SerializeToString(e.Body), JsonSerializer.SerializeToString(e.Headers))))
                            .Wait();
that commit.StreamRevision - 2 had me scratching my head for a while
slow brain day today
Damian Hickey
@damianh
Jul 16 2015 12:11
lol
GES is 0 based, hence that change
Dan Barua
@danbarua
Jul 16 2015 12:31
got a weird one here
it throws WrongExpectedVersionException, and when i query the stream in question in PgAdmin, it's a few events behind
query again, it's now at the expected version
Damian Hickey
@damianh
Jul 16 2015 12:59
hmm
Dan Barua
@danbarua
Jul 16 2015 13:12
going to play around with isolation levels
it's one stream in particular though so it may not be the lib
weirdness
The name 'currentVersion' does not exist in the current context
some vars not viewable in the debugger o_0 must be some async shenanigans
oh yes that's because i'm debugging the lib from my app, doh
Damian Hickey
@damianh
Jul 16 2015 13:17
would prob kick the tyres on this with the npgsql v2 libs
Dan Barua
@danbarua
Jul 16 2015 13:18
yeah i was contemplating that
can't remember if async was in v2
async is there, no bulk import
premature optimization and all that
will go back to one-by one inserts
Dan Barua
@danbarua
Jul 16 2015 13:42
Should StreamVersion be changed to a long?
Damian Hickey
@damianh
Jul 16 2015 13:47
Thought about that ...
but if you hit int.max as a stream version you may be doing something wrong?
Dan Barua
@danbarua
Jul 16 2015 13:48
same thoughts
Damian Hickey
@damianh
Jul 16 2015 13:48
I'm not sure if I'll implement the GES event expiration thing
that is, GES is more of a general_ event store, where as I'm leaning towards a _domain event store
Dan Barua
@danbarua
Jul 16 2015 13:51
what about ordinal
in the eventss table, that could get large
Damian Hickey
@damianh
Jul 16 2015 13:52
yeah that's a long, no?
Dan Barua
@danbarua
Jul 16 2015 13:52
quite right
looks like npgsql3 wasn't too fussy about reading int32 as int64 but v2 is
Damian Hickey
@damianh
Jul 16 2015 13:52
ah
Dan Barua
@danbarua
Jul 16 2015 13:53
hm
ordinal == SERIAL
Damian Hickey
@damianh
Jul 16 2015 13:53
(I'm not going to get to look at CES for a couple of weeks)
Dan Barua
@danbarua
Jul 16 2015 13:53
looks like npgsql2 handles it differently gargh
no worries
imma just work through it and iron out all the issues
Damian Hickey
@damianh
Jul 16 2015 13:53
I need it, and I'll get to do it on work time, but work time is booked on killing webforms atm
(kill me now)
cool, appreciate you looking at it :)
Dan Barua
@danbarua
Jul 16 2015 13:53
ok so
hmm.. npgsql2 limits you to int32.maxvalue events o_0
i'll try casting it to long
Damian Hickey
@damianh
Jul 16 2015 13:55
You are raising an interesting point
with respect to such deps
Should we have seperate projects for npgsql2 and npgsql3?
Clearly there are key differences...
Dan Barua
@danbarua
Jul 16 2015 13:56
i've changed the constructor
from Func<NpgsqlConnection> to string - connection string or name of connection string will do
then we can ilmerge npgsql and use whatever version suits internally
or as you say, maintain two packages
Damian Hickey
@damianh
Jul 16 2015 13:57
it's the patch versions that occur too, don't think want to have to update packages that contain these.
Dan Barua
@danbarua
Jul 16 2015 14:05
right
found it
my crappy arithmetic
Damian Hickey
@damianh
Jul 16 2015 14:05
A:)
Dan Barua
@danbarua
Jul 16 2015 14:05
var expectedVersion = commit.StreamRevision == 1
 ? ExpectedVersion.NoStream
 : commit.StreamRevision - 1 - commit.Events.Count;
 //NEventStore stream version is 1-based, also we are also N events ahead
cool no need to go back to npgsql2
i'll wack that on abranch though now i've done it
Damian Hickey
@damianh
Jul 16 2015 14:06
cool
Dan Barua
@danbarua
Jul 16 2015 16:19
Looking like a 7hr migration, on SSDs... better leave this running over night.