Skip to content

DELIA-69741 : [Enhancement] Increase the limits in PersistentStore (#…#6459

Open
npoltorapavlo wants to merge 1 commit intordkcentral:release/8.3_p1vfrom
npoltorapavlo:DELIA-69741-8.3_p1v
Open

DELIA-69741 : [Enhancement] Increase the limits in PersistentStore (#…#6459
npoltorapavlo wants to merge 1 commit intordkcentral:release/8.3_p1vfrom
npoltorapavlo:DELIA-69741-8.3_p1v

Conversation

@npoltorapavlo
Copy link
Contributor

…6442)

  • DELIA-69741 : [Enhancement] Increase the limits in PersistentStore

Reason for change: Increase max limits for each key from 3K to 10K to allow storing tokens for different use cases. Increase limits for namespace from 10K to 50K.
Test Procedure: None
Risks: None

  • Copy workerpool setup from Thunder tests (Thunder/Tests/unit/workerpool/) Make tests less state agnostic

…dkcentral#6442)

* DELIA-69741 : [Enhancement] Increase the limits in PersistentStore

Reason for change: Increase max limits for each key
from 3K to 10K to allow storing tokens for different use cases.
Increase limits for namespace from 10K to 50K.
Test Procedure: None
Risks: None
Signed-off-by: Nikita Poltorapavlo <npoltorapavlo@productengine.com>

* Copy workerpool setup from Thunder tests (Thunder/Tests/unit/workerpool/)
Make tests less state agnostic

---------

Signed-off-by: Nikita Poltorapavlo <npoltorapavlo@productengine.com>
Copilot AI review requested due to automatic review settings February 26, 2026 11:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates PersistentStore default size limits (to support larger token payloads) and refactors the SQLite Store2 l1 tests to use an explicit worker pool setup rather than a custom WorkerPoolImplementation wrapper.

Changes:

  • Increase default maxvalue from 3000 → 10000 bytes and default namespace limit from 10000 → 50000 bytes.
  • Refactor Store2Test.cpp fixture to create/assign a WPEFramework::Core::WorkerPool in SetUp()/TearDown(), and remove the old WorkerPoolImplementation.h.
  • Adjust/rename several tests and constants; remove corruption-recovery test cases for non-DB/corrupt SQLite files.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
PersistentStore/sqlite/l1test/WorkerPoolImplementation.h Removed the bespoke worker pool wrapper previously used by l1 tests.
PersistentStore/sqlite/l1test/Store2Test.cpp Reworked test fixture lifecycle/worker pool wiring; adjusted limits/TTL tests; removed corruption tests.
PersistentStore/CMakeLists.txt Raised default config limits for per-item max size and per-namespace storage limit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 210 to 214
EXPECT_THAT(store2->SetValue(
IStore2::ScopeType::DEVICE, kAppId, kKey, kValue, kNoTtl),
Eq(WPEFramework::Core::ERROR_NONE));
lock.Lock(2 * WPEFramework::Core::Time::MilliSecondsPerSecond);
lock.Lock();
EXPECT_THAT(eventScope, Eq(IStore2::ScopeType::DEVICE));
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lock.Lock() waits indefinitely; if the ValueChanged notification is never dispatched (e.g., worker pool misconfigured or job submission fails), this test can hang the entire suite. Use a bounded wait (timeout) and fail the test if the event is not signaled within that time.

Copilot uses AI. Check for mistakes.
Comment on lines +85 to +86
WorkerPoolDispatcher* _dispatcher;
WPEFramework::Core::WorkerPool* _workerPool;
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_dispatcher and _workerPool are declared without initialization. If SetUp() exits early (e.g., allocation/constructor failure), TearDown() will read indeterminate values in the null checks, which is undefined behavior. Initialize these members to nullptr (or use RAII via std::unique_ptr) so cleanup is always safe.

Suggested change
WorkerPoolDispatcher* _dispatcher;
WPEFramework::Core::WorkerPool* _workerPool;
WorkerPoolDispatcher* _dispatcher{ nullptr };
WPEFramework::Core::WorkerPool* _workerPool{ nullptr };

Copilot uses AI. Check for mistakes.
Comment on lines 417 to 430
TEST_F(AStore2, SetsValueWhenDoesNotReachLimit)
{
ASSERT_THAT(store2->DeleteNamespace(IStore2::ScopeType::DEVICE, kAppId),
Eq(WPEFramework::Core::ERROR_NONE));
ASSERT_THAT(store2->SetNamespaceStorageLimit(
IStoreLimit::ScopeType::DEVICE, kAppId, 5 /*limit*/),
IStoreLimit::ScopeType::DEVICE, kAppId, kMaxValue),
Eq(WPEFramework::Core::ERROR_NONE));
EXPECT_THAT(store2->SetValue(
IStore2::ScopeType::DEVICE, kAppId, kKey, "", kNoTtl),
Eq(WPEFramework::Core::ERROR_NONE));
}

