Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents


Chinese

Pagetitle
开发服务器数据清理
开发服务器数据清理

English
In development server, due to the fact that process design will always get updated and developed, there will be more and more XPDLs cached in the memory. In the long run, this may cause "java.lang.OutOfMemoryError" exception during runtime or server startup. To solve this issue, we will need to clean up the unused XPDLs with following steps. The following example queries are written in MySQL and MSSQL syntax.
Chinese

在开发服务器中,由于进程设计总是会得到更新和开发的,所以内存中会有越来越多的XPDL缓存。从长远来看,这可能会在运行时或服务器启动时导致“ java.lang.OutOfMemoryError ”异常。要解决这个问题,我们需要按照以下步骤清理未使用的XPDL。以下示例查询是使用MySQL和MSSQL语法编写的。

Thai

ในเซิร์ฟเวอร์การพัฒนาเนื่องจากการออกแบบกระบวนการได้รับการปรับปรุงและพัฒนาอยู่เสมอจะมีแคช XPDL จำนวนมากในหน่วยความจำ ในระยะยาวสิ่งนี้อาจทำให้เกิดข้อยกเว้น "java.lang.OutOfMemoryError" เมื่อรันไทม์หรือเซิร์ฟเวอร์เริ่มต้น ในการแก้ปัญหานี้เราต้องล้าง XPDL ที่ไม่ได้ใช้โดยทำตามขั้นตอนด้านล่าง แบบสอบถามตัวอย่างต่อไปนี้เขียนโดยใช้ไวยากรณ์ MySQL และ MSSQL

Note
titleNote

1. Please shutdown your application server.

Chinese

请关闭您的应用程序服务器。

Thai

โปรดปิดเซิร์ฟเวอร์แอปพลิเคชันของคุณ

2. Please do a full database backup before proceeding to the following steps.

Chinese

请在进行以下步骤之前先完成数据库备份。

Thai

กรุณาทำการสำรองฐานข้อมูลเต็มรูปแบบก่อนที่จะดำเนินการตามขั้นตอนต่อไปนี้


1. Check existing count of XPDLs

Chinese

1.检查XPDL的现有数量

Thai

1. ตรวจสอบจำนวน XPDL ที่มีอยู่

On a common production server, normally there are only few app versions and each version only tied to 1 process version. This is because we won't do any development in production server, so the process version is only increased during the app imported. But in the development server, it will be a different case. The process version will be going up to few hundred process version which also means there are few hundred of XPDL data are cached in memory. To check how many XPDLs are cached, please run the following query in your database server.

Chinese

在通用的生产服务器上,通常只有少数应用程序版本,每个版本只与1个进程版本绑定。这是因为我们不会在生产服务器上进行任何开发,所以进程版本只会在导入的应用程序中增加。但是在开发服务器中,情况会有所不同。进程版本将上升到几百个进程版本,这也意味着有几百个XPDL数据被缓存在内存中。要检查缓存了多少XPDL,请在数据库服务器中运行以下查询。

Thai

บนเซิร์ฟเวอร์ที่ใช้งานทั่วไปโดยทั่วไปจะมีแอปพลิเคชันเพียงไม่กี่เวอร์ชันเท่านั้นและแต่ละเวอร์ชันจะผูกติดกับเวอร์ชันกระบวนการเพียงหนึ่งเวอร์ชันเท่านั้น นี่เป็นเพราะเราไม่ได้ทำการพัฒนาใด ๆ บนเซิร์ฟเวอร์การผลิตดังนั้นรุ่นกระบวนการจะเพิ่มขึ้นในแอปพลิเคชันที่นำเข้าเท่านั้น แต่ในเซิร์ฟเวอร์การพัฒนาสิ่งต่าง ๆ เวอร์ชันกระบวนการจะเพิ่มขึ้นเป็นเวอร์ชันกระบวนการหลายร้อยเวอร์ชันซึ่งหมายความว่ามีข้อมูล XPDL หลายร้อยรายการที่ถูกแคชในหน่วยความจำ ในการตรวจสอบจำนวนแคช XPDL ให้รันเคียวรีต่อไปนี้ในเซิร์ฟเวอร์ฐานข้อมูล

Code Block
languagesql
titleMySQL, MSSQL, Oracle
 select count(*) from SHKXPDLS

2. Check the count of unused XPDLs

Chinese

2.检查未使用的XPDL的数量

Thai

2.ตรวจสอบจำนวน XPDL ที่ไม่ได้ใช้

In all the cached process version XPDLs, there is a case that some process version is not used by any process instances. These unused XPDLs can be safely deleted. The check the number of unused XPDLs, we can use the following query. Then, we can know how many are unused in the total number of XPDLs.

Chinese

