Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
392 commits
Select commit Hold shift + click to select a range
0db0d85
Merge pull request #62 from shtien/main_cutover
shtiencode Jun 7, 2024
0346245
fix missing len check
shtiencode Jun 7, 2024
4db49bf
Merge pull request #63 from shtien/main_cutover
shtiencode Jun 7, 2024
10f49c7
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jun 12, 2024
be7b60e
revert temp makefile19
shtiencode Jun 17, 2024
20393d9
Merge pull request #65 from shtien/main_cutover
shtiencode Jun 17, 2024
9a9a873
fix oci 19_17 path
shtiencode Jun 17, 2024
e430137
Merge pull request #66 from shtien/main_cutover
shtiencode Jun 17, 2024
2e5945a
fix
shtiencode Jun 20, 2024
40249a3
Merge pull request #67 from shtien/main_cutover
shtiencode Jun 20, 2024
6919136
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jun 20, 2024
b6801ca
fix attachToWorker checking dbuname
shtiencode Jun 20, 2024
b8354a8
Merge pull request #68 from shtien/main_cutover
shtiencode Jun 20, 2024
1e03acd
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jun 21, 2024
929ac98
fix new worker dbuname mismatch validation
shtiencode Jun 24, 2024
08a9147
Merge pull request #69 from shtien/main_cutover
shtiencode Jun 24, 2024
f1aa548
added comments
venkatsridhar95 Jun 25, 2024
817ce03
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jun 25, 2024
71705d8
fix worker count during server init
shtiencode Jun 25, 2024
52e847e
Merge pull request #70 from shtien/main_cutover
shtiencode Jun 25, 2024
926bece
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jun 27, 2024
69aeb2c
add response metadata to requests served from cache
venkatsridhar95 Jun 28, 2024
79adf6b
add cutover logic to bouncer
shtiencode Jun 30, 2024
d53121a
test case fixes
Jul 1, 2024
c56c38a
remove test log and clean up
shtiencode Jul 1, 2024
c148a37
Merge pull request #71 from AppDataServices/main_cutover
shtiencode Jul 1, 2024
4f815dd
added tests for response metadata changes
venkatsridhar95 Jul 1, 2024
b009360
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jul 2, 2024
d82ca53
test case fixes
Jul 3, 2024
dda4281
enable/disable cutover via occ.cdb. more clean up
shtiencode Jul 3, 2024
28b5894
fix
shtiencode Jul 3, 2024
8312a71
more clean up in cutover path
shtiencode Jul 8, 2024
93ddcb3
Merge pull request #75 from shtien/main_cutover
shtiencode Jul 8, 2024
9973730
fix
shtiencode Jul 8, 2024
b4ec39a
Merge pull request #76 from shtien/main_cutover
shtiencode Jul 8, 2024
56c881f
restore cfgFromTns
shtiencode Jul 8, 2024
afcd2f4
fixing test cases
Jul 9, 2024
71943da
Merge pull request #77 from radhikesavan/cutover
shtiencode Jul 9, 2024
a79d729
adding enable_cutover flag to the testcases
Jul 9, 2024
2bcd2f9
Merge pull request #78 from radhikesavan/cutover
shtiencode Jul 9, 2024
6dd46c9
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
shtiencode Jul 9, 2024
26f2892
Merge branch 'main_cutover' of github.paypal.com:shtien/hera into mai…
shtiencode Jul 9, 2024
a45fb4c
Merge pull request #79 from shtien/main_cutover
shtiencode Jul 9, 2024
f6440e9
Merge pull request #80 from AppDataServices/main_cutover
shtiencode Jul 9, 2024
cffc36f
test fixes
venkatsridhar95 Jul 9, 2024
4e208ac
Merge pull request #81 from vesridhar/ttlCache0709
venkatsridhar95 Jul 9, 2024
8475a7e
fixing rest of test cases
Jul 11, 2024
4340e47
fixing role testcase
Jul 11, 2024
451a7da
adjusting timeout for restart of occ in test cases
Jul 12, 2024
c6072b3
Merge pull request #83 from radhikesavan/cutover
shtiencode Jul 12, 2024
62aab29
Merge branch 'main_cutover' of github.paypal.com:AppDataServices/hera…
shtiencode Jul 12, 2024
53532f1
clean up and fix
shtiencode Jul 12, 2024
0bd6b23
fix
shtiencode Jul 12, 2024
415b476
Merge pull request #86 from shtien/main_cutover
shtiencode Jul 12, 2024
46cc53d
Merge pull request #87 from AppDataServices/main_cutover
shtiencode Jul 12, 2024
f987c57
test case fixes
Jul 29, 2024
5009440
fix cutover abort error, remove lock and clean up
shtiencode Jul 30, 2024
b3b51b9
Merge pull request #94 from shtien/master_cutover_int
shtiencode Jul 30, 2024
f8e963e
include ErrCutoverKill in processError
shtiencode Jul 30, 2024
d1f253d
Merge pull request #95 from shtien/master_cutover_int
shtiencode Jul 30, 2024
1d0876c
fixing build dependency
Jul 31, 2024
3316ff4
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Jul 31, 2024
77828c0
fixing test case
Aug 2, 2024
5ca7cd0
fix preprocess error at init
shtiencode Aug 5, 2024
687216d
Merge pull request #99 from shtien/master_cutover_int
shtiencode Aug 5, 2024
459f7eb
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Aug 6, 2024
40ccea0
test cases fixes
Aug 6, 2024
1206a7f
change cutover cfg tbl column name
shtiencode Aug 6, 2024
fccc73c
cutover cfg sql bind case insensitive
shtiencode Aug 7, 2024
3987223
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
Aug 12, 2024
18f4d08
fixing column name in test case
Aug 12, 2024
baf652c
Merge pull request #97 from radhikesavan/cutover
shtiencode Aug 12, 2024
ac51a52
clean up, add user plsql
shtiencode Aug 13, 2024
ab8bf18
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
shtiencode Aug 13, 2024
9a50245
fix crd crd curActDb init
shtiencode Aug 15, 2024
7b73b5e
Merge pull request #101 from shtien/master_cutover_int
shtiencode Aug 15, 2024
732143d
clean up log
shtiencode Aug 15, 2024
d41df39
Merge pull request #102 from shtien/master_cutover_int
shtiencode Aug 15, 2024
ee5d535
clean up and fix role info being overwritten in v
shtiencode Aug 21, 2024
a53496f
Merge pull request #103 from shtien/master_cutover_int
shtiencode Aug 21, 2024
00a59f2
clean up cutover enable
shtiencode Aug 26, 2024
de99a02
revision in progress
shtiencode Aug 28, 2024
18a1111
allow cutovercfg choose db shard
shtiencode Aug 28, 2024
8a1af58
fix
shtiencode Aug 28, 2024
6169895
clean up
shtiencode Aug 28, 2024
f3fbb94
progress
shtiencode Aug 29, 2024
c21af13
save coordinator progress
shtiencode Aug 29, 2024
48c58a3
refactor tests
venkatsridhar95 Aug 29, 2024
20cd951
Merge pull request #104 from vesridhar/ttlCache0829
venkatsridhar95 Aug 29, 2024
3c0b543
save progress
shtiencode Aug 29, 2024
92106f5
Merge branch 'ttl-cache' of github.paypal.com:AppDataServices/hera in…
venkatsridhar95 Sep 5, 2024
02a5c42
refactor and moving tests to new path
venkatsridhar95 Sep 5, 2024
0c6f534
minor fix: do full match instead of prefix match
venkatsridhar95 Sep 5, 2024
b8dee93
Merge pull request #82 from vesridhar/ttl-cache2
venkatsridhar95 Sep 5, 2024
da19790
do parallel sql at init
shtiencode Aug 30, 2024
c1f1d74
Merge pull request #106 from AppDataServices/master_cutover_dev
shtiencode Sep 9, 2024
5130dfc
minor fix, clean up logs
shtiencode Sep 9, 2024
6260041
cal clean up
shtiencode Sep 12, 2024
db5ece3
Merge pull request #107 from AppDataServices/master_cutover_dev
shtiencode Sep 12, 2024
ef431f8
clean and fix checking target for dbuname integrity check
shtiencode Sep 13, 2024
186b65a
atomic value of concrete type instead of pointer
shtiencode Sep 13, 2024
4a861a4
Merge pull request #108 from AppDataServices/master_cutover_dev
shtiencode Sep 13, 2024
77a0f16
Safely ignore multi fetch requests (#109)
venkatsridhar95 Sep 13, 2024
0b7991b
Merge branch 'master' of github.paypal.com:AppDataServices/hera into …
venkatsridhar95 Sep 13, 2024
f573376
Merge pull request #110 from vesridhar/ttl-cache-dev
venkatsridhar95 Sep 13, 2024
70c8571
fix state log
shtiencode Sep 16, 2024
3f43753
Merge pull request #111 from AppDataServices/master_cutover_dev
shtiencode Sep 16, 2024
8a235fc
fix initializing activedb cfg in coordinator
shtiencode Sep 18, 2024
c834674
cal event name fix, enforce target pool db_uname at flexup phase
shtiencode Sep 19, 2024
4c4bdbd
fix r/w split cutover initialization
shtiencode Sep 23, 2024
bd29744
fix cutover preprocess
shtiencode Sep 26, 2024
0d6dbb4
init shard id correctly for internal sql
shtiencode Sep 27, 2024
6e51834
Merge pull request #120 from AppDataServices/master_cutover_dev
shtiencode Sep 27, 2024
37f3dfe
cutover test changes
Sep 30, 2024
23a0c8d
polish cal log during init
shtiencode Sep 30, 2024
68d59c0
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
shtiencode Sep 30, 2024
fa795a8
cutover test changes
Oct 1, 2024
ec24052
cutover test changes
Oct 3, 2024
72ede7b
cutover test changes
Oct 4, 2024
28f529d
cutover test changes
Oct 5, 2024
62f0e9f
Merge pull request #122 from radhikesavan/cutover
shtiencode Oct 7, 2024
486d305
fix logging
shtiencode Oct 17, 2024
bbcbd48
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
shtiencode Oct 17, 2024
05a0662
disable bind throttle during cutover
shtiencode Oct 21, 2024
c24b60b
changing tests for TWO_TASK_CUTOVER to CLOC_STG1 for QA
Oct 22, 2024
0e78331
clean up log
shtiencode Oct 23, 2024
2a26f54
clean up
shtiencode Oct 23, 2024
8fe0309
revise throttle disable
shtiencode Oct 23, 2024
b237dad
be sure no throttle when heavy usage
shtiencode Oct 23, 2024
a77b338
Merge pull request #123 from radhikesavan/cutover
shtiencode Oct 24, 2024
a0b9a4d
Merge remote-tracking branch 'mirror_central_origin/master' into sync…
rasamala83 Oct 25, 2024
99466b2
Merge pull request #124 from rasamala/sync_ttl_cache_with_main
venkatsridhar95 Oct 25, 2024
721c8d3
changing tests for TWO_TASK_CUTOVER to CLOC_STG1 for QA
Oct 22, 2024
6d1530a
optimize set role plsql
shtiencode Nov 5, 2024
924293c
Merge branch 'master_cutover_int' of github.paypal.com:AppDataService…
shtiencode Nov 5, 2024
e053de5
change log
shtiencode Nov 8, 2024
b87a340
revise role setting
shtiencode Nov 12, 2024
f746765
revise plsql
shtiencode Nov 13, 2024
00ab784
minor revise and clean up
shtiencode Dec 17, 2024
9a59267
minor revision and clean up
shtiencode Dec 18, 2024
caaa66b
role setting notification for init-in-progress worker
shtiencode Dec 18, 2024
1b12f06
fix typo
shtiencode Dec 18, 2024
8fabafc
add role check condition in WorkerReady
shtiencode Dec 30, 2024
9d8cbdd
minor fix
shtiencode Jan 2, 2025
b821916
adding sleep after role change before next phase update
Jan 6, 2025
0a19572
adding sleep after role change before next phase update
Jan 8, 2025
6399f72
adding sleep after role change before next phase update
Jan 8, 2025
e8a0e09
adding sleep after role change before next phase update
Jan 10, 2025
8739920
first version of changes to avoid accidental worker state update duri…
rasamala83 Dec 16, 2024
363564d
remove unwanted log message
rasamala83 Dec 17, 2024
24e2039
instead of flow based control added valid transition map to control s…
rasamala83 Dec 18, 2024
cd92e68
update test code based on state transition map
rasamala83 Dec 18, 2024
eeb2943
added missing transtion from finish state to scheduled state
rasamala83 Dec 18, 2024
957b0de
remove restart worker logic as it will taken care worker monitor
rasamala83 Dec 18, 2024
8db5c70
move process reaping login go from C
rasamala83 Dec 19, 2024
02c1500
fixing race condition related to worker recovery issue
rasamala83 Jan 17, 2025
c00b147
removed unwanted changes related to induced delays during execution
rasamala83 Jan 20, 2025
44bebff
fixin functional test comparision
rasamala83 Jan 31, 2025
ddc8bd4
Revert "first version of changes to avoid accidental worker state upd…
rasamala83 Feb 4, 2025
3e7926c
Non graceful worker recovery issues and workflow issue (#411)
rasamala83 Feb 5, 2025
5d21c58
merge master_cutover_int to release branch
shtiencode Mar 10, 2025
955e066
fix merge compile issue
shtiencode Mar 10, 2025
600c960
add request to CAL during multi requests
venkatsridhar95 Mar 12, 2025
0d0a6d5
changes for adding statement cache support and sql_id generation
rasamala83 Mar 12, 2025
d905679
fix merge issue
shtiencode Mar 12, 2025
822a711
changes for disable oci statement cache if both caches are enabled
rasamala83 Mar 13, 2025
2d79a06
move cacheByCorrId to sql level
venkatsridhar95 Mar 13, 2025
7713a06
changes for fixing sql id generation logic same as db sql ID
rasamala83 Mar 14, 2025
38c5927
Merge remote-tracking branches 'origin' and 'origin/oci_prepare2_upgr…
rasamala83 Mar 14, 2025
d91cefd
removing fetch_sql_id calls from places where there is no logging
rasamala83 Mar 14, 2025
c5f8f51
revise some cutover app logs
shtiencode Mar 18, 2025
8dafe25
scuttle rewrite validator
shtiencode Mar 21, 2025
db2ad04
Merge pull request #135 from shtien/release
shtiencode Mar 21, 2025
ee91318
revise worker counting (otel)
shtiencode Mar 21, 2025
21448f3
clean up old cutover code in statelog
shtiencode Mar 24, 2025
4f80b7c
Merge branch 'release' of github.paypal.com:AppDataServices/hera into…
shtiencode Mar 24, 2025
26260cc
clean up
shtiencode Mar 24, 2025
1909223
Merge pull request #128 from radhikesavan/cutover
shtiencode Mar 24, 2025
5db99c5
Merge pull request #136 from AppDataServices/master_cutover_int
shtiencode Mar 24, 2025
4f9ce61
added config to cache by client app
venkatsridhar95 Mar 25, 2025
1ef8769
clean up log and comments
shtiencode Mar 25, 2025
3437737
minor change
shtiencode Mar 25, 2025
50bd5b7
added tests for cacheByCorrID to sql level and cache by client app, u…
venkatsridhar95 Mar 27, 2025
7b2aa82
Merge branch 'master' of github.paypal.com:AppDataServices/hera into …
venkatsridhar95 Mar 27, 2025
b0be41a
Merge pull request #138 from vesridhar/master-ttl-cache-merge
venkatsridhar95 Mar 27, 2025
b534054
change for OCIStmtRelease with OCI_STRLS_CACHE_DELETE closes the curs…
rasamala83 Apr 1, 2025
202609e
updated use_nonblocking feature key
ishi-0987 Apr 2, 2025
60c323d
releasing statement to avoid open curson issue
rasamala83 Apr 2, 2025
83c752f
releasing currect statement handler during fetch
rasamala83 Apr 3, 2025
2012d5e
added juno client as a module
venkatsridhar95 Apr 6, 2025
674a62b
Merge pull request #144 from vesridhar/master-ttl-cache-merge
venkatsridhar95 Apr 6, 2025
ca5ffb3
fixing the issue statement handler release
rasamala83 Apr 7, 2025
9c1fc37
scuttle rewrite validator
shtiencode Mar 21, 2025
acb3517
Merge pull request #146 from AppDataServices/scuttle_id_validator_cha…
venkatsridhar95 Apr 7, 2025
bfbf598
Merge pull request #141 from ivyas/occ_configs
venkatsridhar95 Apr 7, 2025
8acbe02
updating patch with ttl-cache-dev branch
rasamala83 Apr 10, 2025
24f0b47
fixing indentation issue in previous commit
rasamala83 Apr 10, 2025
f4f8913
Merge pull request #148 from rasamala/sync_go_mod_with_gomod_patch
venkatsridhar95 Apr 10, 2025
1b775c4
added changes for client-controlled caching
venkatsridhar95 Apr 18, 2025
995b92c
Merge pull request #150 from vesridhar/ttl-cache-dev-rucs
venkatsridhar95 Apr 18, 2025
9749617
temporarily disable writes from worker to mux when the command is inv…
venkatsridhar95 Apr 18, 2025
a0ec21b
Merge pull request #151 from vesridhar/ttl-cache-dev-rucs
venkatsridhar95 Apr 18, 2025
256d33e
forward poolname and sql hash to DB
Apr 23, 2025
48ffe75
test for passing sql hash & poolname to DB
Apr 23, 2025
030894e
changes for adding debug logs which causes assertion check failures
rasamala83 Apr 24, 2025
b244349
Merge pull request #153 from rasamala/regresssion_tests_log_fix
rasamala83 Apr 24, 2025
cd05794
do not send cache related commands to worker
venkatsridhar95 Apr 28, 2025
8bca5af
undo invalid command write
venkatsridhar95 Apr 28, 2025
b17f20c
Merge pull request #154 from vesridhar/ttl-cache-dev-rucs
venkatsridhar95 Apr 28, 2025
b94fff2
gosqldriver enhancements to send cache metadata
venkatsridhar95 Apr 28, 2025
932d674
Merge pull request #155 from vesridhar/ttl-cache-dev-rucs
venkatsridhar95 Apr 28, 2025
070bfb5
added tests for client-controlled caching
venkatsridhar95 Apr 29, 2025
7ee3d39
added logging in go worker for unknown command
venkatsridhar95 Apr 29, 2025
168ec87
Merge pull request #156 from vesridhar/ttl-cache-dev-rucs
venkatsridhar95 Apr 29, 2025
fff41d9
Merge pull request #152 from anagopal/db_inst
rasamala83 Apr 30, 2025
fef1c4b
Added checks in PreprocessCaching to skip bad requests
venkatsridhar95 May 2, 2025
d9ab954
Merge pull request #158 from vesridhar/ttl-cache-dev-rucs
venkatsridhar95 May 2, 2025
843dc3d
Merge pull request #157 from AppDataServices/ttl-cache-dev-RUCS
venkatsridhar95 May 2, 2025
37409dc
Merge branch 'release' of github.paypal.com:AppDataServices/hera into…
venkatsridhar95 May 2, 2025
4baa0cc
Merge pull request #159 from vesridhar/ttl-cache-dev-0502
venkatsridhar95 May 2, 2025
119b8bb
Merge branch 'release' of github.paypal.com:AppDataServices/hera into…
shtiencode May 2, 2025
0ccd97f
remove some redundant logging check
shtiencode May 2, 2025
feb8b8c
clean more redundant checks
shtiencode May 2, 2025
9c42970
Merge remote-tracking branch 'mirror_central_origin/master' into oci_…
rasamala83 May 3, 2025
2b3dfd6
Merge remote-tracking branch 'mirror_central_origin/release' into oci…
rasamala83 May 3, 2025
033706f
changes for adding tests for statement cache
rasamala83 May 7, 2025
5c8d2e7
Merge remote-tracking branch 'mirror_origin/oci_prepare2_upgrade_chan…
rasamala83 May 7, 2025
634759b
Merge pull request #160 from AppDataServices/regression_tests_asserti…
venkatsridhar95 May 7, 2025
7b2bdbe
reset state after dispatch
venkatsridhar95 May 7, 2025
7270c0c
go mod changes
venkatsridhar95 May 7, 2025
ce1873a
Merge pull request #161 from vesridhar/ttl-cache-dev-0502
venkatsridhar95 May 7, 2025
d5775f3
changes for statement cache
rasamala83 May 7, 2025
8877a00
Merge pull request #139 from AppDataServices/ttl-cache-dev
venkatsridhar95 May 7, 2025
13e06b4
Merge branch 'release' of github.paypal.com:AppDataServices/hera into…
shtiencode May 7, 2025
ab70109
fix go.mod
venkatsridhar95 May 8, 2025
7a99d47
Merge pull request #164 from vesridhar/release0508
venkatsridhar95 May 8, 2025
becd6be
Merge branch 'release' of github.paypal.com:AppDataServices/hera into…
shtiencode May 8, 2025
084ac3a
fix merge error
shtiencode May 8, 2025
01852cf
Merge pull request #134 from AppDataServices/release_cutover_merge
shtiencode May 8, 2025
4137c4d
Merge pull request #165 from vesridhar/release0508
venkatsridhar95 May 9, 2025
0be4827
updating caching table name with pypl_occ_caching
rasamala83 May 9, 2025
70a6497
Merge pull request #166 from rasamala/update_management_table_prefix_…
venkatsridhar95 May 9, 2025
cbf1426
updating caching table name with pypl_occ_caching
rasamala83 May 12, 2025
16e42c6
Merge pull request #168 from rasamala/update_management_table_prefix_…
venkatsridhar95 May 12, 2025
c84a47f
utility scripts to start juno as part of tests
venkatsridhar95 May 13, 2025
b27ebfe
Merge branch 'release' of github.paypal.com:AppDataServices/hera into…
venkatsridhar95 May 13, 2025
8ab2bfa
Merge pull request #170 from vesridhar/release0513
venkatsridhar95 May 14, 2025
779ad7a
add rapid cutover in the feature logging
shtiencode May 14, 2025
c5d5f58
Merge pull request #171 from shtien/release
shtiencode May 14, 2025
692e08d
sync code release branch cutover and caching
rasamala83 May 15, 2025
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
2 changes: 1 addition & 1 deletion cal/calconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (c *calConfig) initialize(cfg config.Config, vcfg config.Config, _labelAffi
c.msgBufferSize = cfg.GetOrDefaultInt("cal_message_buffer_size", 300)
c.handlerType = cfg.GetOrDefaultString("cal_handler", "socket")
c.logFileName = cfg.GetOrDefaultString("cal_log_file", "logCalClient.txt")
c.enableTG = (cfg.GetOrDefaultString("cal_enable_threadgroup", "false") == "true")
c.enableTG = (cfg.GetOrDefaultString("cal_enable_threadgroup", "true") == "true")
c.poolstackEnabled = (cfg.GetOrDefaultString("cal_pool_stack_enable", "true") == "true")
c.poolStackSize = cfg.GetOrDefaultInt("cal_max_pool_stack_size", 2048)
if c.poolStackSize > 2048 {
Expand Down
6 changes: 6 additions & 0 deletions cal/calinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ type Transaction interface {
SetOperationName(string, bool)
}

// AtomicTransaction declares the functions for generating CAL transactions
type AtomicTransaction interface {
Activity
SetDuration(float32)
}

// HeartBeat declares the functions for generating CAL heartbeat
type HeartBeat interface {
Activity
Expand Down
95 changes: 91 additions & 4 deletions cal/calmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ type calTransaction struct {
mTimer CalTimer
}

type calAtomicTransaction struct {
calActivity
mDuration float32
mTimer CalTimer
}

// NewCalEvent creates a CAL event
func NewCalEvent(_type string, _name string, _status string, _data string, _tgname ...string) Event {
et := new(calEvent)
Expand Down Expand Up @@ -200,6 +206,13 @@ func NewCalTransaction(_type string, _name string, _status string, _data string,
return ct
}

// NewCalAtomicTransaction creates a CAL atomic transaction
func NewCalAtomicTransaction(_type string, _name string, _status string, _data string, _tgname string) AtomicTransaction {
ct := new(calAtomicTransaction)
ct.init(_type, _name, _status, _data, _tgname)
return ct
}

// ReleaseCxtResource releases the internal context
func ReleaseCxtResource(_tgname ...string) {
var client = GetCalClientInstance()
Expand Down Expand Up @@ -723,6 +736,80 @@ func (act *calHeartBeat) init(_type string, _name string, _status string, _data
}
}

/********************************************************
********************************************************
* calAtomicTransaction
********************************************************
*/
func (act *calAtomicTransaction) init(_type string, _name string, _status string, _data string, _tgname string) {
if !act.isCalClientEnabled() {
return
}
act.mClass = calClassAtomicTransaction
act.initialize(_type, _name, _status, _data, _tgname)

act.mTimer.Reset()
act.mDuration = -1

}

func (act *calAtomicTransaction) SetDuration(_duration float32) {
if !act.isCalClientEnabled() {
return
}
if _duration < minDuration {
act.mDuration = minDuration
} else if _duration > maxDuration {
act.mDuration = maxDuration
} else {
act.mDuration = _duration
}
}

func (act *calAtomicTransaction) Completed() {
if act.mCompleted {
return
}
if !act.isCalClientEnabled() {
return
}

act.sendSelf()
act.mCompleted = true
}

func (act *calAtomicTransaction) sendSelf() {
var duration_str string
// to safeguard 64 to 32 bit int conversion
value := act.mTimer.Duration()
var duration float32
if int32(value) > maxDuration { // Check on comparision between float and int
duration = maxDuration
} else {
duration = value
}
if act.mDuration >= minDuration{
duration = act.mDuration
}
duration_str = fmt.Sprintf("%.2f", duration)
var buf bytes.Buffer
buf.WriteString(act.mClass)
buf.WriteString(act.mTimeStamp)
buf.WriteString(calTab)
buf.WriteString(act.mType)
buf.WriteString(calTab)
buf.WriteString(act.mName)
buf.WriteString(calTab)
buf.WriteString(act.mStatus)
buf.WriteString(calTab)
buf.WriteString(duration_str)
buf.WriteString(calTab)
buf.WriteString(act.mData)
buf.WriteString(calEndOfLine)
var str = buf.String()
act.writeData(str)
}

/********************************************************
********************************************************
* calTransaction
Expand Down Expand Up @@ -1053,10 +1140,10 @@ func (act *calTransaction) completeAnyNestedTransactions() {
*/
func (act *calTransaction) addAdditionalFieldsForRoot() {
var buf bytes.Buffer
buf.WriteString("corr_id_")
buf.WriteString(calEquals)
buf.WriteString(act.GetCorrelationID())
buf.WriteString(calAmpersand)
// buf.WriteString("corr_id_")
// buf.WriteString(calEquals)
// buf.WriteString(act.GetCorrelationID())
// buf.WriteString(calAmpersand)
buf.WriteString("log_id_")
buf.WriteString(calEquals)
//buf.WriteString(client.GetLogId())
Expand Down
4 changes: 2 additions & 2 deletions cal/caltimer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func (ct *CalTimer) Reset(){
ct.tBegin = time.Now()
}

// return time elapsed since last Reset call in 10th of micro seconds
// return time elapsed since last Reset call in milliseconds
func (ct *CalTimer) Duration() float32{
var timediff time.Duration
timediff = time.Since(ct.tBegin)
return float32(timediff.Nanoseconds()) / float32(time.Millisecond * 10)
return float32(timediff.Nanoseconds()) / float32(time.Millisecond)
}
75 changes: 70 additions & 5 deletions client/gosqldriver/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
"database/sql/driver"
"errors"
"fmt"
"net"
"os"

"github.com/paypal/hera/common"
"github.com/paypal/hera/utility/encoding/netstring"
"github.com/paypal/hera/utility/logger"
"net"
"os"
)

var corrIDUnsetCmd = netstring.NewNetstringFrom(common.CmdClientCalCorrelationID, []byte("CorrId=NotSet"))
Expand All @@ -38,6 +37,10 @@ type heraConnection struct {
reader *netstring.Reader
// for the sharding extension
shardKeyPayload []byte
//caching extension
cacheKey []byte
cacheTTL []byte
cacheOperation []byte
// correlation id
corrID *netstring.Netstring
clientinfo *netstring.Netstring
Expand All @@ -52,7 +55,6 @@ func NewHeraConnection(conn net.Conn) driver.Conn {
return hera
}


// Prepare returns a prepared statement, bound to this connection.
func (c *heraConnection) Prepare(query string) (driver.Stmt, error) {
if logger.GetLogger().V(logger.Debug) {
Expand Down Expand Up @@ -100,6 +102,7 @@ func (c *heraConnection) execNs(ns *netstring.Netstring) error {
logger.GetLogger().Log(logger.Verbose, c.id, "send command:", ns.Cmd, ", payload:", payload)
}
_, err := c.conn.Write(ns.Serialized)
logger.GetLogger().Log(logger.Verbose, c.id, "after write")
return err
}

Expand Down Expand Up @@ -171,6 +174,36 @@ func (c *heraConnection) ResetShardKeyPayload() {
c.SetShardKeyPayload("")
}

// implementing the extension HeraConn interface
func (c *heraConnection) SetCacheKey(payload string) {
c.cacheKey = []byte(payload)
}

// implementing the extension HeraConn interface
func (c *heraConnection) ResetCacheKey() {
c.SetCacheKey("")
}

// implementing the extension HeraConn interface
func (c *heraConnection) SetCacheTTL(payload string) {
c.cacheTTL = []byte(payload)
}

// implementing the extension HeraConn interface
func (c *heraConnection) ResetCacheTTL() {
c.SetCacheTTL("")
}

// implementing the extension HeraConn interface
func (c *heraConnection) SetCacheOperation(payload string) {
c.cacheOperation = []byte(payload)
}

// implementing the extension HeraConn interface
func (c *heraConnection) ResetCacheOperation() {
c.SetCacheOperation("")
}

// implementing the extension HeraConn interface
func (c *heraConnection) SetCalCorrID(corrID string) {
c.corrID = netstring.NewNetstringFrom(common.CmdClientCalCorrelationID, []byte(fmt.Sprintf("CorrId=%s", corrID)))
Expand Down Expand Up @@ -239,4 +272,36 @@ func (c *heraConnection) SetClientInfoWithPoolStack(poolName string, host string
logger.GetLogger().Log(logger.Debug, "Server info:", string(ns.Payload))
}
return nil
}
}

func (c *heraConnection) SetClientInfoWithPayload(poolName string, host string, payload string)(error){
if len(poolName) <= 0 && len(host) <= 0 && len(payload) <= 0 {
return nil
}

pid := os.Getpid()
data := fmt.Sprintf("PID: %d, HOST: %s, Poolname: %s, %s, Command: SetClientInfo,", pid, host, poolName, payload)
c.clientinfo = netstring.NewNetstringFrom(common.CmdClientInfo, []byte(string(data)))
if logger.GetLogger().V(logger.Verbose) {
logger.GetLogger().Log(logger.Verbose, "SetClientInfo", c.clientinfo.Serialized)
}

_, err := c.conn.Write(c.clientinfo.Serialized)
if err != nil {
if logger.GetLogger().V(logger.Warning) {
logger.GetLogger().Log(logger.Warning, "Failed to send client info")
}
return errors.New("Failed custom auth, failed to send client info")
}
ns, err := c.reader.ReadNext()
if err != nil {
if logger.GetLogger().V(logger.Warning) {
logger.GetLogger().Log(logger.Warning, "Failed to read server info")
}
return errors.New("Failed to read server info")
}
if logger.GetLogger().V(logger.Debug) {
logger.GetLogger().Log(logger.Debug, "Server info:", string(ns.Payload))
}
return nil
}
20 changes: 20 additions & 0 deletions client/gosqldriver/ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ type HeraConn interface {
SetClientInfo(poolname string, host string) error

SetClientInfoWithPoolStack(poolName string, host string, poolStack string) error

SetClientInfoWithPayload(poolName string, host string, payload string) error

// Used to pass the cache key as part of the request.
SetCacheKey(payload string)

// Reset the set set via SetCacheKey
ResetCacheKey()

// Used to set the cache TTL as part of the request.
SetCacheTTL(payload string)

// Reset the set set via SetCacheTTL
ResetCacheTTL()

// Used to set the cache operation. (For ex: GET) as part of the request.
SetCacheOperation(payload string)

// Reset the set set via SetCacheOperation
ResetCacheOperation()
}

// HeraStmt is an API extension for *sql.Stmt
Expand Down
Loading
Loading