Here is the exception:
Code: Select all
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Devart.Data.Linq
StackTrace:
at Devart.Data.Linq.Engine.c5.h(IObjectEntry A_0)
at Devart.Data.Linq.Engine.c5.j()
at Devart.Data.Linq.Engine.c5.b.b()
at Devart.Data.Linq.Engine.b5.a(ConflictMode A_0)
at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at Devart.Data.Linq.DataContext.SubmitChanges()
at RapidWriteTest.Program.Main(String[] args) in c:\Users\mwatson\Documents\Visual Studio 2012\Projects\RapidWriteTest\RapidWriteTest\Program.cs:line 56
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Code: Select all
var connString = "User Id=postgres;Password=XXXXXXX;Host=localhost;Database=blueridge;Persist Security Info=True;Initial Schema=public";
const int tagsToWrite = 100000000;
var context = new RapidWriteFailContext(connString);
for (var i = 0; i < tagsToWrite; i++)
{
var update = new TagUpdate
{
Datatype = 1,
TagPathId = tagPathId, // the record ID of a record in the tag_path table
TimestampedAt = DateTime.Now,
Value = Membership.GeneratePassword(32, 8) // this just generates a random string to use in populating the field
};
context.TagUpdates.InsertOnSubmit(update);
if (i > 0 && i%200 == 0)
{
context.SubmitChanges();
context.Dispose();
context = null;
context = new RapidWriteFailContext(connString);
}
if (i > 0 && i%1000 == 0)
{
Console.WriteLine("...{0}/{1} written", i, tagsToWrite);
}
}
Code: Select all
CREATE TABLE tag_path
(
id serial NOT NULL,
path varchar(200),
CONSTRAINT tag_path_id PRIMARY KEY (id)
);
CREATE INDEX tag_path_path ON tag_path USING btree (path);
CREATE TABLE tag_path_property
(
id serial NOT NULL,
tag_path_id int,
key varchar(200),
value varchar(200),
CONSTRAINT tag_path_property_id PRIMARY KEY (id) ,
CONSTRAINT tag_path_property_tag_path_fk FOREIGN KEY (tag_path_id)
REFERENCES tag_path (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
CREATE INDEX tag_path_property_key ON tag_path_property USING btree (key);
CREATE INDEX tag_path_property_value ON tag_path_property USING btree (value);
CREATE INDEX tag_path_property_tag_path_id ON tag_path_property USING btree (tag_path_id);
CREATE TABLE tag_update
(
id serial NOT NULL,
tag_path_id int,
timestamped_at timestamp NOT NULL,
datatype int NOT NULL,
value text,
CONSTRAINT tag_update_id PRIMARY KEY (id) ,
CONSTRAINT tag_update_tag_path_fk FOREIGN KEY (tag_path_id)
REFERENCES tag_path (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
CREATE INDEX tag_update_timestamped_at ON tag_update USING btree (timestamped_at);
CREATE INDEX tag_update_datatype ON tag_update USING btree (datatype);
CREATE INDEX tag_update_tag_path_id ON tag_update USING btree (tag_path_id);
CREATE TABLE tag_tree
(
id serial NOT NULL,
tag_tree_id int,
name varchar(200),
CONSTRAINT tag_tree_id PRIMARY KEY (id) ,
CONSTRAINT tag_tree_tag_tree_fk FOREIGN KEY (tag_tree_id)
REFERENCES tag_tree (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
CREATE INDEX tag_tree_name ON tag_tree USING btree (name);
CREATE INDEX tag_tree_tag_tree_id ON tag_tree USING btree (tag_tree_id);