Written by

Shift
Question Edmara Francisco · Nov 11, 2022

Not opening an instance by index key after cache migration to iris.

Hello!

Not opening an instance by index key after CACHE migration to IRIS. In composite indices, when one of the values is null, when using idx open it does not return the reference.

Has anyone had this problem?

Product version: IRIS 2022.1

Comments

Victor Gordillo · Nov 11, 2022

Hi there,

We've actually faced this problem in the past. Executing %BuildIndices() wouldn't solve the problem either for us...

In our particular case, we found that killing the indexing globals and then calling the %BuildIndices() solved the issue. Have you tried that? 

0
Edmara Francisco  Nov 17, 2022 to Victor Gordillo

Hello,

It didn't solve for me....

Analyzing the global, the values are the same in CACHE as well as in IRIS, if there wasn't any chance in global value.

Anyone what changed from CACHE to IRIS that idxOpen can't found the data?

Thaks

0
Julius Kavay  Nov 17, 2022 to Edmara Francisco

First, the suggestion of Victor Gordillo  is correct.

do##class(Some.Class).%BuildIndices()

solves most index related problems.

Second, there are a couple of things, we do not know, but you
- did you made an in-place-upgrade or a clean install + data transfer
- the class in question is the same on IRIS and Cache (i.e. no change was made)
- is the class re-compiled (on IRIS)
- what do you exactly mean when you say "Not opening an instance...": (1) you get an NULL-OREF or (2) you get an error
- what do you provide as a NULL value: (1) "", (2) $c(0), (3) " " or something else as open parameter

A shortened class definition (we don't need the whole definition) would be also helpfull, something like this

Class Problem.Classextends%Persistent
{
Property Field1 as%String;Property Filed2 As%String;

Index composite on (Field1, Field2) [ Unique];
}
0
Edmara Francisco  Nov 22, 2022 to Julius Kavay

Hello!

Follow the requested information

- did you made an in-place-upgrade or a clean install + data transfer
I made in-place-upgrade
- the class in question is the same on IRIS and Cache (i.e. no change was made)
Yes, is this same on IRIS and Cache, no change was made
- is the class re-compiled (on IRIS)
Yes, re-compilde on IRIS
- what do you exactly mean when you say "Not opening an instance...": (1) you get an NULL-OREF or (2) you get an error
I get an NULL-OREF
- what do you provide as a NULL value: (1) "", (2) $c(0), (3) " " or something else as open parameter
""A shortened

"" String Empty

Shortened class:

Class dado.TblTeste Extends (%Persistent, dado.Persistente)
{

Index idxFieldOneFieldTwoFieldThree On (FieldOneId, FieldTwoId, FieldThreeId) [ Unique ];

ForeignKey fkFieldOneId(FieldOneId) References dado.TblFieldOne();

ForeignKey fkFieldTwoId(FieldTwoId) References dado.TblFieldTwo();

ForeignKey fkFieldThreeId(FieldThreeId) References dado.TblFieldThree();Property FieldOneId As dado.TblFieldOne [ Required ];Property FieldTwoId As dado.TblFieldTwo [ Required ];Property FieldThreeId As dado.TblFieldThree;Property Descricao As%String [ Required ];Property VersaoCheck As%String [ InitialExpression = 0 ];

}

Use:

Set object = ##class(dado.TblTeste).idxFieldOneFieldTwoFieldThreeOpen(1, 2, "")

Thanks

0
Robert Cemper  Nov 24, 2022 to Edmara Francisco

Add this line to your test:

Set object = ##class(dado.TblTeste).idxFieldOneFieldTwoFieldThreeOpen(1, 2, "")
If 'object Do $system.OBJ.DisplayError()

So you see the reason for failing

Open by unique index reqires an EXACT match

0
José Pereira · Nov 25, 2022

Hi Edmara!

Which IRIS version are you trying?

I did a test using the version "IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.2 (Build 368U) Fri Oct 21 2022 17:18:04 EDT" and all worked fine.

Please, checkout the example below on your IRIS version. It shows the index global value (^dado.TblTesteI) in order to get more visibility of what is going on.

dado.TblTeste:

 

Spoiler

dado.TblFieldOne:

 

Spoiler

dado.TblFieldTwo:

 

Spoiler

dado.TblFieldThree:

 

Spoiler

Output of OpenCompositeIndexTest() method:

IRISAPP>d ##class(dado.TblTeste).OpenCompositeIndexTest()
IRIS version: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.2 (Build 368U) Fri Oct 21 2022 17:18:04 EDT

Cleaning up tables...
Populating tables...

---
Test with FieldThreeId using SQL DML:
Ok
Index global: 
^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,3,1)=""

---
Test with no FieldThreeId using SQL DML:
Ok
Index global: 
^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,-100000000000000,2)=""
^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,3,1)=""

---
Test with no FieldThreeId using object:
Ok
Index global: 
^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,-100000000000000,2)=""
^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",1,2,3,1)=""
^dado.TblTesteI("idxFieldOneFieldTwoFieldThree",2,1,-100000000000000,3)=""

HTH,

José

0
Edmara Francisco  Nov 28, 2022 to José Pereira

Hello!

For some reason, the query used by the idxExits method was frozen and was not returning the desired record.

After unfreezing the query and recompiling the class, the idxOpen method started returning the record as expected.

Thank you

0