在所有缓存的进程版本XPDL中,有一些进程版本没有被任何进程实例使用。这些未使用的XPDL可以安全地删除。检查未使用的XPDL的数量,我们可以使用下面的查询。然后,我们可以知道在XPDL的总数中有多少是未使用的。

Thai

ในระหว่างกระบวนการแคชรุ่น XPDL ทุกรุ่นมีกรณีบางอย่างไม่ได้ใช้โดยอินสแตนซ์กระบวนการใด ๆ XPDL ที่ไม่ได้ใช้เหล่านี้สามารถลบออกได้อย่างปลอดภัย เพื่อตรวจสอบจำนวน XPDL ที่ไม่ได้ใช้เราสามารถใช้แบบสอบถามต่อไปนี้ จากนั้นเราสามารถรู้ได้ว่า XPDL ทั้งหมดนั้นไม่ได้ใช้งานเท่าใด

Code Block
language
Code Block
languagesql
titleMySQL, MSSQL
select count(*) from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
    select concat(packageId,packageVersion) as id from (
        select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion 
        from SHKActivities act 
        join SHKProcesses pro on act.Process = pro.oid 
        left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid 
        group by def.PackageId, def.ProcessDefinitionVersion 
        union 
        select packageId, packageVersion from app_package
    ) as used_processes group by packageId, packageVersion
);

...

Chinese

如果您想列出流程版本,则可以使用以下查询。

Thai

หากคุณต้องการแสดงรุ่นของกระบวนการคุณสามารถใช้แบบสอบถามต่อไปนี้

Code Block
languagesql
titleMySQL, MSSQL
select * from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
    select concat(packageId,packageVersion) as id from (
        select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion 
        from SHKActivities act 
        join SHKProcesses pro on act.Process = pro.oid 
        left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid 
        group by def.PackageId, def.ProcessDefinitionVersion 
        union 
        select packageId, packageVersion from app_package
    ) as used_processes group by packageId, packageVersion
);
Code Block
languagesql
titleOracle
select * from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
    select concat(packageId,packageVersion) as id from (
        select def.PackageId as packageId, TO_CHAR(def.ProcessDefinitionVersion) as packageVersion 
        from SHKActivities act 
        join SHKProcesses pro on act.Process = pro.oid 
        left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid 
        group by def.PackageId, def.ProcessDefinitionVersion 
        union 
        select packageId, TO_CHAR(packageVersion) from app_package
    ) group by packageId, packageVersion
);

3. Delete completed process instances data to clean up more XPDLs from cache

Chinese

3.删除已完成的流程实例数据以清除缓存中的更多XPDL

Thai

3.ลบข้อมูลอินสแตนซ์ของกระบวนการที่เสร็จสิ้นเพื่อล้าง XPDL เพิ่มเติมจากแคช

If the process instances data are not important to you or you have your process instance data captured a copy by the Process Data Collector plugin, you can delete your process instances data to increase the number of unused XPDLs. In this case, only the process version for running process instances and the latest process version for each app version will be kept.

Chinese

如果流程实例数据对您并不重要,或者您的流程实例数据被 Process Data Collector  插件捕获了副本,则  可以删除流程实例数据以增加未使用的XPDL的数量。在这种情况下,只保存运行流程实例的流程版本和每个应用程序版本的最新流程版本。

Thai

หากข้อมูลอินสแตนซ์กระบวนการไม่สำคัญสำหรับคุณหรือข้อมูลอินสแตนซ์กระบวนการของคุณถูกดักจับโดยปลั๊กอินตัวประมวลผลข้อมูลคุณสามารถลบข้อมูลอินสแตนซ์กระบวนการเพื่อเพิ่มจำนวน XPDL ที่ไม่ได้ใช้ ในกรณีนี้จะบันทึกเฉพาะเวอร์ชันกระบวนการที่รันอินสแตนซ์กระบวนการและเวอร์ชันกระบวนการล่าสุดสำหรับแต่ละเวอร์ชันแอปพลิเคชันเท่านั้นที่จะถูกบันทึก

Code Block
languagesql
titleMySQL
SET FOREIGN_KEY_CHECKS=0;
 
delete sa from SHKAssignmentsTable as sa
left join SHKProcesses as sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete sadsaj from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete sadsd from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete sad from SHKActivityData as sad
left join SHKActivities as sac on sad.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
delete sac from SHKActivities as sac
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete spd from SHKProcessData as spd
left join SHKProcesses as sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete spr from SHKProcessRequesters as spr
left join SHKProcesses as sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010); 
 
SET FOREIGN_KEY_CHECKS=1;
Code Block
languagesql
titleMSSQL
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"

