Question
· 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
Discussion (8)3
Log in or sign up to continue

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.Class extends %Persistent
{
Property Field1 as %String;
Property Filed2 As %String;

Index composite on (Field1, Field2) [ Unique];
}

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

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é