Nova postagem

Pesquisar

Pergunta
· Abr. 22

What the heck is a "Reentrant request"?

I'm playing with %Net.DB.Iris and stumbled over a mystery

set con=##class(%Net.DB.DataSource).CreateConnection(host,...)
set srv=con.CreateIris()
write srv.ClassMethodValue("%SYSTEM.Util","InstallDirectory")

Entering the above lines (in a terminal session) on my local instance yields the correct answer for:

host = "localhost"
host = the real IP of localhost (i.e. host="192.168...")
host = "10.x.y.dev" customers development system (over a VPN tunnel)

but for

host = "10.x.y.tst" (customers test system) I get an error:
 <THROW>zClassMethodValue+8^%Net.DB.Iris.1 *%Exception.StatusException ERROR #5001: Reentrant request

I don't see any reason for a "re-entry problem" in the three lines above, but maybe I'm blind...

If I execute the above three lines in a terminal session on customers dev-system (10.x.y.dev) and try to reach the testsystem (10.x.y.tst), I get the same error BUT if I do that on the test-system (10.x.y.tst) I can reach the dev-system (10.x.y.dev), i.e. no error.

Both customer instances are IRIS 2023.1.1/Win and my local instance is IRIS 2021.2/Linux

I can't figure out what's going on
- why do I get an error at all and
- what do that error means

Does anyone have any idea what's wrong and what this error message is trying to tell me or is it a case for WRC?

4 Comments
Discussão (4)1
Entre ou crie uma conta para continuar
Artigo
· Abr. 22 3min de leitura

Comment identifier les variables globales temporaires qui consomment de l'espace dans la base de données IRISTEMP

Rubrique FAQ InterSystems

Les variables globales temporaires stockées dans les bases de données IRISTEMP/CACHETEMP sont utilisées lorsqu'un processus n'a pas besoin de stocker des données indéfiniment, mais requiert les performances élevées des variables globales. Les bases de données IRISTEMP/CACHETEMP ne sont pas journalisées ; leur utilisation ne crée donc pas de fichiers journaux.

Le système utilise les bases de données IRISTEMP/CACHETEMP pour le stockage temporaire et les utilisateurs peuvent y accéder à cette fin.

Pour plus d'informations sur les variables globales temporaires et la base de données IRISTEMP, consultez le document suivant :

Globals temporaires et la base de données IRISTEMP

Les globales utilisées comme temporaires sont :

1. Variables globales temporaires du système (^IRIS.Temp*, ^%cspSession, ^CacheTemp*, ^mtemp*, etc.)
2. Variables globales temporaires mappées à IRISTEMP/CACHETEMP par l'utilisateur

3. Process private globals  (^||name, ^|"^"|name, ^["^"]name, ^["^",""]name, etc. )
4. Table de GLOBALE TEMPORAIRE

 -> La définition de la table est persistante (disponible pour tous les processus) et les données de la table sont stockées dans les données globales privées du processus (ne durent que pendant la durée du processus).

Les tailles 1 et 2 peuvent être vérifiées à l'aide de l'utilitaire ^%GSIZE:

USER>do ^%GSIZE

Directory name: c:\intersystems\iris\mgr\user\ => c:\intersystems\iris\mgr\iristemp\
                                               // Specify the iristemp database folder
All Globals? No => yes       // Yes to show all globals: 34 items selected
34 available globals
Show details?? No => No   //  No to not show detailed information 
Device:
Right margin: 80 =>

3,4 Les globales privées des processus peuvent être visualisées à l'aide de l'utilitaire ^GETPPGINFO

Pour plus d'informations sur l'utilitaire ^GETPPGINFO, consultez le document suivant :
About the ^GETPPGINFO utility [IRIS]
About the ^GETPPGINFO utility

L'exemple suivant répertorie les variables globales privées de tous les processus actuels 

 set ^||flintstones(1)="Fred"
 set ^||flintstones(2)="Wilma"
 znspace "%SYS"
 do ^GETPPGINFO("*")

Une autre méthode consiste à afficher le contenu de processus individuels utilisant des blocs globaux privés en grande quantité.

