[MCOL-1726] mcsapi stale transactions Created: 2018-09-17  Updated: 2019-03-08  Resolved: 2019-03-08

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.1.6
Fix Version/s: 1.1.7, 1.2.3

Type: Bug Priority: Major
Reporter: Andrew Hutchings (Inactive) Assignee: Zdravelina Sokolovska (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MCOL-1077 Two applications using Bulk Insert API Closed
relates to MCOL-1195 mcsapi BadUsage.AssertTableLock test ... Closed
Sprint: 2018-21, 2019-01, 2019-02, 2019-03

 Description   

From sasha in MCOL-1077:

Alas, the problem is not fully resolved. Here is my test sequence:

1) On one Ubuntu 18.04 docker node I installed ColumnStore server 1.1.6 postConfigured as a multi-server (with a single node).
2) On another Ubuntu 18.04 docker node I installed ColumnStore C++ BulkWrite SDK source from columnstore-1.1.6.tar.gz
I also copied the Columnstore.xml from the server node to the api node.
The unmodified basic_bulk_insert example worked as expected, while inserting remotely.

I modified the basic_bulk_insert.cpp adding the sleep(10) equivalent by adding three lines as shown below:

...
#include <iostream>
#include <chrono>
#include <thread>
 
int main(void)
...
	std::this_thread::sleep_for(std::chrono::seconds(10));
        bulk->commit();
...

Then launched the "sleeping" basic_bulk_insert and terminated this process with kill -9.
As expected, the ColumnStore server left with the table lock:

/usr/local/mariadb/columnstore/bin/viewtablelock
 There is 1 table lock
 
  Table    LockID  Process  PID  Session  Txn  CreationTime              State    DBRoots  
  test.t1  26      mcsapi   410  127693   10   Mon Sep 17 01:23:22 2018  LOADING  1        

Also the second (original) basic_bulk_insert attempt resulted in

/usr/local/share/doc/mcsapi/example/basic_bulk_insert
Error caught: Table already locked by PID: 410 'mcsapi' session ID: 127693 txn ID: 10

As Andrew directed above, I cleared this lock on the server side with:

/usr/local/mariadb/columnstore/bin/cleartablelock 26
Rolling back and clearing table lock for table test.t1; table lock 26
 
Sending rollback request to PM1...
Successful rollback response from PM1
Sending cleanup request to PM1...
Successful cleanup response from PM1
 
Table lock 26 for table test.t1 is cleared.
 
/usr/local/mariadb/columnstore/bin/viewtablelock
 No tables are locked in the database.

After clearing the lock, the (original) basic_bulk_insert attempt was successful.

Unfortunately, the problem reported above, remains.

mcsadmin shutdown y
shutdownsystem   Mon Sep 17 01:32:28 2018
 
This command stops the processing of applications on all Modules within the MariaDB ColumnStore System
 
   Checking for active transactions
 
   There are active transactions being processed
Your options are:
    Cancel    -- Cancel the shutdown request
    Wait      -- Wait for write operations to end and then shutdown
    Force     -- Force a shutdown
What would you like to do: [Cancel]:

As earlier, the rollback -p command does not print any transactions and there is no file /usr/local/mariadb/columnstore/data1/systemFiles/dataTransaction



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2018-12-20 ]

Fix is in the cleartablelock tool in the engine.

For QA: There is no good way to express this in API or engine regression suites. I recommend doing something along the lines of the description.

Comment by Patrick LeBlanc (Inactive) [ 2019-01-10 ]

Approved & merged it.

Comment by Zdravelina Sokolovska (Inactive) [ 2019-01-23 ]

checked on v1.1.7
todo: check on v1.2.3

Comment by Zdravelina Sokolovska (Inactive) [ 2019-03-08 ]

checked with compiled mariadb-columnstore-api dev 1.2 from branch develop-1.2 and
tested against columnstore installation with v1.2.3/ e849af0

# ./basic_bulk_insert
 
[root@localhost ~]#  kill -9 $(ps aux | grep -v grep | grep  basic_bulk_insert | awk '{print$2}')
 
# ./basic_bulk_insert
Killed 
 
 
]# ./basic_bulk_insert
Error caught: Table already locked by PID: 3819 'mcsapi' session ID: 107903 txn                                                                                                              ID: 442
 
 
 
[root@localhost ~]# /usr/local//mariadb/columnstore/bin/viewtablelock
There is 1 table lock
 
 Table    LockID  Process  PID   Session  Txn  CreationTime              State    DBRoots
 test.t1  38      mcsapi   3819  107903   442  Thu Mar  7 19:57:49 2019  LOADING  1
[root@localhost ~]#
[root@localhost ~]# /usr/local//mariadb/columnstore/bin/viewtablelock
There is 1 table lock
 
 Table    LockID  Process  PID   Session  Txn  CreationTime              State    DBRoots
 test.t1  38      mcsapi   3819  107903   442  Thu Mar  7 19:57:49 2019  LOADING  1
 
 
 
[root@localhost ~]# /usr/local//mariadb/columnstore/bin/cleartablelock 38
Rolling back and clearing table lock for table test.t1; table lock 38
 
Sending rollback request to PM1...
Successful rollback response from PM1
Sending cleanup request to PM1...
Successful cleanup response from PM1
 
Table lock 38 for table test.t1 is cleared.
 
 
 
Run again the original basic_bulk_insert 
# ./basic_bulk_insert
#
 
 
 
 
[root@localhost ~]# /usr/local//mariadb/columnstore/bin/viewtablelock
No tables are locked in the database.
 
Hidden active transactions was not seen upon restarting 
[root@localhost ~]# mcsadmin restart
restartsystem   Thu Mar  7 20:09:23 2019
          Do you want to proceed: (y or n) [n]:

Generated at Thu Feb 08 02:30:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.