Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added sqlName for maint queries #405

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 lib/querybindblocker.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func loadBlockQueryBind(db *sql.DB) {
}

defer conn.Close()
q := fmt.Sprintf("SELECT /*queryBindBlocker*/ %ssqlhash, %ssqltext, bindvarname, bindvarvalue, blockperc, %smodule FROM %s_rate_limiter where %smodule='%s'", GetConfig().StateLogPrefix, GetConfig().StateLogPrefix, GetConfig().StateLogPrefix, GetConfig().ManagementTablePrefix, GetConfig().StateLogPrefix, g_module)
q := fmt.Sprintf("SELECT /*heraMgmt.QueryBindBlocker*/ %ssqlhash, %ssqltext, bindvarname, bindvarvalue, blockperc, %smodule FROM %s_rate_limiter where %smodule='%s'", GetConfig().StateLogPrefix, GetConfig().StateLogPrefix, GetConfig().StateLogPrefix, GetConfig().ManagementTablePrefix, GetConfig().StateLogPrefix, g_module)
logger.GetLogger().Log(logger.Info, "Loading query bind blocker meta-sql "+q)
stmt, err := conn.PrepareContext(ctx, q)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion lib/racmaint.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func racMaintMain(shard int, interval int, cmdLineModuleName string) {
tempKey.module = ""
prev[tempKey] = racRow
}
racSQL := fmt.Sprintf("/*shard=%d*/ SELECT inst_id, UPPER(status), status_time, UPPER(module) "+
racSQL := fmt.Sprintf("/*heraMgmt.racMaintShard=%d*/ SELECT inst_id, UPPER(status), status_time, UPPER(module) "+
"FROM %s_maint "+
"WHERE UPPER(machine) = ? and "+
"UPPER(module) in ( ?, ? ) "+ //IN ( UPPER(sys_context('USERENV', 'MODULE')), UPPER(sys_context('USERENV', 'MODULE') || '_TAF' ) ) "+
Expand Down
6 changes: 3 additions & 3 deletions lib/shardingcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func GetWLCfg() *WLCfg {
func getSQL() string {
// TODO: add hostname in the comment
if len(GetConfig().ShardingPostfix) != 0 {
return fmt.Sprintf("SELECT scuttle_id, shard_id, read_status, write_status from %s_shard_map_%s where status = 'Y'", GetConfig().ManagementTablePrefix, GetConfig().ShardingPostfix)
return fmt.Sprintf("SELECT /*heraMgmt.Sharding*/ scuttle_id, shard_id, read_status, write_status from %s_shard_map_%s where status = 'Y'", GetConfig().ManagementTablePrefix, GetConfig().ShardingPostfix)
}
//TODO: is this still needed?
slowf := fmt.Sprintf("slow.%d", os.Getpid())
Expand All @@ -86,15 +86,15 @@ func getSQL() string {
n, err := f.Read(buf[:63])
if err == nil {
buf[n] = 0
sql := fmt.Sprintf("SELECT scuttle_id + usleep(%s) - %s, shard_id, read_status, write_status from %s_shard_map where status = 'Y'", string(buf), string(buf), GetConfig().ManagementTablePrefix)
sql := fmt.Sprintf("SELECT /*heraMgmt.Sharding*/ scuttle_id + usleep(%s) - %s, shard_id, read_status, write_status from %s_shard_map where status = 'Y'", string(buf), string(buf), GetConfig().ManagementTablePrefix)
if logger.GetLogger().V(logger.Warning) {
logger.GetLogger().Log(logger.Warning, "slow shard map query ", sql)
}
return sql
}
}
// if we get here, it means it can't get the slow query
return fmt.Sprintf("SELECT scuttle_id, shard_id, read_status, write_status from %s_shard_map where status = 'Y'", GetConfig().ManagementTablePrefix)
return fmt.Sprintf("SELECT /*heraMgmt.Sharding*/ scuttle_id, shard_id, read_status, write_status from %s_shard_map where status = 'Y'", GetConfig().ManagementTablePrefix)
}

/*
Expand Down
Loading