cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

[1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Pearl

[1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Hi ,

When creating DataTable with service dynamically,  I sometimes get the error "[1,018] Data store unknown error: [Error occurred while accessing the model provider." . 

 

var params = {
name: dataTableName,
description: "",
thingTemplateName: "DataTable",
};

Resources["EntityServices"].CreateThing(params);

Things[dataTableName].SetDataShape({ name: shapeName });
//Things[dataTableName].SetProjectName({ projectName: "ABCD" });

Things[dataTableName].EnableThing();
Things[dataTableName].RestartThing();

Things[dataTableName].SetPersistenceProvider({
name: persistentProvider
});

Resources["EntityServices"].AddShapeToThing({
name: dataTableName /* THINGNAME */,
thingShapeName: "LockableThing" /* THINGSHAPENAME */
});

Things[dataTableName].EnableThing();
Things[dataTableName].RestartThing();

 

And, if error occurs, I have the following exception handling to rollback: 

 

 var params = {
name: dataTableName /* THINGNAME */
};
try{
Resources["EntityServices"].DeleteThing(params);
logger.debug("Rollback data table "+dataTableName + "finished");
}catch(error2){
logger.debug("fail to rollback data table "+dataTableName + ". Error: " + error2 ); // result: INFOTABLE dataShape: "EntityReference"
var existingGhostEntities =
Resources["GhostEntitiesResource"].GetGhostEntities({
deleteGhosts: true /* BOOLEAN */
});
}

 

Even though,  if the error "Data store unknown error" occurs then it will always occur unless restart tomcat .  Any suggestion ? 

 

Thingworx 8.4.2 + Postgresql 10.x

 

Regards,

Sean

12 REPLIES 12

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Is this creation service execution in a set security context?

Data store unknown could be a visibility permission problem.

ie. the security context (user) that is executing the service may not have permissions to see the Persistence Provider associated with the DataTable you are creating

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

@PaiChung ,

 

No,  I'm currently using Administrator to run the creation service.  It will be executed in a security context when my project go live , but for now it's only executed by Administrator.   

The strange thing is that the error occurs randomly , about 1 time out of 5~20 executions.  

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Hi,

 

You can try to look into Tomcat logs (stderr), sometimes there is another error behind Data Store Unknown Error, and get a hint. 

 

Thanks,

Raluca Edu

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Hello Sean,

 

I'm sorry for not answering your question, just wondering what is your use case for creating data tables programmatically -- is that for visibility purposes?

 

/ Constantine

Highlighted

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

@seanccc , 

 

Have you looked at this Article CS239982 This article discuss how to enable a stack trace which may provide more information on what action is causing the problem.

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

@Constantine ,

My customer has multiple production lines and each line will have 50,000 records per year,  since data table is suitable for less than 300,000 records , I create data table for each line.  The customer may have more lines in t he future , so it's created pragmatically.   Also, I want to keep the flexibility to assign different data provider for the data table of each line to spread the data into different  db sachems/table spaces , although they use the same data provider for now.  

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Sean,

All DTs are stored internally in the same SQL table, so I would advise you to run some basic performance test first. For example fill DT1 with 300K rows and measure a query, and then fill DT2 and see it it has the impact on both queries. Because of underlying reindexing I would also expect some impact on the INSERT performance — with 10 customers at the end of the year you’ll be inserting rows into a table with 500K rows instead of 50K. This is all hypothetical, I’ve never measured it myself, but the gut feeling suggests that running 10 DTs each with 50K records will be slow.

May I ask you what is your use case for that? Do you accumulate some running totals?

/ Constantine

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Hi @Constantine ,

I don't have needs to accumulate some running totals.  I separate the data table by production line just for getting better query performance as I noticed that there is entity_key_constraint on data table and table name is part of the constraint.  

 

But I just checked the constraint again and find something new.  In PgAdmin the table name(entity_id) is the 1st columns of the constraint , so I thought querying by table name can use index , however ,checking the table creation script , just found it's actually the 2nd column.  Query condition on table name cause full table scan and is slow.  So , I would abandon the way of creating dynamic data tables . 

 

I also have several dynamic stream for each production line.  For stream the stream name(entity_id) is indexed, so I would keep the streams get created dynamically.  

Re: [1,018] Data store unknown error: [Error occurred while accessing the model provider. ?

Sean,

 

On a side note, we found that in most use cases (~10K rows) DTs are only useful for querying by ID. For pretty much anything else we use streams and SQL.

 

/ Constantine