TEST(Store2, SetsValueWhenFileIsNotDatabase)
{
{
WPEFramework::Core::File file(kPathCorrupt);
file.Destroy();
WPEFramework::Core::Directory(file.PathName().c_str()).CreatePath();
ASSERT_THAT(file.Create(), IsTrue());
uint8_t buffer[1024];
ASSERT_THAT(file.Write(buffer, 1024), Eq(1024));
}
auto workerPool = WPEFramework::Core::ProxyType<WorkerPoolImplementation>::Create(
WPEFramework::Core::Thread::DefaultStackSize());
auto store2 = WPEFramework::Core::ProxyType<Store2>::Create(
kPathCorrupt, kMaxSize, kMaxValue, kLimit);
WPEFramework::Core::IWorkerPool::Assign(&(*workerPool));
EXPECT_THAT(store2->SetValue(
IStore2::ScopeType::DEVICE, kAppId, kKey, kValue, kNoTtl),
Eq(WPEFramework::Core::ERROR_NONE));
WPEFramework::Core::IWorkerPool::Assign(nullptr);
}

TEST(Store2, SetsValueWhenFileCorrupt)
{
{
WPEFramework::Core::ProxyType<Store2>::Create(
kPathCorrupt, kMaxSize, kMaxValue, kLimit);
}
{
WPEFramework::Core::File file(kPathCorrupt);
ASSERT_THAT(file.Open(false /*readOnly*/), IsTrue());
ASSERT_THAT(file.Position(false /*relative*/, 8192), IsTrue());
uint8_t buffer[1024];
ASSERT_THAT(file.Write(buffer, 1024), Eq(1024));
}
auto workerPool = WPEFramework::Core::ProxyType<WorkerPoolImplementation>::Create(
WPEFramework::Core::Thread::DefaultStackSize());
auto store2 = WPEFramework::Core::ProxyType<Store2>::Create(
kPathCorrupt, kMaxSize, kMaxValue, kLimit);
WPEFramework::Core::IWorkerPool::Assign(&(*workerPool));
EXPECT_THAT(store2->SetValue(
IStore2::ScopeType::DEVICE, kAppId, kKey, kValue, kNoTtl),
// restore:
EXPECT_THAT(store2->SetNamespaceStorageLimit(
IStoreLimit::ScopeType::DEVICE, kAppId, kLimit),
Eq(WPEFramework::Core::ERROR_NONE));
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests that exercised Store2 recovery from a non-database/corrupted SQLite file were removed in this change. Since Store2 has explicit integrity/backup handling (SQLITE_NOTADB/SQLITE_CORRUPT paths), consider keeping equivalent coverage here to avoid regressions in corruption recovery behavior (or document why this coverage is no longer needed).

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +44
// Create a WorkerPool with multiple threads
_dispatcher = new WorkerPoolDispatcher();
_workerPool = new WPEFramework::Core::WorkerPool(
1, // threadCount
WPEFramework::Core::Thread::DefaultStackSize(),
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says the worker pool is created “with multiple threads”, but threadCount is set to 1, which is misleading for future maintenance/debugging. Update the comment to match the actual configuration (or increase threadCount if multiple threads are intended).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants