web stats
Prune shrinks mirthtb? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2015, 09:57 AM
henriquetomaz henriquetomaz is offline
OBX.1 Kenobi
 
Join Date: Dec 2014
Posts: 45
henriquetomaz is on a distinguished road
Default Prune shrinks mirthtb?

Hey guys,

We have a PC here just for tests where we have a Mirth Connect installed on it. We receive many messages everyday (which is used for testing) and now our mirthbd is getting really big (I am aware about the Derby limitations). We define a pruner strategy (prune metadata and content older than 1 day) and our question is: After running the pruner, my mirthdb will shrink?
Reply With Quote
  #2  
Old 08-05-2015, 10:08 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Pruning does DELETE statements which inherently doesn't reclaim disk space. But if you regularly prune then it shouldn't matter, and in general your database shouldn't be perpetually growing, unless your message throughput is also growing.

Some databases like PostgreSQL have auto-vacuuming features, but for Derby you'll have to compress tables manually. Here's an example: http://www.mirthcorp.com/community/w...edded+database
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 08-05-2015, 12:18 PM
henriquetomaz henriquetomaz is offline
OBX.1 Kenobi
 
Join Date: Dec 2014
Posts: 45
henriquetomaz is on a distinguished road
Default

Thanks Narupley for your help.

I am trying follow the instructions to access Deby from command line:

wget http://ftp.unicamp.br/pub/apache//db...1.1-bin.tar.gz

tar xvf db-derby-10.11.1.1-bin.tar.gz

cd db-derby-10.11.1.1-bin

./bin/ij

ij> connect 'jdbc:derby:/opt/mirthconnect/appdata/mirthdb'

>

Then I stopped all my channels to execute the query:
DELETE FROM MESSAGE;
{call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP', 'MESSAGE', 0)};

But I got this error:

ERROR XJ040: Failed to start database '/opt/mirthconnect/appdata/mirthdb' with class loader sun.misc.Launcher$AppClassLoader@7ea2dfe, see the next exception for details.
ERROR XSDB6: Another instance of Derby may have already booted the database /opt/mirthconnect/appdata/mirthdb.

Is it mean I am still connect at mirthdb? What I am missing?

Thanks.
Reply With Quote
  #4  
Old 08-05-2015, 12:23 PM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Another disadvantage of using the embedded Derby database is that only one application can access it at a time. So you need to shut down Mirth Connect if you want to connect to it from the command line.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #5  
Old 08-07-2015, 11:47 AM
henriquetomaz henriquetomaz is offline
OBX.1 Kenobi
 
Join Date: Dec 2014
Posts: 45
henriquetomaz is on a distinguished road
Question VACUUM mirthdb

Hello Narupley,

Thanks for your help.

I accessed mirthdb (Derby) and now I am try to delete messages. I am trying this:
DELETE FROM D_MM7;
{call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP', 'D_MM7', 0)};

(I am following this instructions? http://www.mirthcorp.com/community/w...edded+database)

But, I get this error:
DELETE on table 'D_MM7' caused a violation of foreign key constraint 'D_MC7_FKEY' for key (1,0). The statement has been rolled back.

What is wrong?

Thanks!
Reply With Quote
  #6  
Old 08-07-2015, 11:53 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Unfortunately that wiki page was written for version 2.x and hasn't yet been updated. In 3.x since Derby doesn't handle cascading automatically, you'll have to delete from D_MA#, then D_MCM#, then D_MC#, then D_MM#, and finally D_M#.

Or, don't do the delete manually. Instead, just let Mirth Connect do the pruning, and then do the compress statement afterwards.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #7  
Old 11-16-2015, 09:42 AM
asugianto asugianto is offline
What's HL7?
 
Join Date: May 2014
Posts: 4
asugianto is on a distinguished road
Default

Hello, how can I create a compress statement after pruning? I am using Mirth Connect Server 3.3.0.7801 Built on September 14, 2015.

Thank you
Reply With Quote
Reply

Tags
mirthbd, pruner, size

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:17 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation