- UPLINK_CONVERTER step with "default": true and no template: the wizard builds the converter ThingsBoard creates for a new integration of the method's type (INTEGRATION_TTN: TTN) from the UI assets, and installs, overwrites and updates it like a template of the package.
- Installed items: a device package whose default converter differs from ThingsBoard's default converter now shows "New converter available". It opens the update of the installed version, which brings the converter to the default one. A package that took another package's converter overwrites it with the shared-entity warning.
- After an update overwrites an entity, the other packages that recorded its checksum record the new one.
- INTEGRATION step "metadata": its entries are added to the integration's metadata at create, overwrite, use existing and update; the entries the integration has stay. An entry that maps a name to itself (profile.<name>: <name>) isn't added. The checksum of an integration leaves out its metadata.
- The default TTN and TTI converters take the profile name from the integration metadata entry profile.<brand_id>-<model_id> when there is one.
- Form field "resettable": a field the user changed shows a button that puts its default value back.
- Integrations and converters need the INTEGRATIONS feature, as through their API
- An overwritten or created entity gets its step's attributes, as at install
- The checksum ignores debug settings and the default profile flag
- The installed item is locked during the update; a plan of another installed version is refused
- The integration check before save is shared with IntegrationController
- Without a checksum: dashboard image links and rule chain server fields don't count as changes;
with nothing to compare against, the entity counts as changed
- Renamed steps keep their form values, entity and check state
- An entity referring to an entity the update creates again is overwritten
- Instructions before the Update step resolve the installed entities
- The download link of a changed entity is one translation key
The wizard no longer saves the entities itself and reverts them from
snapshots on a failure. It plans the update and the server applies it.
- POST /api/iot-hub/installedItems/{id}/deviceUpdate takes the entity of
each step, resolved from the new version's template, and saves all of
them with the new version of the installed item in one transaction.
Any failure rolls everything back. The audit log, version control and
attributes are written after commit.
- The server checks the plan: only the package's entities or confirmed
conflicts are overwritten, the device and its credentials never change,
and an entity changed since the check fails the update (version).
- GET .../deviceUpdate/check reports for each entity whether it still
exists, is shared with other packages, or was changed since install,
by a checksum the server keeps in the install state at install and on
update. Packages installed before keep the comparison with the template.
- An entity changed since install is overwritten only after a warning,
with a link to download its current version. A shared one shows the
shared warning.
- Only texts changed: the version is recorded without the wizard.
- Try again checks the update again. Errors show validation messages and
a common message for anything else.
With its own element at the uplink ts, a metadata key also returned by the script
overwrote the script's value. The metadata keys now go into the script's element at
that ts, only where the script has no value, as for an object result. Without such an
element they keep their own element at the uplink ts.
The metadata telemetry keys went into a separate array element without ts, so they
were saved at the server time, while the script's own values were saved at the
uplink time. The element now takes ts from the metadata, the same ts the script reads
and the one an object result already uses for these keys.
A new TTN or TTI integration now starts with the converter the IoT Hub LoRaWAN
packages install. A device registered from the LoRaWAN Device Repository gets the
profile <brand_id>-<model_id> and its decoded values as telemetry, with a Milesight-style
history list kept at each record's time. Any other device gets the LoRaWAN Device
profile and its raw payload as data. The device is named by its end device ID and
added to a group named after the application.
The TBEL and JS defaults are the same script. ConverterControllerTest runs both through
the real default v2 configuration for TTN and TTI, so ui-ngx now also copies that
configuration to the classpath.
Updating an installed device package deleted everything the package created,
the device included, so its telemetry and attributes were lost, and nothing
was installed again.
Now the update opens the install wizard of the new version over the installed
package. It keeps the install method and the form values, finds the entities
by the ids in the install state (so a renamed profile is still found), keeps
the device and gateway as they are (id, credentials, history) and overwrites
the device profile, converters, integration, dashboard and rule chain with the
new templates under their current names. The installed item then takes the
new version through registerDeviceUpdate. The server no longer updates a
device package by itself.
PROD-9096
- The device install form shows placeholders, templated defaults, an
Advanced section and a ThingsBoard connection section with the MQTT host
and port, cleans pasted values, shows errors after the user leaves a field
and does not let the browser autofill ThingsBoard credentials.
- A field marked by the package checks the integration connection.
- The TTN and TTI install methods are named The Things Stack Sandbox and
The Things Stack Cloud.
- The TTN converter metadata includes the coding rate and the gateway channel.
- Deleting or updating a device package keeps the integrations, converters
and other entities that another installed device package uses, and the
delete dialog names them before the user confirms.
- The Open button of an installed item names what it opens.
The bean condition also required sql.ttl.api_keys.ttl to be greater than
zero, but that property is not defined in thingsboard.yml and defaulted to
zero, so the bean was never created and expired API key rows were never
removed.
ApiKeysCleanUpService does not read a retention value: it deletes keys whose
expiration time has already passed. Drop the unused property from the
condition and gate the bean on sql.ttl.api_keys.enabled alone.
Note that cleanup is now active by default on upgrade, since
sql.ttl.api_keys.enabled defaults to true. Expired API keys are already
rejected during authentication, so this only removes the stale rows.
security.api_key.value_bytes_size referenced SECURITY_API_KEY_VALUE_PREFIX,
the same variable as value_prefix. SECURITY_API_KEY_VALUE_BYTES_SIZE had no
effect, and setting a custom prefix made value_bytes_size resolve to a
non-numeric value, which fails int conversion of the @Value injection in
ApiKeyServiceImpl and breaks application startup.
partitionService is a mock, so an unstubbed getAllServiceIds() returns an
empty set and the known-id tests also passed through the fail-open branch.
Assert that a live member is accepted without consulting getAllServiceIds,
so the tests fail if the isKnownServiceId check is broken.
The recently-seen grace period and fails-open-on-unknown-topology paths
of isUnknownService were only tested for pushNotificationToCore. Mirror
those tests for pushNotificationToRuleEngine and pushNotificationToTransport
so a regression scoped to those service types doesn't slip through.
- Use the new isKnownServiceId() instead of getAllServiceIds().contains(),
avoiding two collection allocations on the common (live member) path.
- Reuse SetCache instead of a hand-rolled Caffeine cache for
recentlySeenServices.
- Drop pushNotificationToTransport's null/empty serviceId guard, now
redundant with isUnknownService() treating null/empty as unknown.
- Track skipped-due-to-unknown-service notifications in a counter and
surface it via the existing periodic stats log, since the point of
this guard is to catch a leak that was previously invisible.
getAllServiceIds() rebuilds two HashSets just to test membership of a
single id - PartitionService#isKnownServiceId scans the live service
lists directly instead, for the hot path in DefaultTbClusterService's
per-notification unknown-service guard. SetCache.boundedBySize() adds
an LRU-by-size variant alongside the existing TTL-based constructor.
The clusterService field is typed as the TbClusterService interface, which
does not declare onServiceListChanged (it is a concrete-class @EventListener).
Cast to DefaultTbClusterService in the recently-seen test so it compiles.
Make the unknown-service-id skip a lenient safety net rather than a
precise gatekeeper. A service id is treated as known if it is either a
current member (PartitionService.getAllServiceIds) OR a recently seen one.
The recently-seen set is a bounded (1024) LRU cache fed from
ServiceListChangedEvent, so a node that is briefly absent from the live
snapshot - discovery-propagation lag, rolling restart, transient
scale-down - still receives its notifications instead of having them
dropped; genuine non-delivery to a node that is actually gone is already
handled by the caller-side RPC/REST timeout. An id gone for good ages out
via LRU eviction and the guard tightens again.
The live-snapshot check stays authoritative for current members (discovery
events are change-only, so a pure recently-seen cache would go cold in a
quiet cluster); recently-seen only widens 'known', it never adds a new
drop. Adds a test for the offline-but-recently-seen path.
Follow the existing pushNotificationToTransport convention: a deliberate
skip to a non-member service id now completes the callback as a no-op
success instead of onFailure, so callers don't treat an intentional skip
as a delivery error. Aligns all three skip paths (core, rule engine,
transport) on one contract.
- Extend the unknown-service-id orphan-topic guard to pushNotificationToTransport
- Make HashPartitionService.currentOtherServices volatile (now read on the
per-notification path, written under the synchronized recalculatePartitions)
- Lower the per-skip log from warn to debug to avoid noise when stale service
ids appear in message metadata during normal operation
- Add tests for the transport guard (unknown skipped, known sent)
Per-service notification topics (<notifications-topic>.<serviceId>) are
auto-created by the Kafka producer on first send. pushNotificationToCore and
pushNotificationToRuleEngine forwarded the target service id as-is. That id may
come from message metadata (e.g. the originServiceId of RPC reply and
integration-downlink flows), so an id that does not belong to the cluster
created an orphan notification topic that no node ever consumes and that is
never cleaned up, growing the topic count without bound.
Validate the target service id against current cluster membership
(PartitionService.getAllServiceIds) before sending; when the id is not a known
TB_CORE / TB_RULE_ENGINE service, skip the push and report delivery failure on
the callback (the message was not delivered, so onFailure is the correct signal
and it also lets a waiting caller complete). The check fails open while the
cluster topology is not yet known (empty membership, e.g. right after startup)
so legitimate notifications are never dropped.
The tracking compensated for isManagedByCurrentService reporting isolated tenants
of a profile without dedicated servers as not managed (a dedicated server for any
other profile flipped it). That root cause is fixed in #16345, after which a
tenant's managed status changes only together with its own queue ownership, and
its queue keys are already in the partition change event.
Replace the test that pinned the old flip with one that checks the affected
tenants when a dedicated server for the tenant's own profile joins and leaves.
With the entity partitioning strategy, DummyTask.getEntityId() returns a new
random id per task, so the 200 tasks spread over many partitions and run in
parallel. 200 x 50 ms tasks could all finish within the fixed Thread.sleep(500),
so the cancel found nothing left to discard (discardedCount == 0).
Use 30 s tasks (60 s task timeout) so tasks are always in flight when the job
is cancelled, whatever the partitioning strategy, and cancel as soon as the job
is RUNNING. Cancellation interrupts running tasks (TaskProcessor.cancelRunningTasks),
so the test still finishes quickly. One test body covers both strategies.