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

[CBRD-25765] System Catalog refactoring for consistency #5739

Draft
wants to merge 25 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
721ac8d
Remove duplicated macros in authenticate_constants.h
kangmin5505 Dec 23, 2024
34e209a
Replace literal varchar with format_varchar function.
kangmin5505 Dec 24, 2024
0817647
Rename functions for consistency with system catalog naming conventions.
kangmin5505 Dec 24, 2024
26f21d8
Refactor db_trigger System Catalog
kangmin5505 Dec 26, 2024
6ceab2c
Apply codestyle
kangmin5505 Dec 26, 2024
7107247
Merge remote-tracking branch 'upstream/develop' into CBRD-25765
kangmin5505 Dec 26, 2024
c85ac5c
Change column type for CT_DBCHARSET_CHAR_SIZE from "int" to "integer"
kangmin5505 Dec 26, 2024
673ec6f
Refactor function names for consistency
kangmin5505 Dec 26, 2024
5873b7f
Replace literal 1073741825 with SM_MAX_STRING_LENGTH macro
kangmin5505 Dec 30, 2024
4959c84
Merge remote-tracking branch 'upstream/develop' into CBRD-25765
kangmin5505 Dec 30, 2024
4d9511b
Fix wrong system catalog name(CT_PARTITION_NAME -> CT_DATATYPE_NAME)
kangmin5505 Jan 8, 2025
e4e6885
Merge remote-tracking branch 'upstream/develop' into CBRD-25765
kangmin5505 Jan 8, 2025
797e259
Remove unnecessary newlines from schema_system_catalog_install.cpp
kangmin5505 Jan 8, 2025
01e4b51
Refactor get_dual initializer
kangmin5505 Jan 8, 2025
15a2e54
Refactor struct db_object *class_mop to MOP class_mop for consistency
kangmin5505 Jan 8, 2025
f7b140b
Refactor system catalog header files
kangmin5505 Jan 8, 2025
3a93623
Apply codestyle
kangmin5505 Jan 8, 2025
2ae50e3
Refactor dvalue_func(default value initialization function) in system…
kangmin5505 Jan 8, 2025
f54f4fa
Fix system catalog definitions to correct names
kangmin5505 Jan 11, 2025
9d2cff0
Remove redundant sm_mark_system_classes function call.
kangmin5505 Jan 16, 2025
e547108
Merge remote-tracking branch 'upstream/develop' into CBRD-25765
kangmin5505 Jan 20, 2025
f8b91cf
Revert "Remove redundant sm_mark_system_classes function call."
kangmin5505 Jan 20, 2025
75df6d8
Remove redundant sm_mark_system_classes function call
kangmin5505 Jan 20, 2025
92e5e86
Merge remote-tracking branch 'upstream/develop' into CBRD-25765
kangmin5505 Jan 20, 2025
2f1013e
Apply codestyle
kangmin5505 Jan 20, 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
3 changes: 2 additions & 1 deletion src/executables/util_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include "thread_manager.hpp"
#include "log_volids.hpp"
#include "schema_system_catalog.hpp"
#include "schema_system_catalog_install.hpp"

#if defined (SUPPRESS_STRLEN_WARNING)
#define strlen(s1) ((int) strlen(s1))
Expand Down Expand Up @@ -4313,7 +4314,7 @@ synccoll_force (void)
return status;
}

if (catcls_add_collations (class_mop) != NO_ERROR)
if (catcls_add_collation (class_mop) != NO_ERROR)
{
status = EXIT_FAILURE;
}
Expand Down
12 changes: 0 additions & 12 deletions src/object/authenticate_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@
#include "schema_system_catalog_constants.h"
#include "locator_cl.h" /* locator_create_heap_if_needed () */

/*
* Authorization Class Names
*/
#define AU_ROOT_CLASS_NAME CT_ROOT_NAME
#define AU_OLD_ROOT_CLASS_NAME CT_AUTHORIZATIONS_NAME
#define AU_USER_CLASS_NAME CT_USER_NAME
#define AU_PASSWORD_CLASS_NAME CT_PASSWORD_NAME
#define AU_AUTH_CLASS_NAME CT_AUTHORIZATION_NAME

#define AU_PUBLIC_USER_NAME "PUBLIC"
#define AU_DBA_USER_NAME "DBA"

// static functions
static int au_add_method_check_authorization (void);

Expand Down
6 changes: 3 additions & 3 deletions src/object/authenticate_owner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ au_change_trigger_owner (MOP trigger_mop, MOP owner_mop)
* so if the owner of class, serial, trigger changes, the unique_name must also change.
*/

error = obj_get (trigger_mop, TR_ATT_UNIQUE_NAME, &value);
error = obj_get (trigger_mop, CT_TRIGGER_ATTR_UNIQUE_NAME, &value);
if (error != NO_ERROR)
{
ASSERT_ERROR ();
Expand All @@ -297,7 +297,7 @@ au_change_trigger_owner (MOP trigger_mop, MOP owner_mop)
}

