Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e78f6c6
feat: partition mac_track_ports by scan date
somethingwithproof Nov 12, 2026
b6296c8
fix(utilities): run data-changing actions only on a POST
somethingwithproof Nov 12, 2026
2d4d20c
fix(utilities): gate the port table actions and hold the scan lock
somethingwithproof Nov 12, 2026
0cfe468
fix(partitions): exchange only the current scan's rows
somethingwithproof Nov 12, 2026
128f643
fix(partitions): recover a pending exchange that fails its retry
somethingwithproof Nov 12, 2026
fcd21ce
fix(partitions): count a day of buildup and check the cap per split
somethingwithproof Nov 12, 2026
4eee96b
fix(scan-dates): drop dates left empty by device, site and MAC deletes
somethingwithproof Nov 12, 2026
9b64b59
style: apply the Cacti php-cs-fixer rules to the new partition files
somethingwithproof Nov 12, 2026
1198a7b
test(partitions): load the upgrade helpers inside the conversion
somethingwithproof Nov 12, 2026
10de2a0
docs: add CHANGELOG entries for #426
somethingwithproof Nov 12, 2026
3cee852
docs: reword the Utilities changelog entry
somethingwithproof Nov 12, 2026
41946b6
fix(partitions): name the scan and partition locks per database
somethingwithproof Nov 12, 2026
d1aa2d2
chore(i18n): add the two missing messages to the translation template
somethingwithproof Nov 13, 2026
b90bf92
test: accept core's $log argument in the db_execute_prepared() stub
somethingwithproof Nov 13, 2026
3152992
feat(activity): record what maintenance is doing and for how long
somethingwithproof Nov 13, 2026
c31ceb3
feat(poller): record scan phases and why a run was deferred
somethingwithproof Nov 13, 2026
ec4dd3c
feat(utilities): show current activity on the Process Status page
somethingwithproof Nov 13, 2026
ec8555c
chore(i18n): add the Process Status activity messages to the template
somethingwithproof Nov 13, 2026
1329dc4
docs(changelog): note the Process Status activity sections
somethingwithproof Nov 13, 2026
d713c07
fix(partitions): rebuild only the hot partition and preserve retentio…
somethingwithproof Nov 14, 2026
1ba3e79
fix(partitions): keep two days created ahead, also for per-scan parti…
somethingwithproof Nov 14, 2026
cf8a85a
fix(partitions): preserve scans during interrupted recovery
somethingwithproof Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

--- develop ---

* issue#426: Keep completed scans in production when an interrupted partition exchange is retried, and preserve staging after failed recovery reads or cleanup

* issue: Scope ARP fallback lookups to the device site so reused MAC addresses do not supply translations from another site
* issue: Resume background database upgrades after a worker exits and finish migration-table cleanup when an earlier upgrade recorded completion before a failed drop
* issue: Keep MacTrack enabled while a database upgrade is pending; the settings hook launched the background upgrade before Cacti had loaded exec_background(), and the resulting error made Cacti disable the plugin
Expand All @@ -10,6 +12,9 @@
* issue#359: Restore the unique mac_track_aggregated_ports `port_number` key on upgraded installs, merging the duplicate rows the 4.9 upgrade let accumulate, so the table refresh no longer fails with "Duplicate entry ... for key 'port_number'" and the MAC separator migration runs only once; widen its `row_id` to bigint unsigned and run a version upgrade in only one page load at a time
* issue#399: Use the registered Aruba AOS-CX callback names in the built-in 6200/6300 device types and repair existing defaults during upgrade
* issue#430: Preserve aggregate sighting timestamps and unscanned devices, retain Layer 2 sightings without current ARP data, and identify older observations in the MAC report
* feature#426: Partition mac_track_ports by scan date, one partition per scan by default or hourly or daily, so retention drops expired partitions instead of deleting rows; new installs are partitioned and existing tables are converted from Utilities or mactrack_convert.php; Utilities rebuilds and analyzes only the latest populated partition (also on the legacy daily layout), maintenance keeps two days of partitions created ahead (daily slots that per-scan partitions are carved from) so scans move no rows in normal operation, and named retention settings keep their day count across DST
* issue: Confirm the Utilities actions that change data through one shared step, and hold the scan lock while the port table is rebuilt or optimized
* feature: Show on the Process Status page what MacTrack is doing now (scan phase, maintenance step, upgrade rebuild or conversion), why the poller last skipped a run, how long each step of the last maintenance took, and the size of each MacTrack table
* dev: Adopt the shared, byte-identical dashboarding card chrome used across the Cacti plugins: the MacTrack dashboard now drives its card grid through the shared `js/cards.js` (`CactiCards`) controller plus a thin `js/mactrack_dashboard.js` adapter, and the card markup/CSS use the shared `.cc*` contract (`css/cards.css`), with MacTrack's `--cc-*` theme bindings and card-body widgets kept in `css/mactrack-dashboard.css`. No functional change to the dashboard; this aligns MacTrack with the other plugins so the chrome can be promoted to Cacti core unchanged
* dev: Load the shared card chrome from Cacti core on 1.2.32+ (`include/js/cards.js` + `include/css/cards.css`) and only bundle the plugin's own copy on older cores
* dev: Run the CI poller with the shared runner group so RRD files and structured directories pass permission verification
Expand Down
14 changes: 14 additions & 0 deletions cli/upgrade_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@
exit(0);
}

// The scan lock keeps the upgrade apart from a scan and from a port table
// conversion (mactrack_convert.php): both write mac_track_ports, which the
// upgrade rewrites in place. Held until exit; the server frees it if the
// process dies. The console relaunches the upgrade once the lock is free.
if ((string) db_fetch_cell_prepared('SELECT GET_LOCK(?, 0)', [mactrack_lock_name('scan')]) !== '1') {
upgrade_debug('A MacTrack scan or port table conversion is running; the upgrade will be retried');

if ($registered) {
unregister_process('mtupgrade', 'database', 0);
}

exit(0);
}

$start = microtime(true);

upgrade_debug('Starting the MacTrack background database upgrade');
Expand Down
10 changes: 10 additions & 0 deletions includes/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1756,8 +1756,18 @@ function mactrack_setup_database(bool $notify_seed_failure = false): bool {
$data['keys'][] = ['name' => 'authorized', 'columns' => 'authorized'];
$data['type'] = 'InnoDB';
$data['comment'] = 'Database for Tracking Device MACs';
$ports_existed = db_table_exists('mac_track_ports');
api_plugin_db_table_create('mactrack', 'mac_track_ports', $data);

if (!$ports_existed) {
// Setup loads this file without lib/mactrack_functions.php.
include_once(__DIR__ . '/../lib/mactrack_partitions.php');
include_once(__DIR__ . '/../lib/mactrack_partition_ops.php');
include_once(__DIR__ . '/../lib/mactrack_partition_convert.php');

mactrack_partition_fresh_install();
}

$data = [];
$data['columns'][] = ['name' => 'device_id', 'type' => 'int(11)', 'NULL' => false, 'default' => '0'];
$data['columns'][] = ['name' => 'process_id', 'unsigned' => true, 'type' => 'int(10)', 'NULL' => true];
Expand Down
Loading
Loading