You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***The target audience** of this guide is OceanBase SeekDB contributors, both new and experienced.
6
-
***The objective** of this guide is to help contributors become an expert of OceanBase SeekDB, who is familiar with its design and implementation and thus is able to use it fluently in the real world as well as develop OceanBase SeekDB itself deeply.
5
+
***The target audience** of this guide is OceanBase seekdb contributors, both new and experienced.
6
+
***The objective** of this guide is to help contributors become an expert of OceanBase seekdb, who is familiar with its design and implementation and thus is able to use it fluently in the real world as well as develop OceanBase seekdb itself deeply.
7
7
8
8
## The structure of this guide
9
9
10
10
At present, the guide is composed of the following parts:
11
11
12
12
### 1. Get Started
13
13
14
-
This section helps you set up the development environment and get OceanBase SeekDB running on your machine. Follow these steps in order if you're new to the project.
14
+
This section helps you set up the development environment and get OceanBase seekdb running on your machine. Follow these steps in order if you're new to the project.
15
15
16
16
1.[Install toolchain](toolchain.md) - Install the required development tools and dependencies
17
17
2.[Get the code, build and run](build-and-run.md) - Clone the repository, build the project, and connect to the seekdb server
@@ -21,26 +21,26 @@ This section helps you set up the development environment and get OceanBase Seek
21
21
Once you have the environment set up, these guides will help you develop effectively:
22
22
23
23
1.[Set up an IDE](ide-settings.md) - Configure your development environment for optimal productivity
24
-
2.[Coding Conventions](coding-convention.md) - Learn OceanBase SeekDB's programming habits and conventions
24
+
2.[Coding Conventions](coding-convention.md) - Learn OceanBase seekdb's programming habits and conventions
25
25
3.[Coding Standard](coding-standard.md) - Detailed C++ coding standards and constraints
26
26
4.[Write and run unit tests](unittest.md) - How to write and execute unit tests
27
27
5.[Running MySQL test](mysqltest.md) - How to run MySQL compatibility tests
28
28
6.[Debug](debug.md) - Debugging techniques and tools
29
29
30
30
### 3. Understanding the Codebase
31
31
32
-
Before you start developing a big feature, it's recommended to read these documents to better understand OceanBase SeekDB's internals:
32
+
Before you start developing a big feature, it's recommended to read these documents to better understand OceanBase seekdb's internals:
33
33
34
-
1.[Logging System](logging.md) - How logging works in OceanBase SeekDB
34
+
1.[Logging System](logging.md) - How logging works in OceanBase seekdb
35
35
2.[Memory Management](memory.md) - Memory management strategies and best practices
36
36
3.[Basic Data Structures](container.md) - Core data structures used in the codebase
37
37
38
-
### 4. Contribute to OceanBase SeekDB
38
+
### 4. Contribute to OceanBase seekdb
39
39
40
40
Ready to contribute? This guide will help you get involved in the OceanBase community:
41
41
42
42
1.[Commit code and submit a pull request](contributing.md) - Step-by-step guide to contributing code changes
43
43
44
44
---
45
45
46
-
**Note**: If you're new to the project, we recommend following the sections in order. Experienced contributors can jump directly to the sections they need.
46
+
**Note**: If you're new to the project, we recommend following the sections in order. Experienced contributors can jump directly to the sections they need.
Copy file name to clipboardExpand all lines: docs/developer-guide/en/coding-convention.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Coding Convention
3
3
---
4
4
5
-
OceanBase SeekDB is a giant project that has been developed for more than ten years and contains millions of lines of C++ code. It already has many unique programming habits. Here are some OceanBase SeekDB programming habits to help people who come into contact with the OceanBase SeekDB source code for the first time have an easier time accepting and understanding. For more detailed information, please refer to ["OceanBase SeekDB C++ Coding Standard"](./coding_standard.md).
5
+
OceanBase seekdb is a giant project that has been developed for more than ten years and contains millions of lines of C++ code. It already has many unique programming habits. Here are some OceanBase seekdb programming habits to help people who come into contact with the OceanBase seekdb source code for the first time have an easier time accepting and understanding. For more detailed information, please refer to ["OceanBase seekdb C++ Coding Standard"](./coding-standard.md).
6
6
7
7
# Naming Convention
8
8
@@ -20,29 +20,29 @@ Both function names and variables use lowercase naming separated by `_`. Member
20
20
21
21
# Coding Style
22
22
23
-
SeekDB uses some relatively simple coding styles to try to make the code readable and clear, such as adding necessary spaces for operator brackets, not too long codes, not too long functions, adding necessary comments, reasonable naming, etc. Since the coding style has many details, new developers can just refer to the coding style in the current code to write code. This is also a suggestion for participating in other projects for the first time. We should try to keep it consistent with the original style.
23
+
seekdb uses some relatively simple coding styles to try to make the code readable and clear, such as adding necessary spaces for operator brackets, not too long codes, not too long functions, adding necessary comments, reasonable naming, etc. Since the coding style has many details, new developers can just refer to the coding style in the current code to write code. This is also a suggestion for participating in other projects for the first time. We should try to keep it consistent with the original style.
24
24
25
25
There is no need to worry about the styles that you are not sure about. You can discuss it with us, or after submitting the code, someone will give suggestions or code together.
26
26
27
27
# Functional Coding Habits
28
28
29
29
## Prohibitting STL Containers
30
30
31
-
Since SeekDB supports multi-tenants resource isolation, in order to facilitate memory control, SeekDB prohibits the use of STL, boost and other containers. At the same time, SeekDB provides its own containers, such as `ObSEArray`, etc. For more information about SeekDB containers, please refer to [OceanBase SeekDB Container Introduction] (./container.md).
31
+
Since seekdb supports multi-tenants resource isolation, in order to facilitate memory control, seekdb prohibits the use of STL, boost and other containers. At the same time, seekdb provides its own containers, such as `ObSEArray`, etc. For more information about seekdb containers, please refer to [OceanBase seekdb Container Introduction] (./container.md).
32
32
33
33
## Be Caution with the New C++ Standard
34
34
35
-
SeekDB does not encourage the use of some syntax of the new C++ standard, such as auto, smart pointers, move semantics, range-based loops, lambda, etc. SeekDB believes that these will bring many negative effects, such as
35
+
seekdb does not encourage the use of some syntax of the new C++ standard, such as auto, smart pointers, move semantics, range-based loops, lambda, etc. seekdb believes that these will bring many negative effects, such as
36
36
37
37
- Improper use of `auto` can cause serious performance problems, but it only brings syntactic convenience;
38
38
- Smart pointers cannot solve the problem of object memory usage, and improper use can also cause performance problems;
39
39
- The use of move is extremely complex, and it will lead to deeply hidden BUGs without ensuring that everyone understands it correctly.
40
40
41
-
Of course, SeekDB does not exclude all new standards, such as encouraging the use of override, final, constexpr, etc. If you are not sure whether a certain syntax can be used, you can search and confirm in ["OceanBase SeekDB C++ Coding Standard"](./coding_standard.md).
41
+
Of course, seekdb does not exclude all new standards, such as encouraging the use of override, final, constexpr, etc. If you are not sure whether a certain syntax can be used, you can search and confirm in ["OceanBase seekdb C++ Coding Standard"](./coding-standard.md).
42
42
43
43
## Single Entrance and Single Exit
44
44
45
-
It is mandatory for all functions to return at the end, and it is prohibited to call global jump instructions such as return, goto, and exit midway. This is also the most confusing part for everyone who comes into contact with SeekDB code for the first time.
45
+
It is mandatory for all functions to return at the end, and it is prohibited to call global jump instructions such as return, goto, and exit midway. This is also the most confusing part for everyone who comes into contact with seekdb code for the first time.
46
46
47
47
In order to achieve this requirement, there will be a lot of `if/else if` in the code, and there are many less intuitive conditional judgments such as `OB_SUCC(ret)` in the `for` loop. At the same time, in order to reduce nesting, the macro `FALSE_IT` will be used to execute certain statements. for example
48
48
@@ -102,7 +102,7 @@ Or similar simple judgment functions do not need to return int error codes.
102
102
103
103
## Need to Determine the Validity of All Return Values and Parameters
104
104
105
-
SeekDB requires that as long as the function has a return value, the return value must be tested, and "check if possible." Function parameters, especially pointers, must be checked for validity before use.
105
+
seekdb requires that as long as the function has a return value, the return value must be tested, and "check if possible." Function parameters, especially pointers, must be checked for validity before use.
106
106
107
107
For example:
108
108
@@ -127,9 +127,9 @@ int ObDDLServerClient::abort_redef_table(const obrpc::ObAbortRedefTableArg &arg,
127
127
128
128
## Memory Management
129
129
130
-
Memory management is a very troublesome issue in C/C++ programs. SeekDB has done a lot of work for memory management, including efficient memory allocation, memory problem detection, tenant memory isolation, etc. SeekDB provides a set of memory management mechanisms for this purpose, and also prohibits the direct use of C/C++ native memory allocation interfaces in programs, such as malloc, new, etc.
130
+
Memory management is a very troublesome issue in C/C++ programs. seekdb has done a lot of work for memory management, including efficient memory allocation, memory problem detection, tenant memory isolation, etc. seekdb provides a set of memory management mechanisms for this purpose, and also prohibits the direct use of C/C++ native memory allocation interfaces in programs, such as malloc, new, etc.
131
131
132
-
The simplest, SeekDB provides the `ob_malloc/ob_free` interface to allocate and release memory:
132
+
The simplest, seekdb provides the `ob_malloc/ob_free` interface to allocate and release memory:
SeekDB requires that the pointer must be assigned to null immediately after the memory is released.
147
-
For more information about memory management, please refer to [OceanBase SeekDB Memory Management](./memory.md).
146
+
seekdb requires that the pointer must be assigned to null immediately after the memory is released.
147
+
For more information about memory management, please refer to [OceanBase seekdb Memory Management](./memory.md).
148
148
149
149
# Some Conventional Interfaces
150
150
151
151
## init/destroy
152
152
153
-
SeekDB requires that only some very lightweight data initialization work can be implemented in the constructor, such as variables initialized to 0, pointers initialized to nullptr, etc. Because in the constructor, it is not easy to handle some complex exception scenarios, and the return value cannot be given. Most classes in SeekDB have an init function, which is usually executed after the constructor and has an int error code as the return value. Do some more complex initialization work here. Correspondingly, the destroy function is usually provided to do resource destruction.
153
+
seekdb requires that only some very lightweight data initialization work can be implemented in the constructor, such as variables initialized to 0, pointers initialized to nullptr, etc. Because in the constructor, it is not easy to handle some complex exception scenarios, and the return value cannot be given. Most classes in seekdb have an init function, which is usually executed after the constructor and has an int error code as the return value. Do some more complex initialization work here. Correspondingly, the destroy function is usually provided to do resource destruction.
154
154
155
155
## reuse/reset
156
156
157
-
Memory caching is a very effective way of improving performance. Many classes in SeekDB will have reuse/reset interfaces to facilitate the subsequent reuse of an object. Reuse usually represents lightweight cleanup work, while reset will do more resource cleanup work. But you need to look at the specific implementation class and cannot generalize.
157
+
Memory caching is a very effective way of improving performance. Many classes in seekdb will have reuse/reset interfaces to facilitate the subsequent reuse of an object. Reuse usually represents lightweight cleanup work, while reset will do more resource cleanup work. But you need to look at the specific implementation class and cannot generalize.
0 commit comments