L'exemple suivant affiche le nombre de blocs globaux privés par processus supérieur ou égal à 20.

 set ns=$namespace
 znspace "%SYS"
 
 // Only processes with more PPG blocks than the total number of processes are included
 set st=##class(%SQL.Statement).%New()
 set status=st.%PrepareClassQuery("%SYS.ProcessQuery","AllFields")
 set rs=st.%Execute()
 while rs.%Next() {
    set pid=rs.%Get("Pid") // Process ID
    set cnt=rs.%Get("PrivateGlobalBlockCount") // Number of PPG blocks
    
    // When the number of PPG blocks per process is 0 or more, the contents are output (the following example shows 20 or more blocks).
    if cnt > 20 {
       set rs2=##class(%ResultSet).%New("%SYS.ProcessQuery:PPG")
       // "N" Do not return subscripts of a PPG, just return the root name
       // "B" Return the number of blocks used by the PPG (needs the "N" option)
       do rs2.Execute("*",pid,"NB")
       for {
          quit:'rs2.Next()
          write cnt_" PID:"_pid_", PPG name "_rs2.GetData(1)_" is using "_rs2.GetData(3)_" disc blocks",!
       }
    }
 }
 
 znspace ns
Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· Abr. 22 4min de leitura

Consideraciones al migrar de Oracle, MSSQL, etc. a IRIS

Migrar desde Oracle, MSSQL u otros sistemas de bases de datos puramente relacionales a un sistema multimodelo como InterSystems IRIS es una decisión estratégica que requiere una planificación y ejecución cuidadosas. Aunque esta transición ofrece beneficios significativos, como un mejor rendimiento, escalabilidad y soporte para arquitecturas modernas, también conlleva desafíos. En este artículo destacaré algunas de las consideraciones relacionadas con la codificación para asegurar una migración exitosa. Dejaré fuera del alcance de este artículo todo lo relacionado con la migración real de estructuras y datos.

Primero, cuando estáis considerando migrar a un sistema de base de datos diferente, necesitáis comprender vuestra lógica de negocio, ya sea del lado de la aplicación (servidor de aplicaciones) o del servidor de bases de datos. Básicamente, ¿dónde tenéis vuestras sentencias SQL que potencialmente tendréis que reescribir?

Cuando vuestra lógica de aplicación depende en gran medida de SQL ejecutado directamente dentro del código de la aplicación (en lugar de procedimientos almacenados o triggers en la base de datos), migrar desde una base de datos relacional a InterSystems IRIS requiere un examen cuidadoso de vuestras sentencias SQL. Veamos algunos de los factores más importantes que debéis tener en cuenta.

  1. Diferencias en el dialecto SQL. SQL de IRIS admite el estándar SQL-92. Esto no significa que no estén implementadas algunas funcionalidades más modernas. Simplemente significa que necesitáis comprobarlo de antemano. Por ejemplo, las funciones de ventana aparecieron en SQL:2003, pero aún así podéis escribirlas en IRIS.
--window function
select id, rating
  from (select a.id, 
               r.rating, 
               avg(r.rating) over () as avg_rating 
          from SQLUSER.Actor a join SQLUser.Review r on a.id = r.Reviews) as sub 
 where rating > avg_rating

Al mismo tiempo, los nuevos tipos de datos complejos, como XML, JSON, Arrays y tipos de datos geográficos, no están soportados. Así que la siguiente consulta:

SELECT a.id, 
       a.firstname, 
       ARRAY_AGG(r.rating) AS ratings 
  FROM SQLUSER.Actor a LEFT JOIN SQLUser.Review r ON a.id = r.Reviews 
GROUP BY  a.firstname

devolverá un error: ERROR #5540: SQLCODE: -359 Message: User defined SQL function 'SQLUSER.ARRAY_AGG' does not exist

Pero no es el fin del mundo. Hay muchas funciones integradas que os permitirán reescribir las consultas para obtener el resultado esperado.

2. Funciones integradas. Los distintos sistemas de gestión de bases de datos tienen diferentes funciones integradas. Por lo tanto, necesitáis comprender cómo se corresponden con las disponibles en IRIS. Aquí tenéis varios ejemplos de lo que os estoy comentando: funciones usadas en Oracle y sus equivalentes en IRIS.

Oracle IRIS
NVL ISNULL(field, default_value)
substr $extract(field, start_pos, end_pos)
instr $find(field, text_to_find)
concat {fn CONCAT(string1,string2)}

Cuando vuestra lógica SQL principal reside dentro de la base de datos (por ejemplo, procedimientos almacenados, triggers, vistas), migrar a InterSystems IRIS requiere un enfoque diferente. Aquí tenéis algunas consideraciones:

  1. Migración de objetos de base de datos
    1. Todos los procedimientos almacenados deben reescribirse usando ObjectScript. Esta también puede ser una buena oportunidad para cambiar al modelo orientado a objetos, ya que obtendréis una tabla igualmente al crear una clase. Sin embargo, trabajar con clases os permitirá escribir métodos (que pueden llamarse como procedimientos almacenados) y usar todo el potencial del paradigma orientado a objetos.
    2. Los triggers, índices y vistas están todos soportados por IRIS. Incluso podéis dejar las vistas tal como están si las columnas de las tablas se mantienen iguales y no utilizan funciones o sintaxis no soportadas (ved el punto anterior).
  2. La migración de definiciones también es importante y puede presentar algunos desafíos. Primero, debéis hacer una correspondencia cuidadosa de los tipos de datos de vuestra base de datos anterior con los de IRIS, especialmente si estáis usando tipos de datos complejos. Además, al tener más flexibilidad con los índices, quizás queráis redefinirlos de forma distinta.

Aquí tenéis algunas cosas que debéis considerar al decidir migrar a InterSystems IRIS desde otra base de datos relacional. Es una decisión estratégica que puede desbloquear beneficios significativos, incluyendo una mayor escalabilidad, rendimiento y eficiencia. Sin embargo, una planificación cuidadosa es crucial para asegurar una transición fluida y abordar necesidades de compatibilidad, transformación de datos y refactorización de la aplicación.

Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· Abr. 22 4min de leitura

Testing Metadata Inconsistencies in InterSystems IRIS Using the DATATYPE_SAMPLE Database

When using standard SQL or the object layer in InterSystems IRIS, metadata consistency is usually maintained through built-in validation and type enforcement. However, legacy systems that bypass these layers—directly accessing globals—can introduce subtle and serious inconsistencies.

Understanding how drivers behave in these edge cases is crucial for diagnosing legacy data issues and ensuring application reliability.

The DATATYPE_SAMPLE database is designed to help analyze error scenarios where column values do not conform to the data types or constraints defined in the metadata. The goal is to evaluate how InterSystems IRIS and its drivers (JDBC, ODBC, .NET) and different tools behave when such inconsistencies occur. In this post, I’ll focus on the JDBC driver.


What's the Problem?

Some legacy applications write directly to globals. If a relational model (created via CREATE TABLE or manually defined using a global mapping) is used to expose this data, the mapping defines the underlying values conform to the declared metadata for each column.

When this assumption is broken, different types of problems may occur:

  1. Access Failure: A value cannot be read at all, and an exception is thrown when the driver tries to access it.
  2. Silent Corruption: The value is read successfully but does not match the expected metadata.
  3. Undetected Mutation: The value is read and appears valid, but was silently altered by the driver to fit the metadata, making the inconsistency hard to detect.

Simulating the Behavior

To demonstrate these scenarios, I created the DATATYPE_SAMPLE database, available on the InterSystems Open Exchange:
🔗 Package page
🔗 GitHub repo

The table used for the demonstration:

CREATE TABLE SQLUser.Employee (
   ID              BIGINT          NOT NULL AUTO_INCREMENT,
   Age             INTEGER,
   Company         BIGINT,
   DOB             DATE,
   FavoriteColors  VARCHAR(4096),
   Name            VARCHAR(50)     NOT NULL,
   Notes           LONGVARCHAR,
   Picture         LONGVARBINARY,
   SSN             VARCHAR(50)     NOT NULL,
   Salary          INTEGER,
   Spouse          BIGINT,
   Title           VARCHAR(50),
   Home_City       VARCHAR(80),
   Home_State      VARCHAR(2),
   Home_Street     VARCHAR(80),
   Home_Zip        VARCHAR(5),
   Office_City     VARCHAR(80),
   Office_State    VARCHAR(2),
   Office_Street   VARCHAR(80),
   Office_Zip      VARCHAR(5)
);

Example 1: Access Failure

To simulate an inconsistency, I injected invalid values into the DOB (Date of Birth\Datatype DATE) column using direct global access. Specifically, the rows with primary keys 101, 180, 181, 182, 183, 184, and 185 were populated with values that do not represent valid dates.

The values looks like this now:
 
As you can see, a string was appended to the end of a $H (Horolog) value. According to the table's metadata, this column is expected to contain a date—but the stored value clearly isn't one.

So what happens when you try to read this data? Well, it depends on the tool you're using. I tested a few different tools to compare how they handle this kind of inconsistency.

1) SquirrelSQL (SQuirreL SQL Client Home Page)

When SquirrelSQL attempts to access the data, an error occurs. It tries to read all rows and columns, and any cell that contains invalid data is simply marked as "ERROR". Unfortunately, I couldn't find any additional details or error messages explaining the cause.

  

2) SQLWorkbench/J (SQL Workbench/J -  Home)
SQL Workbench/J stops processing the result set as soon as it encounters the first invalid cell. It displays an error message like "Invalid date", but unfortunately, it doesn't provide any information about which row caused the issue.

 
3) DBVisualizer (dbvis) &  DBeaver (dbeaver)

DBVisualizer and DBeaver behave similarly. Both tools continue reading the result set and provide detailed error messages for each affected cell. This makes it easy to identify the corresponding row that caused the issue.

   

4) SQL DATA LENS (SQL Data Lens - a powerful tool for InterSystems IRIS and Caché)

With the latest release of SQL DATA LENS, you get detailed information about the error, the affected row, and the actual database value. As shown in the screenshot, the internal value for the first row in columns DOB is "39146<Ruined>", which cannot be cast to a valid DATE.

SQL DATA LENS also allows you to configure whether result processing should stop at the first erroneous cell or continue reading to retrieve all available data.
 


The next part of this article will shows details about:

Silent Corruption: The value is read successfully but does not match the expected metadata.

Undetected Mutation: The value is read and appears valid, but was silently altered by the driver to fit the metadata, making the inconsistency hard to detect.



Andreas

Discussão (0)2
Entre ou crie uma conta para continuar
Anúncio
· Abr. 22

Programa de Acceso Anticipado: mejoras en OAuth2

InterSystems IRIS 2025.2.0 introduce varias funcionalidades para mejorar la experiencia de configuración de OAuth2.

- OAuth2 es ahora un tipo de autenticación nativo y puede activarse fácilmente para vuestros servicios y aplicaciones web. Anteriormente, OAuth2 era un tipo de autenticación delegada.

- Ahora podéis crear servidores de recursos con la nueva clase OAuth2.ResourceServer, lo que simplifica considerablemente la configuración. Antes, los servidores de recursos eran instancias de OAuth2.Client.

- La clase OAuth2.ResourceServer proporciona un autenticador de ejemplo para determinar los permisos de usuario que, en configuraciones simples, no requiere código personalizado (anteriormente se necesitaba una implementación personalizada de ZAUTHENTICATE). Este autenticador sencillo se puede extender y personalizar según vuestras necesidades. OAuth2.ResourceServer admite múltiples audiencias.

- Ahora podéis usar JDBC y ODBC para autenticaros en InterSystems IRIS con tokens de acceso.

Nos interesa conocer vuestra opinión sobre estos nuevos cambios y si funcionan como esperáis.

Podéis descargar el software y la nueva documentación de estas funcionalidades usando este Linkhttps://evaluation.intersystems.com/Eval/early-access/OAuth2

Para enviar comentarios, usad la página del EAP y haced clic en el botón de feedback en la parte derecha.

Discussão (0)1
Entre ou crie uma conta para continuar