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.
- Resolve affected tenants in PartitionChangeEvent.getAffectedTenants(),
returning null (all tenants) for non rule engine events, empty diffs and
shared queue changes.
- HashPartitionService adds isolated tenants whose managed status changed
without a change of their own queue keys.
- PartitionChangeMsg: forAllTenants/forTenants factories instead of a null
sentinel; affected tenants excluded from toString().
- Fold the AppActor log line into the existing DefaultActorService one.
- Tests: priority ordering in ActorSystemTest, AppActorTest on a real actor
system, DefaultActorServiceTest through onTbApplicationEvent, the
managed-status scenario in HashPartitionServiceTest.
The tests run ZkDiscoveryService against an embedded ZooKeeper server
and check that the current node is registered once with a protected
node name and is excluded from other servers, both after start and
after a session expiry.
The current node ZK node is created with Curator protection, so a create
retried after a connection loss reuses the node already created by the
lost attempt, and a node left by a failed create is deleted in the
background instead of staying registered for the lifetime of the session.
Other servers list excludes ZK nodes carrying the current service id and
keeps a single, most recently modified, ZK node per service id, so every
node builds the same partition ring when a service has duplicate
registrations.
Cache events for ZK nodes with the current service id are ignored, with
an error logged when such a node appears. Removal of a duplicate ZK node
of another service no longer publishes a shutdown event while that
service is still registered.
Publish creates a new ZK node only when the current one is definitely
absent or owned by another session. An existing node of the current
session is updated in place regardless of its data, and a failed
existence check skips the publish cycle instead of creating a node.
AbstractTbQueueConsumerTemplate.poll() returned emptyList() immediately
when partitions was empty, bypassing both doPoll() and the secondary
sleep guard (which is also skipped for backends that report
isLongPollingSupported()==true, e.g. Kafka). The result was a
permanent CPU-burning loop on consumers whose partition assignment
ended up empty after a rebalance cascade — observed on 26
ie-downlink-consumer threads (~244% total CPU) until container restart.
Route the empty-partition path through sleepAndReturnEmpty() so the
caller honors durationInMillis regardless of long-polling support.
Switches the ZooKeeper-based service discovery from the deprecated
org.apache.curator.framework.recipes.cache.PathChildrenCache to the
modern CuratorCache replacement (Curator 5.x).
- ZkDiscoveryService: field type, construction, listener registration
and child-event handler migrated to the new API. parentPathFilter
and zkNodesDir guard preserve the original direct-children semantics
against the recursive-by-default behaviour of CuratorCache.
- ZkDiscoveryServiceTest: mock type and event construction adapted to
the new listener signature; existing assertions unchanged.
Eliminates 11 [WARNING] lines for PathChildrenCache deprecation on
lts-4.2 (targeted Tier 3 slice of #15481): repo-wide [WARNING] count
843 -> 832, [ERROR] count 0 -> 0.
The alreadyProcessed() method used separate get() and put() calls on the
local cache, allowing concurrent threads in the notification executor pool
to both read null and bypass deduplication, creating duplicate notifications.
Replace with a single compute() call that atomically checks and updates
the cache entry, preventing the race between concurrent trigger processing.
Also fix: discard external cache timestamps that are more than 1 hour in
the future (clock skew protection), and avoid reading back from the SOFT
ref local cache when writing to external cache (GC could null it out).
* Experiments with CSV
* CSV Loader v1
* EDQ tests
* Volatile variables instead of final
* Improvements
* updated loader with new entities
* Fix double memory usage issue
* Basic data structures and load
* Minor improvements
* Snappy + Large String reuse
* added EntityFields classes for each entity
* Basic implementation
* Minor improvements to KeyFilters
* implemented RepositoryUtils.checkKeyFilters
* Generic query implementation
* New structure
* Refactoring and few processors implementation
* extended DeviceData with shared/client attributes and device profile
* Minor refactoring of attribute scopes
* DeviceTypeFilter support
* Strong types of fields for each entity data class
* DeviceType and AssetType filters
* EntityView and Edge queries
* Relations Query
* Relation Query Implementation
* Update EDQS module version
* Sync with EDQS via Kafka
* EDQS: major refactoring
* EDQS API requests via Kafka
* EDQS: full sync with the database
* Refactoring for EDQS sync
* EDQS: major refactoring and new features
* EDQS refactoring, count query support, fix tests
* EDQS: refactoring for query processors
* Fix EDQS pom version
* Cleanup edqs.yml
* EDQS: tenant partitioning strategy; refactoring
* EDQS: latest events queue
* EDQS: support for monolith setup; RocksDB; other improvements
* EDQS: merge sync and events topics, introduce state topic
* EDQS: dynamic repartitioning
* implemented entity data query filters for edqs
* EdqsEntityQueryControllerTest - use in-memory queue
* edqs-filter fixes, added test
* EDQS: blob entity support
* EdqsEntityQueryControllerTest - use in-memory queue
* Use DummyEdqsService when disabled
* Fixes for EDQS
* Refactoring for EDQS tests
* Fix edqs requests partitioning
* EDQS: Fix for attributes handling
* Fix attributes saving in EntityServiceTest
* EDQS: refactoring, fixes
* Minor refactoring for query processor
* added ownerName/ownerType support
* fixed relation query processor
* fixed EntityServiceTest
* refactoring
* added support for parentId for relation query result
* Get rid of EntityNameFetcher
* Add fixme for relation query processor
* db restore with select all edqs fields
* fixed entity deletion
* fixed FieldUtils with new EntityFields
* dao method renamed
* EDQS: instance groups with same partitions; automatic sync; multiple fixes
* Refactoring for EDQS sync
* EDQS: refactoring
* Fix startup with Kafka
* fixed EntityQueryControllerTest
* fixed EdqsEntityServiceTest
* Separate queue admin for EDQS request template
* Implement new EDQS partitioning strategy
* EDQS: multiple fixes and refactoring
* Add mock EdqsRocksDb beans to tests
* added edqs stats for inmemory/grafana
* fixed filter tests
* Update todos
* Refactoring for QueueConfig
* Improvements and refactoring for EDQS consumers
* implemented TODOs
* test fixes
* Consume state topic up to end offsets
* edqs stats refactoring
* EDQS: cleanup on partitions removal; refactoring
* EDQS: minor refactoring
* EDQS: remove CSV loader
---------
Co-authored-by: Andrii Shvaika <ashvayka@thingsboard.io>
Co-authored-by: dashevchenko <dshevchenko@thingsboard.io>
Local Subscription Service refactoring
Refactoring of the proto structures
Bug fixing after refactoring
Minor improvements and bug fixes
Improvements to avoid additional DB calls
Bug fixes after refactoring
Cluster mode improvements