Pre-flight Check and Dry Run
Before a purge deletes a single row, it proves that it can finish. The pre-flight check runs about thirty-five checks against the configuration, the archive database, the schema, the request queues and the ledger and inventory history, and refuses the run if any of them fails. The dry run goes one step further and counts what the purge would delete, document type by document type and table by table. Neither changes any data, and both are done from the Purge Monitor.
Opening the Purge Monitor
- From the configuration: the Purge Monitor action on the Purge Configuration screen opens the monitor on that configuration.
- From the utilities: Utilities → Monitoring → Purge Monitor, then choose the configuration.
Only the admin user can open it. The top of the page shows the configuration's code and name, its status, a Dry run mode chip while Dry Run (preview only) is still ticked, the Server node the page talks to, and a link to Open configuration. Below it sit the action buttons (Check, Dry run, Create missing indexes, and Run purge or Resume purge), a Configuration card that summarises the cut-off, the companies, the archive database, the options, the books and terms and the document grids, and four tabs: Pre-flight, Dry run, Run and Log.
The pre-flight check
Press Check. The check runs in the background and takes from a few seconds to several minutes (about nine minutes on a database of about 400 GB, most of it in the inventory checks). Its verdict is exactly the one Run purge would get: the run itself starts with the same checks.
The Pre-flight tab then shows an outcome — Passed, Passed with warnings or Refused — with the number of checks in each state, and, when refused, the list under Run would be refused with. Below it the checks are grouped in six cards: Configuration, Archive database, Indexes and references, Pending requests, Ledger roll-up and Inventory roll-up. Open a card to see its checks. Each check shows one of:
| State | Meaning |
|---|---|
| Passed | Nothing to do. |
| Warning | The run is allowed, but something will be carried forward that the customer should know about. Read it and agree it with the customer. |
| Failed | The run is refused until this is fixed. |
| Skipped | Not relevant for this configuration (for example, the archive checks when nothing is copied), or already proved (the queue checks on a resume). |
| Could not check | The check itself failed. It refuses like a failure; the message says why. |
A check that found offending rows shows Show N row(s): a table of the rows (the periods still open, the missing indexes, the companies without a closing entry, the stock groups that can not be carried…) that you can export with Export CSV and send to the customer or to Namasoft support. Some checks also offer a button that fixes or opens the fix: Create missing indexes, Open configuration or Open the utility.
The check also runs on its own when you press Run purge, so there is no way to skip it. Fix the failures, press Check again, repeat until nothing fails.
The checks
| Group | Check | What it verifies | When it fails |
|---|---|---|---|
| Configuration | The purge configuration is committed | The record is saved, not a draft. | Save the configuration. |
| Configuration | The purge batch size properties are in range | The three chunk-size properties, if set, are inside their ranges. | Correct or remove the property (preparation). |
| Configuration | Replication is disabled | No replication. | Switch replication off. |
| Configuration | Every legal entity uses the calendar of the cut-off period | One calendar for all companies. | No purge is possible until it is so. |
| Configuration | The cut-off period is valid | The purge period is still a purge period, ends before today, is later than every started purge, and (on a resume) still has the end date the purge started with. | Restore the period. |
| Configuration | The document grids were reviewed | The grids are not both empty while archivable documents exist in the range. | Populate Purge Grids, review, save. |
| Archive database | The archive has its own data source | purgedbsource is set to a data source other than the main one. | Archive setup. |
| Archive database | The archive database is on the main instance and visible to it | Same SQL Server instance, and the main login can see it. | Move it to the main instance, or grant access; restart after changing the property. |
| Archive database | The archive database has every archive table | All archive tables exist. | Check enable-purge=true and restart. |
| Archive database | No archive column is narrower than in the main database | No archive column would cut a value. | Open the utility opens Purge archive column widening in the Utility Runner; run it with execute, outside working hours, after a backup of the archive. |
| Archive database | The archive database continues the purge files of this database | Every purge file recorded in the archive is a finished purge file of this database, and an archive that holds an older purge also holds the last one. | Point purgedbsource at the archive of this database or at a new empty one, restart (The archive of a later purge). |
| Indexes and references | The indexes the purge needs exist | Every index the chunks rely on. The rows list each table and column with its reason. | Create missing indexes. |
| Indexes and references | No foreign key of an older version points at the approval cases or the attachments | No legacy foreign keys from versions before 2020. | Create missing indexes also drops them. |
| Indexes and references | Every reference to a purged type is registered | Every record type that can point at a deleted document is known to the purge, so its link can be emptied. | Report to Namasoft support: it needs a product change. |
| Pending requests | No request dated in the purged range is waiting | No ledger or inventory request in the range is unprocessed or failed. | Process or resolve them in Business Requests. |
| Pending requests | No queued business request is waiting | The saved requests queue is empty. | Wait a few minutes. |
| Pending requests | The stock ages queues are drained | The stock ages queues are empty. | Wait. |
| Ledger roll-up | Every fiscal period of the purged range is closed | All periods ending on or before the cut-off are closed. | Close them. |
| Ledger roll-up | Every legal entity has a closing entry for the purged range | A committed closing entry at or after the cut-off, for every company with balances. | Create the closing entry. |
| Ledger roll-up | The purge journal term is set when a roll-up is due | Journal Entries Term is set when there are balances. | Set it on the configuration. |
| Ledger roll-up | The purge journal term has a clearing account when a roll-up needs several journals | Purge Roll-up Clearing Account on that term. | Set it on the term. |
| Inventory roll-up | The inventory roll-up can carry every case forward | Runs the whole stock and cost roll-up without writing, for every company and item configuration. | See the detail checks below and Inventory refusals. |
Inventory refusals
The inventory roll-up is computed in full during the check, so that nothing is refused after the documents are already gone. When it can not restate a case exactly, the check The inventory roll-up can carry every case forward fails, and one detail check names the reason (these detail checks carry the note detail, not a refusal on its own). Each has Show rows with the company, item configuration, stock key, quantity and cost.
| Detail check | What it found |
|---|---|
| Negative groups can be carried forward under this costing | Negative stock on serial-tracked items; it can not be carried. |
| Negative groups have cost rows of their own | Negative stock whose cost does not add up to its quantity. |
| Every cost group matches a quantity group | Cost that no stock key explains, typically cost transactions left behind by a document whose stock effect was deleted long ago. |
| No cost group nets negative without a negative on-hand group | Negative cost quantity with no negative stock beside it. |
| No cost-tracked quantity group is left without cost | Stock of a cost-tracked item that has no cost at all. |
| Every cost-out group matches a cost-in group | Average costing: cost issued that no receipt explains. |
| No on-hand group is spread over several cost-engine qty dimensions | Average costing: one stock key whose cost the engine keeps in several places. |
| FIFO layers, open issue lines and on-hand quantities agree | FIFO: per cost dimension, the remaining layers, the issues still waiting for a layer and the stock on hand do not add up. |
| No other inventory roll-up refusal | Any other reason; the message says which. |
| The cost engine state can be carried forward exactly | The running totals the cost engine keeps (for example an open shortage of an issue in the range that stands for stock that is really missing) can not be restated at the cut-off. |
These refusals describe old inconsistencies in the stock and cost history. They are not purge defects, and the purge does not repair them. Export the rows and take them to Namasoft support before deciding anything with the customer.
Warnings to agree with the customer
These checks never refuse. They tell you what will be carried forward as it is:
| Check | What will happen |
|---|---|
| Negative groups carried forward | Stock that is negative at the cut-off is carried as negative roll-up lines (under FIFO, without cost). |
| Cost quantity without stock carried forward | Cost whose stock effect was deleted long ago is carried on roll-up lines with zero quantity, so the valuation does not change. |
| FIFO issue lines kept open across the cut-off | Issue lines still waiting for a layer (or covered by a layer received after the cut-off) are kept without their documents; costing them later creates no cost-of-sales entry. |
| Roll-up lines restated without a required locator | Stock received before its warehouse required locators is carried without a locator, exactly as history holds it. |
| Roll-up lines restated on a locator of another warehouse | Stock on a locator that has since been moved to another warehouse is carried on that locator, as history holds it. |
The dry run
Press Dry run. It is allowed only while the purge has not started (status Initial), because it rewrites Last Run Log, which later holds the failure reason or the audit of the run. It runs the pre-flight first, then counts. On a large database expect about ten minutes.
The Dry run tab shows:
- when it ran, the cut-off, and the chip No data was modified;
- the pre-flight outcome with a link to See the pre-flight checks;
- cards with the totals: documents that Will be copied to the archive and deleted, Will be deleted and Will be marked purged, the Transaction rows and the Cleanup tables;
- Documents per type: every document type with its behaviour and count;
- Transaction rows: every transaction table with the rows to remove (a
~marks an estimate, used for some of the matching tables); - Cleanup tables: actions history, version history, user notifications and pending tasks (kept when the configuration keeps them), followed by the other system tables the run will clean, each with the number of rows it would remove;
- Negative groups carried forward, when there are any.
The same preview is written to Last Run Log on the configuration.
The document counts are a little high
Counts include uncommitted documents; the purge only touches committed ones. The dry run counts quickly from the system entries, so drafts dated in the range are included. On a real database the difference was a handful of documents per type.
Read the dry run with the customer. It is the last moment to change a behaviour: the counts per type tell you whether you are about to delete a type somebody still needs. The Run purge button stays disabled until a dry run has been done on this server since it last started (Do a dry run first), and while the last pre-flight refused (The last pre-flight refused the purge).
Messages you may see
| Message | Why | What to do |
|---|---|---|
| Purge can not start: the purge config {0} is not committed; commit it first — «لا يمكن بدء الحذف: ملف إعدادات الحذف {0} غير معتمد، يرجى اعتماده أولا» | The configuration is a draft. | Save it. |
| Purge can not start: both document grids of the config {0} are empty while {1} still has committed documents dated on or before {2}; fill the purged documents / documents to delete grids (Populate Purge Grids) with an explicit behavior per type first — «لا يمكن بدء الحذف: جدولا المستندات في الملف {0} فارغان بينما يوجد في {1} مستندات معتمدة بتاريخ {2} أو قبله. املأ جدولي المستندات المحذوفة والمستندات المطلوب حذفها (تعبئة جداول الحذف) مع تحديد طريقة حذف صريحة لكل نوع أولا» | The grids were never filled. | Populate Purge Grids, review, save. |
| Purge requires an index on {0} ({1}). Use the Create Missing Indexes action, or create it manually: CREATE INDEX IX_{0}_{1} ON {0} ({1}) — «يتطلب الحذف وجود فهرس على {0} ({1}). استخدم إجراء إنشاء الفهارس الناقصة، أو أنشئه يدويا: CREATE INDEX IX_{0}_{1} ON {0} ({1})» | An index is missing. | Create missing indexes. |
| Purge requires dropping {0} foreign key(s) to ApprovalCase and LargeData: older versions created them, the current data model does not have them, and with them every deleted approval case or attachment makes the database search all those tables. Use the Create Missing Indexes action, which drops them — «يتطلب الحذف إزالة {0} مفتاح أجنبي إلى ApprovalCase و LargeData: أنشأتها إصدارات قديمة وليست موجودة في نموذج البيانات الحالي، ومع وجودها يبحث النظام في كل تلك الجداول عند حذف كل حالة اعتماد أو مرفق. استخدم إجراء إنشاء الفهارس الناقصة، وهو يزيلها» | Legacy foreign keys exist. | Create missing indexes. |
| Purge can not start: the reference {0} is not registered in any PurgerUtil; purging would leave surviving rows pointing at deleted documents - register the reference first — «لا يمكن بدء الحذف: المرجع {0} غير مسجل في أي PurgerUtil، والحذف سيترك سجلات باقية تشير إلى مستندات محذوفة - سجل المرجع أولا» | A type to delete is referenced from a place the purge does not know. | Report it to Namasoft support. If the type is in the grid of documents to delete, removing its line (so it is only marked) avoids the refusal. |
| Purge can not start: {0} column(s) of the archive database {1} are narrower than in the main database, for example {2}; archiving them would fail or change their values. Run the utility {3} from the Utility Runner page, then re-run the purge — «لا يمكن بدء الحذف: يوجد {0} عمود في قاعدة بيانات الأرشيف {1} أضيق من مثيله في قاعدة البيانات الرئيسية، مثل {2}، وأرشفتها ستفشل أو ستغير قيمها. شغل الأداة {3} من صفحة تشغيل الأدوات ثم أعد تشغيل الحذف» | Archive columns are too small. | Run the widening utility. |
| Purge can not start: {0} queued business request(s) are still waiting to be picked up; wait for the request queues to drain — «لا يمكن بدء الحذف: {0} من طلبات الأعمال ما زالت في قائمة الانتظار، انتظر حتى تفرغ قوائم الطلبات» | Requests are still queued. | Wait, then check again. |
| Purge can not start: {0} pending stock-ages queue record(s) in {1}; wait for the stock ages processor to drain them — «لا يمكن بدء الحذف: يوجد {0} من سجلات انتظار أعمار المخزون في {1}، انتظر حتى ينتهي معالج أعمار المخزون منها» | Stock ages work is queued. | Wait, then check again. |
| The inventory roll-up of purge configuration {0} can not carry {1} case(s) forward, so the purge was not started: {2} — «لا يستطيع ترحيل المخزون في ملف الحذف {0} نقل {1} حالة إلى الرصيد الافتتاحي، لذلك لم يبدأ الحذف: {2}» | See Inventory refusals. | Export the rows, take them to support. |
| {0} dimension group(s) that net negative at the cut-off are carried forward as negative roll-up lines, total quantity {1}, total cost {2} — «{0} مجموعة محددات صافيها سالب عند تاريخ القطع تم ترحيلها كسطور سالبة في سندات الأرصدة المجمعة، إجمالي الكمية {1}، إجمالي التكلفة {2}» | Warning. | Agree it with the customer. |
| {0} key(s) hold a cost quantity that no stock quantity matches (cost transactions whose stock effect was deleted), carried forward as they are, total quantity {1}, total cost {2} — «{0} مفتاح يحمل كمية تكلفة لا تقابلها كمية مخزنية (حركات تكلفة حُذف أثرها المخزني) تم ترحيلها كما هي، إجمالي الكمية {1}، إجمالي التكلفة {2}» | Warning. | Agree it with the customer. |
| {0} issue line(s) of the purged range, total quantity {1}, are still open or were covered by a layer received after the cut-off: they are kept without their documents, and costing them later generates no ledger entry — «{0} سطر صرف في الفترة المحذوفة بإجمالي كمية {1} ما زالت مفتوحة أو غطتها طبقة وردت بعد تاريخ التنظيف: تبقى بدون مستنداتها، وتكلفتها لاحقاً لا تنشئ قيداً محاسبياً» | Warning (FIFO). | Agree it with the customer. |
| {0} roll-up line(s), total quantity {1}, are restated without a locator in a warehouse that now requires one, as the purged rows held them — «{0} سطر ترحيل بإجمالي كمية {1} يُعاد إثباتها بدون موقع في مستودع يتطلب الموقع الآن، كما كانت في الحركات المحذوفة» | Warning. | Agree it with the customer. |
| {0} roll-up line(s), total quantity {1}, are restated on a locator that belongs to another warehouse today, as the purged rows held them — «{0} سطر ترحيل بإجمالي كمية {1} يُعاد إثباتها على موقع يتبع اليوم مستودعاً آخر، كما كانت في الحركات المحذوفة» | Warning. | Agree it with the customer. |
| Purge {0} has already started (status: {1}); a dry run is only possible before the purge starts — «بدأ الحذف {0} بالفعل (الحالة: {1})، والتشغيل التجريبي متاح فقط قبل بدء الحذف» | Dry run on a started purge. | Not possible; use Check. |
| Only admin user can view the purge monitor — «يمكن للمستخدم المسؤول فقط عرض شاشة متابعة الحذف» | The user is not admin. | Sign in as admin. |