Commit graph

8 commits

Author SHA1 Message Date
Tao Jiang
46fea317de Release shard lease after shutdown (#31)
* Release shard lease after shutdown

Currently, only local cached shard info has been removed when worker losts the
lease. The info inside checkpointer (dynamoDB) is not removed. This causes
lease has been hold until the lease expiration and it might take too long
for shard is ready for other worker to grab. This change release the lease
in checkpointer immediately.

The user need to ensure appropriate checkpointing before return from
Shutdown callback.

Test:
  updated unit test and integration test to ensure only the shard owner
has been wiped out and leave the checkpoint information intact.

Signed-off-by: Tao Jiang <taoj@vmware.com>

* Add code coverage reporting

Add code coverage reporting for unit test.

Signed-off-by: Tao Jiang <taoj@vmware.com>
2021-12-20 21:21:14 -06:00
Tao Jiang
250bb2e9ff Use AWS built-in retry logic and refactor tests (#24)
Update the unit test and move integration test under test folder.
Update retry logic by switching to AWS's default retry.

Signed-off-by: Tao Jiang <taoj@vmware.com>
2021-12-20 21:21:14 -06:00
Tao Jiang
22de13ef8a Go-KCL: Update security scan
gas is now gosec. Need to update security scan and fix
security issue as needed.

No functional change.

Jira CNA-2022

Change-Id: I36f2a204114f3f13e2ed05579c04a9c89f528f9a
2021-12-20 21:16:38 -06:00
Tao Jiang
3120d89ae8 KCL: remove unused item
Change-Id: I164a3e551331464a020e82ad305294e5a659ab6c
2021-12-20 21:15:25 -06:00
Tao Jiang
9d1993547f KCL: Ignore Lint error on const
go languaage doesn't like all-caps on const. Since KCL is mainly from
Amazon's KCL, we'd like the constant to have the exactly same name as
Amazon's KCL. Thefore, skip the lint check.

Change-Id: Ib8a2f52a8f4b44d814eda264f62fdcd53cccc2a7
2021-12-20 21:13:21 -06:00
Tao Jiang
a323d2fd51 KCL: Implement Worker
This is the core part of KCL by implementing worker.
It has exactly the same interface as Amazon's KCL. Internally,
it uses code from GoKini in order to get the library
functionaly quickly.

This is a working version. The test code worker_test.go
shows how to use this library.

Dynamic resharding feature is out of the scope of M4.

Test:

1. A Kinesis stream named "kcl-test" has been created under photon-infra
account.
2. Download your AWS Credential from IAM user page.
3. Modify the worker_test.go to fill in your aws credential.
4. hmake test

Jira CNA-637

Change-Id: I886d255bab9adaf7a13bca11bfda51bedaacaaed
2021-12-20 21:13:20 -06:00
Tao Jiang
1969713863 KCL: Fix unit test
Fix code bug for removing cyclic dependency and fix unit test.

Test:
hmake test

Change-Id: Ib4d4ba416d0133542e6459459ddf43079ff53ab8
2021-12-20 21:13:20 -06:00
Tao Jiang
7b35571d9e CKL: Initial version for starting repository
Change-Id: Ic8dc81a437d9c72e841048359745e245c6c4895b
2021-12-20 21:13:11 -06:00