[Info-ingres] Row locking

Laframboise, André (BAC/LAC) andre.laframboise at canada.ca
Fri Nov 27 12:16:08 UTC 2015


Hi Mark,

By default, Ingres uses 2K pages if you don't specify anything else. 2K pages do not support row level locking.

First you have to enable other page sizes in the server, from CBF, go into DBMS/CACHE select 'ON' for the desired page size.

Second, add the page_size parameter in your create or modify statement. i.e. page_size=4096.


Andre

-----Original Message-----
From: info-ingres-bounces at lists.planetingres.org [mailto:info-ingres-bounces at lists.planetingres.org] On Behalf Of Mark
Sent: Friday, November 27, 2015 5:18 AM
To: info-ingres at lists.planetingres.org
Subject: [Info-ingres] Row locking

I have an esqlc program which attempts to use row-level locking :

    EXEC SQL SET LOCKMODE SESSION WHERE LEVEL = ROW;

    EXEC SQL CREATE TABLE row_lock_test_table
    (
        field1 varchar(30) not null not default,
        field2 integer not null not default,
        field3 date not null not default
    );

    EXEC SQL MODIFY row_lock_test_table TO ISAM UNIQUE ON field1, field2;

    EXEC SQL INSERT INTO row_lock_test_table
        VALUES( 'ONE', 1, date('now') );
    EXEC SQL INSERT INTO row_lock_test_table
        VALUES( 'TWO', 2, date('now') );
    EXEC SQL INSERT INTO row_lock_test_table
        VALUES( 'THREE', 3, date('now') );

    EXEC SQL COMMIT;

    // Now lock row 'THREE'
    EXEC SQL UPDATE row_lock_test_table SET field3 = date('now') WHERE
           field1 = 'THREE' AND field2 = 3;

    printf("Waiting for %d seconds ...\n", seconds);
    sleep(seconds);

During the sleep I attempt to update a different record from another session but it hangs as if the whole table is locked.  How can I get row-level locking to work?
--
(\__/)  M.
(='.'=) If a man stands in a forest and no woman is around
(")_(") is he still wrong?

_______________________________________________
Info-ingres mailing list
Info-ingres at lists.planetingres.org
http://lists.planetingres.org/mailman/listinfo/info-ingres



More information about the Info-ingres mailing list