/* Check if the owner to be changed is the same. */
error = obj_get (trigger_mop, TR_ATT_OWNER, &value);
error = obj_get (trigger_mop, CT_TRIGGER_ATTR_OWNER, &value);
if (error != NO_ERROR)
{
ASSERT_ERROR ();
Expand Down Expand Up @@ -354,7 +354,7 @@ au_change_trigger_owner (MOP trigger_mop, MOP owner_mop)

/* owner */
db_make_object (&value, owner_mop);
error = obj_set (trigger_mop, TR_ATT_OWNER, &value);
error = obj_set (trigger_mop, CT_TRIGGER_ATTR_OWNER, &value);
if (error != NO_ERROR)
{
ASSERT_ERROR ();
Expand Down
18 changes: 3 additions & 15 deletions src/object/schema_system_catalog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,8 @@

#include "porting.h"

extern EXPORT_IMPORT void catcls_init (void);
extern EXPORT_IMPORT int catcls_install (void);

extern EXPORT_IMPORT bool sm_check_system_class_by_name (const std::string_view class_name);

extern EXPORT_IMPORT bool sm_is_system_class (const std::string_view name);
extern EXPORT_IMPORT bool sm_is_system_vclass (const std::string_view name);

#if defined (CS_MODE) || defined (SA_MODE)
struct db_object;

extern EXPORT_IMPORT int catcls_add_data_type (struct db_object *class_mop);
extern EXPORT_IMPORT int catcls_add_charsets (struct db_object *class_mop);
extern EXPORT_IMPORT int catcls_add_collations (struct db_object *class_mop);
#endif
EXPORT_IMPORT bool sm_check_system_class_by_name (const std::string_view class_name);
EXPORT_IMPORT bool sm_is_system_class (const std::string_view name);
EXPORT_IMPORT bool sm_is_system_vclass (const std::string_view name);

#endif /* _SCHEMA_SYSTEM_CATALOG_HPP_ */
9 changes: 5 additions & 4 deletions src/object/schema_system_catalog_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ namespace cubschema
if (sm_is_system_class (name))
{
class_mop = db_create_class (name.data ());
if (class_mop != nullptr)
{
sm_mark_system_class (class_mop, 1);
}
}
else if (sm_is_system_vclass (name))
{
Expand All @@ -56,6 +52,11 @@ namespace cubschema
assert (false);
}

if (class_mop != nullptr)
{
sm_mark_system_class (class_mop, 1);
}

return class_mop;
}

Expand Down
21 changes: 21 additions & 0 deletions src/object/schema_system_catalog_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,25 @@
#define CT_DBCHARSET_DEFAULT_COLLATION "default_collation"
#define CT_DBCHARSET_CHAR_SIZE "char_size"

#define CT_DUAL_DUMMY "dummy"

#define CT_TRIGGER_ATTR_UNIQUE_NAME "unique_name"
#define CT_TRIGGER_ATTR_OWNER "owner"
#define CT_TRIGGER_ATTR_NAME "name"
#define CT_TRIGGER_ATTR_STATUS "status"
#define CT_TRIGGER_ATTR_PRIORITY "priority"
#define CT_TRIGGER_ATTR_EVENT "event"
#define CT_TRIGGER_ATTR_CLASS "target_class"
#define CT_TRIGGER_ATTR_ATTRIBUTE "target_attribute"
#define CT_TRIGGER_ATTR_CLASS_ATTRIBUTE "target_class_attribute"
#define CT_TRIGGER_ATTR_CONDITION_TYPE "condition_type"
#define CT_TRIGGER_ATTR_CONDITION "condition"
#define CT_TRIGGER_ATTR_CONDITION_TIME "condition_time"
#define CT_TRIGGER_ATTR_ACTION_TYPE "action_type"
#define CT_TRIGGER_ATTR_ACTION "action_definition"
#define CT_TRIGGER_ATTR_ACTION_TIME "action_time"
#define CT_TRIGGER_ATTR_ACTION_OLD "action"
#define CT_TRIGGER_ATTR_PROPERTIES "properties"
#define CT_TRIGGER_ATTR_COMMENT "comment"

#endif /* _SCHEMA_SYSTEM_CATALOG_CONSTANTS_H_ */
5 changes: 3 additions & 2 deletions src/object/schema_system_catalog_definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
#include <string_view>
#include <vector>
#include <optional>
#include <functional>

#include "work_space.h" // struct db_object
#include "dbtype_def.h"

namespace cubschema
{
Expand Down Expand Up @@ -92,7 +93,7 @@ namespace cubschema
{
using attr_vec_type = std::vector <attribute>;
using cstr_vec_type = std::vector <constraint>;
using row_init_type = std::function<int (struct db_object *)>;
using row_init_type = std::function<int (MOP)>;

const std::string name;
const attr_vec_type attributes;
Expand Down
Loading
Loading