delete sa from SHKAssignmentsTable as sa
left join SHKProcesses as sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete sadsaj from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete sadsd from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete sad from SHKActivityData as sad
left join SHKActivities as sac on sad.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete sac from SHKActivities as sac
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete spd from SHKProcessData as spd
left join SHKProcesses as sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete spr from SHKProcessRequesters as spr
left join SHKProcesses as sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 

delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010); 
 
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"
Code Block
languagesql
titleOracle
delete (select sa.* from SHKAssignmentsTable sa
left join SHKProcesses sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));

delete sadsaj from SHKAndJoinTable as saj
left join SHKActivities as sac on saj.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete sadsd from SHKDeadlines as sd
left join SHKActivities as sac on sd.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010); 
 
delete (select sad.* from SHKActivityData sad
left join SHKActivities sac on sad.Activity = sac.oid
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)); 
 
delete (select sac.* from SHKActivities sac
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)); 

delete (select spd.* from SHKProcessData spd
left join SHKProcesses sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)); 

delete (select spr.* from SHKProcessRequesters spr
left join SHKProcesses sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)); 

delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010); 

To limit the process within a time period for started and completed time, change all the where clause to following and modify the date.

Code Block
languagesql
titleMySQL
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) >= '2020-05-03 00:00:00.000' and FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) <= '2020-05-06 23:59:59.999')
and (FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) >= '2020-05-03 00:00:00.000' and FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) <= '2020-05-06 23:59:59.999')
Code Block
languagesql
titleMSSQL
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (DATEADD(s, ((sp.Started-sp.StartedTZO)/1000), '1970-01-01 00:00:00') >= '2020-05-03 00:00:00' and DATEADD(s, ((sp.Started-sp.StartedTZO)/1000), '1970-01-01 00:00:00') <= '2020-05-06 23:59:59')
and (DATEADD(s, ((sp.LastStateTime-sp.LastStateTimeTZO)/1000), '1970-01-01 00:00:00') >= '2020-05-03 00:00:00' and DATEADD(s, ((sp.LastStateTime-sp.LastStateTimeTZO)/1000), '1970-01-01 00:00:00') <= '2020-05-06 23:59:59')
Code Block
languagesql
titleOracle
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010)
and (FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) >= '2020-05-03 00:00:00' and FROM_UNIXTIME((sp.Started-sp.StartedTZO)/1000) <= '2020-05-06 23:59:59')
and (FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) >= '2020-05-03 00:00:00' and FROM_UNIXTIME((sp.LastStateTime-sp.LastStateTimeTZO)/1000) <= '2020-05-06 23:59:59')


If you would like to clean the all the process instances data including the If you would like to clean the all the process instances data including the running process instances, you can use the following query.

WARNING This deletes all your process records. Perform a backup before running the query below and is not recommended to be executed on a production server!


Chinese

如果要清除包括正在运行的流程实例在内的所有流程实例数据,则可以使用以下查询。

Thai

หากคุณต้องการล้างข้อมูลอินสแตนซ์กระบวนการทั้งหมดรวมถึงอินสแตนซ์กระบวนการที่กำลังทำงานอยู่คุณสามารถใช้เคียวรีต่อไปนี้

Code Block
languagesql
titleMySQL
SET FOREIGN_KEY_CHECKS=0;

delete from SHKAssignmentsTable;
delete from SHKAndJoinTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses;
 
SET FOREIGN_KEY_CHECKS=1;

...

Code Block
languagesql
titleOracle
delete from SHKAssignmentsTable;
delete from SHKAndJoinTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses;

4. Delete the unused XDPLs

Chinese

4.删除未使用的XDPL

Thai

4.ลบ XDPL ที่ไม่ได้ใช้

Now, you can delete the unused XPDLs and it will be free from your memory cache when next server startup.

Chinese

现在,您可以删除未使用的XPDL,并且在下一次服务器启动时它将从您的内存缓存中释放。

Thai

ตอนนี้คุณสามารถลบ XPDL ที่ไม่ได้ใช้และมันจะเป็นอิสระจากแคชหน่วยความจำของคุณเมื่อเซิร์ฟเวอร์เริ่มทำงานครั้งต่อไป

Code Block
languagesql
titleMySQL
SET FOREIGN_KEY_CHECKS=0;
delete x, xd from SHKXPDLS x join SHKXPDLData xd on x.oid= xd.XPDL
where concat(x.XPDLId, x.XPDLVersion) not in (
    select concat(packageId,packageVersion) as id from (
        select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion 
        from SHKActivities act 
        join SHKProcesses pro on act.Process = pro.oid 
        left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid 
        group by def.PackageId, def.ProcessDefinitionVersion 
        union 
        select packageId, packageVersion from app_package
    ) as used_processes group by packageId, packageVersion
);
SET FOREIGN_KEY_CHECKS=1;

...