Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into CBRD-25765
Browse files Browse the repository at this point in the history
  • Loading branch information
kangmin5505 committed Jan 20, 2025
2 parents 75df6d8 + b9e4432 commit 92e5e86
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,9 @@ private String checkArgsAndConvertToTypicalValuesStr(List<Expr> args, String fun
if (arg instanceof ExprStr) {
sb.append(", ");
sb.append("'" + ((ExprStr) arg).val + "'");
} else if (arg instanceof ExprNull) {
sb.append(", ");
sb.append("null");
} else {
throw new SemanticError(
Misc.getLineColumnOf(arg.ctx), // s241
Expand Down
18 changes: 12 additions & 6 deletions src/communication/network_interface_sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ stran_server_commit_internal (THREAD_ENTRY * thread_p, unsigned int rid, bool re

state = xtran_server_commit (thread_p, retain_lock);

PL_SESSION *session = cubpl::get_session ();
if (!session || session->is_running () == false)
if (session_has_pl_session (thread_p))
{
net_cleanup_server_queues (rid);
PL_SESSION *session = cubpl::get_session ();
if (!session || session->is_running () == false)
{
net_cleanup_server_queues (rid);
}
}

if (state != TRAN_UNACTIVE_COMMITTED && state != TRAN_UNACTIVE_COMMITTED_INFORMING_PARTICIPANTS)
Expand Down Expand Up @@ -201,10 +204,13 @@ stran_server_abort_internal (THREAD_ENTRY * thread_p, unsigned int rid, bool * s

state = xtran_server_abort (thread_p);

PL_SESSION *session = cubpl::get_session ();
if (!session || session->is_running () == false)
if (session_has_pl_session (thread_p))
{
net_cleanup_server_queues (rid);
PL_SESSION *session = cubpl::get_session ();
if (!session || session->is_running () == false)
{
net_cleanup_server_queues (rid);
}
}

if (state != TRAN_UNACTIVE_ABORTED && state != TRAN_UNACTIVE_ABORTED_INFORMING_PARTICIPANTS)
Expand Down
38 changes: 19 additions & 19 deletions src/parser/parser_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -10313,6 +10313,16 @@ parse_default_expr_type (const char *str, const int str_size, int *next_len)
switch (str[0])
{
case 'S':
if (str_size >= 13 && strncmp (str, "SYS_TIMESTAMP", 13) == 0)
{
*next_len = 13;
return DB_DEFAULT_SYSTIMESTAMP;
}
if (str_size >= 12 && strncmp (str, "SYS_DATETIME", 12) == 0)
{
*next_len = 12;
return DB_DEFAULT_SYSDATETIME;
}
if (str_size >= 8)
{
if (strncmp (str, "SYS_DATE", 8) == 0)
Expand All @@ -10326,19 +10336,19 @@ parse_default_expr_type (const char *str, const int str_size, int *next_len)
return DB_DEFAULT_SYSTIME;
}
}
if (str_size >= 12 && strncmp (str, "SYS_DATETIME", 12) == 0)
break;

case 'C':
if (str_size >= 17 && strncmp (str, "CURRENT_TIMESTAMP", 17) == 0)
{
*next_len = 12;
return DB_DEFAULT_SYSDATETIME;
*next_len = 17;
return DB_DEFAULT_CURRENTTIMESTAMP;
}
if (str_size >= 13 && strncmp (str, "SYS_TIMESTAMP", 13) == 0)
if (str_size >= 16 && strncmp (str, "CURRENT_DATETIME", 16) == 0)
{
*next_len = 13;
return DB_DEFAULT_SYSTIMESTAMP;
*next_len = 16;
return DB_DEFAULT_CURRENTDATETIME;
}
break;

case 'C':
if (str_size >= 12)
{
if (strncmp (str, "CURRENT_DATE", 12) == 0)
Expand All @@ -10357,16 +10367,6 @@ parse_default_expr_type (const char *str, const int str_size, int *next_len)
return DB_DEFAULT_CURR_USER;
}
}
if (str_size >= 16 && strncmp (str, "CURRENT_DATETIME", 16) == 0)
{
*next_len = 16;
return DB_DEFAULT_CURRENTDATETIME;
}
if (str_size >= 17 && strncmp (str, "CURRENT_TIMESTAMP", 17) == 0)
{
*next_len = 17;
return DB_DEFAULT_CURRENTTIMESTAMP;
}
break;

case 'U':
Expand Down
14 changes: 14 additions & 0 deletions src/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,20 @@ session_get_load_session (THREAD_ENTRY * thread_p, REFPTR (load_session, load_se
return NO_ERROR;
}

bool
session_has_pl_session (THREAD_ENTRY * thread_p)
{
SESSION_STATE *state_p = NULL;

state_p = session_get_session_state (thread_p);
if (state_p == NULL)
{
return false;
}

return state_p->pl_session_p != NULL;
}

int
session_get_pl_session (THREAD_ENTRY * thread_p, REFPTR (PL_SESSION, pl_session_ref_ptr))
{
Expand Down
1 change: 1 addition & 0 deletions src/session/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ extern int session_set_load_session (THREAD_ENTRY * thread_p, load_session * loa
extern int session_get_load_session (THREAD_ENTRY * thread_p, REFPTR (load_session, load_session_ref_ptr));

extern int session_get_pl_session (THREAD_ENTRY * thread_p, REFPTR (PL_SESSION, pl_session_ref_ptr));
extern bool session_has_pl_session (THREAD_ENTRY * thread_p);
#if defined (SERVER_MODE)
extern void session_notify_pl_task_completion (const struct session_state *session_arg);
#endif
Expand Down
23 changes: 15 additions & 8 deletions src/transaction/log_tran_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#include "thread_manager.hpp"
#include "xasl.h"
#include "xasl_cache.h"
#include "session.h"
#include "pl_session.hpp"

// XXX: SHOULD BE THE LAST INCLUDE HEADER
Expand Down Expand Up @@ -2766,10 +2767,13 @@ logtb_set_tran_index_interrupt (THREAD_ENTRY * thread_p, int tran_index, bool se
// Only TT_WORKER threads use pl_session
if (thread_p && thread_p->type == TT_WORKER)
{
cubpl::session * session = cubpl::get_session ();
if (session)
if (session_has_pl_session (thread_p))
{
session->set_interrupt (ER_INTERRUPTED);
cubpl::session * session = cubpl::get_session ();
if (session)
{
session->set_interrupt (ER_INTERRUPTED);
}
}
}
}
Expand Down Expand Up @@ -2845,10 +2849,13 @@ logtb_is_interrupted_tdes (THREAD_ENTRY * thread_p, LOG_TDES * tdes, bool clear,
#endif
}

cubpl::session * session = cubpl::get_session ();
if (session)
if (session_has_pl_session (thread_p))
{
session->set_interrupt (ER_INTERRUPTED);
cubpl::session * session = cubpl::get_session ();
if (session)
{
session->set_interrupt (ER_INTERRUPTED);
}
}
}
else if (interrupt == false && tdes->query_timeout > 0)
Expand Down Expand Up @@ -6088,7 +6095,7 @@ log_tdes::lock_topop ()
// TODO [PL/CSQL]: It will be fixed at CBRD-25641.
// The following code inside of #if block is a workaround for the issue.
#if 1
if (rmutex_topop.owner != thread_id_t ())
if (rmutex_topop.owner != thread_id_t () && session_has_pl_session (thread_p))
{
cubpl::session *session = cubpl::get_session();
if (session
Expand All @@ -6112,7 +6119,7 @@ log_tdes::unlock_topop ()
// TODO [PL/CSQL]: It will be fixed at CBRD-25641.
// The following code inside of #if block is a workaround for the issue.
#if 1
if (rmutex_topop.owner != thread_id_t ())
if (rmutex_topop.owner != thread_id_t () && session_has_pl_session (thread_p))
{
cubpl::session *session = cubpl::get_session();
if (session
Expand Down

0 comments on commit 92e5e86

Please sign in to comment.