├── .clang-format ├── .devcontainer └── devcontainer.json ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── enhancement.md │ ├── feature_request.md │ └── question.md ├── pull_request_template.md └── workflows │ ├── build.yml │ ├── clang-format.yml │ ├── codeql.yml │ ├── gh-pages.yml │ ├── pulish-docker-image.yml │ └── test.yml ├── .gitignore ├── .gitmodules ├── .gitpod.yml ├── .scanignore ├── .vscode ├── launch.json └── tasks.json ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── License ├── NOTICE ├── README.md ├── benchmark ├── CMakeLists.txt ├── aggregate_hash_table_performance_test.cpp ├── arithmetic_operator_performance_test.cpp ├── bplus_tree_concurrency_test.cpp ├── memtracer_performance_test.cpp ├── oblsm_performance_test.cpp ├── pax_storage_concurrency_test.cpp ├── record_manager_concurrency_test.cpp └── server_concurrency_test.cpp ├── build.sh ├── docker ├── Dockerfile ├── README.md ├── bin │ ├── starter-code.sh │ ├── starter-sshd.sh │ └── starter.sh └── docker-compose.yml ├── docs ├── Doxyfile ├── docs │ ├── assets │ │ ├── favicon.ico │ │ ├── logo.png │ │ └── mathjax.js │ ├── blog │ │ ├── 1.md │ │ ├── images │ │ │ ├── 1-hekaton-storage-engine.png │ │ │ ├── 1-range-index-bw-tree.png │ │ │ ├── 1-record-lock.png │ │ │ ├── 1-storage-engine-prototype.png │ │ │ ├── 1-transaction-process-phases-2.png │ │ │ ├── 1-transaction-process-phases.png │ │ │ └── 1-transaction-state.png │ │ └── introduction.md │ ├── db_course_lab │ │ ├── cloudlab_setup.md │ │ ├── images │ │ │ ├── cloudlab-setup-config-clangd.png │ │ │ ├── cloudlab-setup-debug.png │ │ │ ├── cloudlab-setup-install-clangd.png │ │ │ ├── cloudlab-setup-install-cppdbg.png │ │ │ ├── cloudlab-setup-join-class.png │ │ │ ├── cloudlab-setup-launch-config.png │ │ │ ├── cloudlab-setup-miniob.png │ │ │ ├── cloudlab-setup-openvscode.png │ │ │ ├── cloudlab-setup-startenv.png │ │ │ ├── cloudlab-setup-workspace.png │ │ │ ├── cloudlab-setupenv-checkdoc.png │ │ │ ├── hashjoin.png │ │ │ ├── miniob-lsmtree-overview.png │ │ │ └── transaction-mvcc.png │ │ ├── lab0.md │ │ ├── lab1.md │ │ ├── lab2.md │ │ ├── lab3.md │ │ ├── lab4.md │ │ └── overview.md │ ├── design │ │ ├── images │ │ │ ├── bplus-tree.jpg │ │ │ ├── miniob-architecture.svg │ │ │ ├── miniob-bplus-tree-deletion-migration.png │ │ │ ├── miniob-bplus-tree-deletion-move.png │ │ │ ├── miniob-bplus-tree-deletion-move2.png │ │ │ ├── miniob-bplus-tree-deletion.png │ │ │ ├── miniob-bplus-tree-index-file.png │ │ │ ├── miniob-bplus-tree-internal-node.png │ │ │ ├── miniob-bplus-tree-internal-struct.png │ │ │ ├── miniob-bplus-tree-internal-struct2.png │ │ │ ├── miniob-bplus-tree-leaf-node.png │ │ │ ├── miniob-bplus-tree-leaf-page.png │ │ │ ├── miniob-bplus-tree-pages-in-file.png │ │ │ ├── miniob-buffer-pool-directory.png │ │ │ ├── miniob-buffer-pool-implementation.png │ │ │ ├── miniob-buffer-pool-page.png │ │ │ ├── miniob-buffer-pool-record.png │ │ │ ├── miniob-double-write-buffer-struct.png │ │ │ ├── miniob-overview.png │ │ │ ├── mysql-auth.png │ │ │ ├── mysql-command-packet.png │ │ │ ├── mysql-error-packet.png │ │ │ ├── mysql-flow.png │ │ │ ├── mysql-handshake.png │ │ │ ├── mysql-ok-eof-packet.png │ │ │ ├── mysql-ok-packet.png │ │ │ ├── mysql-packet-flow.png │ │ │ ├── mysql-result-set-packet.png │ │ │ ├── thread-model-one-thread-per-connection.png │ │ │ └── thread-model-thread-pool.png │ │ ├── introduction.md │ │ ├── miniob-aggregation-and-group-by.md │ │ ├── miniob-architecture.md │ │ ├── miniob-bplus-tree-concurrency.md │ │ ├── miniob-bplus-tree.md │ │ ├── miniob-buffer-pool.md │ │ ├── miniob-cascade.md │ │ ├── miniob-double-write-buffer.md │ │ ├── miniob-durability.md │ │ ├── miniob-how-to-add-new-sql.md │ │ ├── miniob-lsm-tree.md │ │ ├── miniob-mysql-protocol.md │ │ ├── miniob-pax-storage.md │ │ ├── miniob-sql-expression.md │ │ ├── miniob-sql-parser.md │ │ ├── miniob-thread-model.md │ │ └── miniob-transaction.md │ ├── dev-env │ │ ├── dev_by_online.md │ │ ├── how-to-dev-using-docker.md │ │ ├── how_to_dev_in_docker_container_by_vscode.md │ │ ├── how_to_dev_in_docker_container_by_vscode_on_windows.md │ │ ├── how_to_dev_miniob_by_docker_on_windows.md │ │ ├── how_to_dev_miniob_by_docker_on_windows_simplified.md │ │ ├── how_to_dev_miniob_by_vscode.md │ │ ├── how_to_dev_miniob_in_vscodeGUI_by_docker_on_windows.md │ │ ├── how_to_submit_for_testing.md │ │ ├── images │ │ │ ├── dev-containers-breakpoint.png │ │ │ ├── dev-containers-build_debug.png │ │ │ ├── dev-containers-c_dependence.png │ │ │ ├── dev-containers-clone_miniob.png │ │ │ ├── dev-containers-dev-containers.png │ │ │ ├── dev-containers-docker_desktop.png │ │ │ ├── dev-containers-miniob_build.png │ │ │ ├── dev-containers-open-localfile.png │ │ │ ├── dev-containers-vscode-contend.png │ │ │ ├── dev-containers-vscode-menu.png │ │ │ ├── dev_by_github_codespaces.png │ │ │ ├── dev_by_gitpod_build_init.png │ │ │ ├── dev_by_gitpod_build_init_output.png │ │ │ ├── dev_by_gitpod_build_others.png │ │ │ ├── dev_by_gitpod_build_output.png │ │ │ ├── dev_by_gitpod_build_run_build_task.png │ │ │ ├── dev_by_gitpod_build_run_task.png │ │ │ ├── dev_by_gitpod_dashboard.png │ │ │ ├── dev_by_gitpod_debug_breakpoint.png │ │ │ ├── dev_by_gitpod_debug_console.png │ │ │ ├── dev_by_gitpod_debug_debugging_view.png │ │ │ ├── dev_by_gitpod_debug_start.png │ │ │ ├── dev_by_gitpod_debug_take_breakpoint.png │ │ │ ├── dev_by_gitpod_debug_terminal.png │ │ │ ├── dev_by_gitpod_fork_repo.png │ │ │ ├── dev_by_gitpod_git_auth.png │ │ │ ├── dev_by_gitpod_git_auth1.png │ │ │ ├── dev_by_gitpod_git_commit.png │ │ │ ├── dev_by_gitpod_git_edit_permissions.png │ │ │ ├── dev_by_gitpod_git_operations.png │ │ │ ├── dev_by_gitpod_git_pre_edit_permissions.png │ │ │ ├── dev_by_gitpod_git_push_error.png │ │ │ ├── dev_by_gitpod_gitpod_new_workspace.png │ │ │ ├── dev_by_gitpod_ides.png │ │ │ ├── dev_by_gitpod_miniob_workspace.png │ │ │ ├── dev_by_gitpod_open_gitpod.png │ │ │ ├── dev_by_gitpod_open_miniob.jpg │ │ │ ├── dev_by_gitpod_vscode_homepage.png │ │ │ ├── dev_by_gitpod_workspace.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_Docker.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_clone.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_clone_branch.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_clone_done.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_clone_file_info.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_downloadDocker.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_plugin.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_prepareDocker1.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_prepareDocker2.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_prepareDocker3.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_searchEnv.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_searchEnv2.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_searchEnv3.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_1.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_2.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_3.png │ │ │ ├── dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_4.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_attach.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_breakpoint.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_builddebug.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_content.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_debug.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_docker.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_process0.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_process100.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_stop.png │ │ │ ├── dev_in_vscode_GUI_with_docker_container_based_on_windows_task.png │ │ │ ├── docker_pull_timeout.png │ │ │ ├── github_integration_test.png │ │ │ ├── train_contact_us.png │ │ │ ├── train_mainpage.png │ │ │ ├── train_miniob_2024.png │ │ │ ├── train_miniob_2024_question.png │ │ │ ├── train_miniob_2024_question_detail1.png │ │ │ ├── train_miniob_2024_question_detail2.png │ │ │ ├── train_miniob_2024_submit_code.png │ │ │ ├── train_miniob_result.png │ │ │ ├── vsc_add_new_ssh_host.png │ │ │ ├── vsc_config_file.png │ │ │ ├── vsc_container_started.png │ │ │ ├── vsc_cpp_extensions.png │ │ │ ├── vsc_debug.png │ │ │ ├── vsc_kit_for_miniob.png │ │ │ ├── vsc_open_folder.png │ │ │ ├── vsc_pwd.png │ │ │ ├── vsc_remote_ssh_connect_cmd.png │ │ │ ├── vsc_remote_ssh_extension.png │ │ │ ├── vsc_server_started.png │ │ │ ├── vsc_ssh_connect.png │ │ │ ├── vscode_C++_plugs_detail.png │ │ │ ├── vscode_break_point.png │ │ │ ├── vscode_build_ouput.png │ │ │ ├── vscode_cmake.png │ │ │ ├── vscode_debug_miniob.png │ │ │ ├── vscode_dev_with_local_virtual_env_clangd.png │ │ │ ├── vscode_dev_with_local_virtual_env_commit_lab1.png │ │ │ ├── vscode_dev_with_local_virtual_env_commit_lab2.png │ │ │ ├── vscode_dev_with_local_virtual_env_commit_lab3.png │ │ │ ├── vscode_dev_with_local_virtual_env_commit_lab4.png │ │ │ ├── vscode_dev_with_local_virtual_env_config_docker.png │ │ │ ├── vscode_dev_with_local_virtual_env_cppdbg.png │ │ │ ├── vscode_dev_with_local_virtual_env_open_miniob2.png │ │ │ ├── vscode_dev_with_local_virtual_env_open_miniob_as_workspace.png │ │ │ ├── vscode_dev_with_local_virtual_env_run_docker.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup-config-clangd.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup-debug.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup-install-clangd.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup-install-cppdbg.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup-launch-config.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_check_status_ssh.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_download_ubuntu.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_sshd.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu1.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu2.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu3.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu4.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu5.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu6.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu7.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu8.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu9.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_init_ubuntu_net.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_ssh_connection.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_vscode_install_ssh.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_vscode_new_file.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_vscode_new_remote.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_vscode_new_remote2.png │ │ │ ├── vscode_dev_with_local_virtual_env_setup_vscode_workspcae.png │ │ │ ├── vscode_search_plugs.png │ │ │ ├── windows-enable-disable-functions.png │ │ │ ├── windows-enable-service.png │ │ │ ├── windows-functions.png │ │ │ ├── windows-search-service.png │ │ │ ├── windows-terminal-mutli-shell.png │ │ │ ├── windows-terminal.png │ │ │ └── windows-wsl.png │ │ ├── integration_test.md │ │ ├── introduction.md │ │ ├── miniob-how-to-debug.md │ │ └── vscode_dev_with_local_virtual_env.md │ ├── game │ │ ├── debug-output.md │ │ ├── git-introduction.md │ │ ├── gitee-instructions.md │ │ ├── github-introduction.md │ │ ├── images │ │ │ ├── add-members.png │ │ │ ├── create-repo.png │ │ │ ├── create-repo2.png │ │ │ ├── github-add-people.png │ │ │ ├── github-add-tester-2.png │ │ │ ├── github-add-tester.png │ │ │ ├── github-begin-import-form.png │ │ │ ├── github-commit-info.png │ │ │ ├── github-developer-settings.png │ │ │ ├── github-fill-out-token-form.jpg │ │ │ ├── github-generate-new-token.png │ │ │ ├── github-import-done.png │ │ │ ├── github-import-repository.png │ │ │ ├── github-invite-success.png │ │ │ ├── github-pending-invite.png │ │ │ ├── github-personal-settings.png │ │ │ ├── github-save-token.png │ │ │ ├── github-validate-token.png │ │ │ ├── github-view-repo.png │ │ │ ├── invite-users.png │ │ │ ├── ivfflat.png │ │ │ └── reporter.png │ │ ├── introduction.md │ │ ├── miniob-memtracer.md │ │ ├── miniob-output-convention.md │ │ ├── miniob-vectordb.md │ │ └── miniob_topics.md │ ├── how_to_build.md │ ├── how_to_run.md │ ├── images │ │ ├── miniob-build-crlf.png │ │ ├── miniob-introduction-running-the-client.png │ │ ├── miniob-introduction-running-the-server.png │ │ └── miniob-introduction-sql-flow.png │ ├── index.md │ └── lectures │ │ ├── copyright.md │ │ ├── images │ │ ├── 1-1.png │ │ ├── 1.3.1.3-1.png │ │ ├── 1.3.1.3-2.png │ │ ├── 2-1.png │ │ ├── 2-2.png │ │ ├── 2-3.png │ │ ├── 2-4.png │ │ ├── 2-5.png │ │ ├── 2-6.png │ │ ├── 2-7.png │ │ ├── 2-8.png │ │ ├── 3-1.png │ │ ├── 3-2-a.png │ │ ├── 3-2-b.png │ │ ├── 3-2-c.png │ │ ├── 3-3-a.png │ │ ├── 3-3-b.png │ │ ├── 3-3-c.png │ │ ├── 3-4.png │ │ ├── 3-5.png │ │ ├── 3-6-a.png │ │ ├── 3-6-b.png │ │ ├── 3-7-a.png │ │ ├── 3-7-b.png │ │ ├── 3-7-c.png │ │ ├── 4-1.png │ │ ├── 4-2.png │ │ ├── 4-3.png │ │ ├── 4-4.png │ │ ├── 4-5.png │ │ ├── 4-6.png │ │ ├── 5-1.png │ │ ├── 5.2.1.1-1.png │ │ ├── 5.2.1.1-2.png │ │ ├── 5.2.1.1-3.png │ │ ├── 5.2.1.1-4.png │ │ ├── 5.2.2.1-1.png │ │ ├── 5.3.1.1-4.png │ │ ├── 6-1.png │ │ ├── 6-2.png │ │ ├── 6-3.png │ │ └── 6-4.png │ │ ├── index.md │ │ ├── lecture-1.md │ │ ├── lecture-2.md │ │ ├── lecture-3.md │ │ ├── lecture-4.md │ │ ├── lecture-5.md │ │ ├── lecture-6.md │ │ └── references.md ├── mkdocs.yml └── requirements.txt ├── etc └── observer.ini ├── src ├── CMakeLists.txt ├── common │ ├── CMakeLists.txt │ ├── conf │ │ ├── ini.cpp │ │ └── ini.h │ ├── defs.h │ ├── io │ │ ├── io.cpp │ │ └── io.h │ ├── lang │ │ ├── algorithm.h │ │ ├── array.h │ │ ├── atomic.h │ │ ├── bitmap.cpp │ │ ├── bitmap.h │ │ ├── bitset.h │ │ ├── charconv.h │ │ ├── chrono.h │ │ ├── cmath.h │ │ ├── comparator.cpp │ │ ├── comparator.h │ │ ├── condition_variable.h │ │ ├── defer.h │ │ ├── deque.h │ │ ├── exception.h │ │ ├── filesystem.h │ │ ├── fstream.h │ │ ├── functional.h │ │ ├── initializer_list.h │ │ ├── iomanip.h │ │ ├── ios.h │ │ ├── iostream.h │ │ ├── iterator.h │ │ ├── limits.h │ │ ├── list.h │ │ ├── lower_bound.h │ │ ├── lru_cache.h │ │ ├── map.h │ │ ├── memory.h │ │ ├── mutex.cpp │ │ ├── mutex.h │ │ ├── new.h │ │ ├── queue.h │ │ ├── random.h │ │ ├── ranges.h │ │ ├── serializable.h │ │ ├── serializer.cpp │ │ ├── serializer.h │ │ ├── set.h │ │ ├── span.h │ │ ├── sstream.h │ │ ├── stack.h │ │ ├── stdexcept.h │ │ ├── string.cpp │ │ ├── string.h │ │ ├── string_view.h │ │ ├── system_error.h │ │ ├── thread.h │ │ ├── tuple.h │ │ ├── unordered_map.h │ │ ├── unordered_set.h │ │ ├── utility.h │ │ └── vector.h │ ├── linereader │ │ ├── line_reader.cpp │ │ └── line_reader.h │ ├── log │ │ ├── backtrace.cpp │ │ ├── backtrace.h │ │ ├── log.cpp │ │ └── log.h │ ├── math │ │ ├── crc.cpp │ │ ├── crc.h │ │ ├── integer_generator.h │ │ ├── md5.cpp │ │ ├── md5.h │ │ ├── random_generator.cpp │ │ ├── random_generator.h │ │ ├── regex.cpp │ │ ├── regex.h │ │ ├── simd_util.cpp │ │ └── simd_util.h │ ├── mm │ │ ├── debug_new.h │ │ ├── mem_pool.cpp │ │ └── mem_pool.h │ ├── os │ │ ├── os.cpp │ │ ├── os.h │ │ ├── path.cpp │ │ ├── path.h │ │ ├── pidfile.cpp │ │ ├── pidfile.h │ │ ├── process.cpp │ │ ├── process.h │ │ ├── process_param.cpp │ │ ├── process_param.h │ │ ├── signal.cpp │ │ └── signal.h │ ├── queue │ │ ├── queue.h │ │ ├── simple_queue.h │ │ └── simple_queue.ipp │ ├── sys │ │ ├── rc.cpp │ │ └── rc.h │ ├── thread │ │ ├── runnable.h │ │ ├── thread_pool_executor.cpp │ │ ├── thread_pool_executor.h │ │ ├── thread_util.cpp │ │ └── thread_util.h │ └── time │ │ ├── datetime.cpp │ │ ├── datetime.h │ │ ├── timeout_info.cpp │ │ └── timeout_info.h ├── cpplings │ ├── CMakeLists.txt │ ├── README.md │ ├── cas.cpp │ ├── condition_variable.cpp │ ├── lambda.cpp │ ├── lock.cpp │ ├── mutex.cpp │ ├── smart_pointer.cpp │ ├── stl.cpp │ └── template.cpp ├── memtracer │ ├── CMakeLists.txt │ ├── allocator.cpp │ ├── allocator.h │ ├── common.cpp │ ├── common.h │ ├── memtracer.cpp │ ├── memtracer.h │ ├── mt_info.cpp │ └── mt_info.h ├── obclient │ ├── CMakeLists.txt │ └── client.cpp ├── oblsm │ ├── CMakeLists.txt │ ├── benchmarks │ │ └── ob_lsm_bench.cpp │ ├── client │ │ ├── cliutil │ │ │ ├── defs.h │ │ │ ├── parser.cpp │ │ │ └── parser.h │ │ └── ob_lsm_client.cpp │ ├── compaction │ │ ├── ob_compaction.cpp │ │ ├── ob_compaction.h │ │ ├── ob_compaction_picker.cpp │ │ └── ob_compaction_picker.h │ ├── include │ │ ├── ob_lsm.h │ │ ├── ob_lsm_iterator.h │ │ ├── ob_lsm_options.h │ │ └── ob_lsm_transaction.h │ ├── memtable │ │ ├── ob_memtable.cpp │ │ ├── ob_memtable.h │ │ └── ob_skiplist.h │ ├── ob_lsm_define.h │ ├── ob_lsm_impl.cpp │ ├── ob_lsm_impl.h │ ├── ob_lsm_transaction.cpp │ ├── ob_manifest.cpp │ ├── ob_manifest.h │ ├── ob_user_iterator.cpp │ ├── ob_user_iterator.h │ ├── table │ │ ├── ob_block.cpp │ │ ├── ob_block.h │ │ ├── ob_block_builder.cpp │ │ ├── ob_block_builder.h │ │ ├── ob_merger.cpp │ │ ├── ob_merger.h │ │ ├── ob_sstable.cpp │ │ ├── ob_sstable.h │ │ ├── ob_sstable_builder.cpp │ │ └── ob_sstable_builder.h │ ├── util │ │ ├── ob_arena.cpp │ │ ├── ob_arena.h │ │ ├── ob_bloomfilter.cpp │ │ ├── ob_bloomfilter.h │ │ ├── ob_coding.h │ │ ├── ob_comparator.cpp │ │ ├── ob_comparator.h │ │ ├── ob_file_reader.cpp │ │ ├── ob_file_reader.h │ │ ├── ob_file_writer.cpp │ │ ├── ob_file_writer.h │ │ ├── ob_lru_cache.cpp │ │ └── ob_lru_cache.h │ └── wal │ │ ├── ob_lsm_wal.cpp │ │ └── ob_lsm_wal.h └── observer │ ├── CMakeLists.txt │ ├── catalog │ ├── catalog.cpp │ ├── catalog.h │ └── table_stats.h │ ├── common │ ├── global_context.cpp │ ├── global_context.h │ ├── ini_setting.h │ ├── init.cpp │ ├── init.h │ ├── type │ │ ├── attr_type.cpp │ │ ├── attr_type.h │ │ ├── char_type.cpp │ │ ├── char_type.h │ │ ├── data_type.cpp │ │ ├── data_type.h │ │ ├── float_type.cpp │ │ ├── float_type.h │ │ ├── integer_type.cpp │ │ ├── integer_type.h │ │ └── vector_type.h │ ├── types.h │ ├── value.cpp │ └── value.h │ ├── event │ ├── session_event.cpp │ ├── session_event.h │ ├── sql_debug.cpp │ ├── sql_debug.h │ ├── sql_event.cpp │ ├── sql_event.h │ └── storage_event.h │ ├── main.cpp │ ├── mainpage.md │ ├── net │ ├── buffered_writer.cpp │ ├── buffered_writer.h │ ├── cli_communicator.cpp │ ├── cli_communicator.h │ ├── communicator.cpp │ ├── communicator.h │ ├── java_thread_pool_thread_handler.cpp │ ├── java_thread_pool_thread_handler.h │ ├── mysql_communicator.cpp │ ├── mysql_communicator.h │ ├── one_thread_per_connection_thread_handler.cpp │ ├── one_thread_per_connection_thread_handler.h │ ├── plain_communicator.cpp │ ├── plain_communicator.h │ ├── ring_buffer.cpp │ ├── ring_buffer.h │ ├── server.cpp │ ├── server.h │ ├── server_param.h │ ├── sql_task_handler.cpp │ ├── sql_task_handler.h │ ├── thread_handler.cpp │ └── thread_handler.h │ ├── session │ ├── session.cpp │ ├── session.h │ ├── session_stage.cpp │ ├── session_stage.h │ ├── thread_data.cpp │ └── thread_data.h │ ├── sql │ ├── executor │ │ ├── analyze_table_executor.cpp │ │ ├── analyze_table_executor.h │ │ ├── command_executor.cpp │ │ ├── command_executor.h │ │ ├── create_index_executor.cpp │ │ ├── create_index_executor.h │ │ ├── create_table_executor.cpp │ │ ├── create_table_executor.h │ │ ├── desc_table_executor.cpp │ │ ├── desc_table_executor.h │ │ ├── execute_stage.cpp │ │ ├── execute_stage.h │ │ ├── help_executor.h │ │ ├── load_data_executor.cpp │ │ ├── load_data_executor.h │ │ ├── set_variable_executor.cpp │ │ ├── set_variable_executor.h │ │ ├── show_tables_executor.h │ │ ├── sql_result.cpp │ │ ├── sql_result.h │ │ ├── trx_begin_executor.h │ │ └── trx_end_executor.h │ ├── expr │ │ ├── aggregate_hash_table.cpp │ │ ├── aggregate_hash_table.h │ │ ├── aggregate_state.cpp │ │ ├── aggregate_state.h │ │ ├── aggregator.cpp │ │ ├── aggregator.h │ │ ├── arithmetic_operator.hpp │ │ ├── composite_tuple.cpp │ │ ├── composite_tuple.h │ │ ├── expression.cpp │ │ ├── expression.h │ │ ├── expression_iterator.cpp │ │ ├── expression_iterator.h │ │ ├── expression_tuple.h │ │ ├── tuple.h │ │ ├── tuple_cell.cpp │ │ └── tuple_cell.h │ ├── operator │ │ ├── aggregate_vec_physical_operator.cpp │ │ ├── aggregate_vec_physical_operator.h │ │ ├── calc_logical_operator.h │ │ ├── calc_physical_operator.h │ │ ├── delete_logical_operator.cpp │ │ ├── delete_logical_operator.h │ │ ├── delete_physical_operator.cpp │ │ ├── delete_physical_operator.h │ │ ├── explain_logical_operator.h │ │ ├── explain_physical_operator.cpp │ │ ├── explain_physical_operator.h │ │ ├── expr_vec_physical_operator.cpp │ │ ├── expr_vec_physical_operator.h │ │ ├── group_by_logical_operator.cpp │ │ ├── group_by_logical_operator.h │ │ ├── group_by_physical_operator.cpp │ │ ├── group_by_physical_operator.h │ │ ├── group_by_vec_physical_operator.cpp │ │ ├── group_by_vec_physical_operator.h │ │ ├── hash_group_by_physical_operator.cpp │ │ ├── hash_group_by_physical_operator.h │ │ ├── hash_join_physical_operator.cpp │ │ ├── hash_join_physical_operator.h │ │ ├── index_scan_physical_operator.cpp │ │ ├── index_scan_physical_operator.h │ │ ├── insert_logical_operator.cpp │ │ ├── insert_logical_operator.h │ │ ├── insert_physical_operator.cpp │ │ ├── insert_physical_operator.h │ │ ├── join_logical_operator.h │ │ ├── join_physical_operator.cpp │ │ ├── join_physical_operator.h │ │ ├── logical_operator.cpp │ │ ├── logical_operator.h │ │ ├── nested_loop_join_physical_operator.cpp │ │ ├── nested_loop_join_physical_operator.h │ │ ├── operator_node.h │ │ ├── physical_operator.cpp │ │ ├── physical_operator.h │ │ ├── predicate_logical_operator.cpp │ │ ├── predicate_logical_operator.h │ │ ├── predicate_physical_operator.cpp │ │ ├── predicate_physical_operator.h │ │ ├── project_logical_operator.cpp │ │ ├── project_logical_operator.h │ │ ├── project_physical_operator.cpp │ │ ├── project_physical_operator.h │ │ ├── project_vec_physical_operator.cpp │ │ ├── project_vec_physical_operator.h │ │ ├── scalar_group_by_physical_operator.cpp │ │ ├── scalar_group_by_physical_operator.h │ │ ├── string_list_physical_operator.h │ │ ├── table_get_logical_operator.cpp │ │ ├── table_get_logical_operator.h │ │ ├── table_scan_physical_operator.cpp │ │ ├── table_scan_physical_operator.h │ │ ├── table_scan_vec_physical_operator.cpp │ │ └── table_scan_vec_physical_operator.h │ ├── optimizer │ │ ├── cascade │ │ │ ├── README.md │ │ │ ├── cost_model.cpp │ │ │ ├── cost_model.h │ │ │ ├── group.cpp │ │ │ ├── group.h │ │ │ ├── group_expr.cpp │ │ │ ├── group_expr.h │ │ │ ├── implementation_rules.cpp │ │ │ ├── implementation_rules.h │ │ │ ├── memo.cpp │ │ │ ├── memo.h │ │ │ ├── optimizer.cpp │ │ │ ├── optimizer.h │ │ │ ├── optimizer_context.cpp │ │ │ ├── optimizer_context.h │ │ │ ├── pattern.h │ │ │ ├── pending_tasks.h │ │ │ ├── property.h │ │ │ ├── property_set.h │ │ │ ├── rules.cpp │ │ │ ├── rules.h │ │ │ └── tasks │ │ │ │ ├── apply_rule_task.cpp │ │ │ │ ├── apply_rule_task.h │ │ │ │ ├── cascade_task.cpp │ │ │ │ ├── cascade_task.h │ │ │ │ ├── e_group_task.cpp │ │ │ │ ├── e_group_task.h │ │ │ │ ├── o_expr_task.cpp │ │ │ │ ├── o_expr_task.h │ │ │ │ ├── o_group_task.cpp │ │ │ │ ├── o_group_task.h │ │ │ │ ├── o_input_task.cpp │ │ │ │ └── o_input_task.h │ │ ├── comparison_simplification_rule.cpp │ │ ├── comparison_simplification_rule.h │ │ ├── conjunction_simplification_rule.cpp │ │ ├── conjunction_simplification_rule.h │ │ ├── expression_rewriter.cpp │ │ ├── expression_rewriter.h │ │ ├── logical_plan_generator.cpp │ │ ├── logical_plan_generator.h │ │ ├── optimize_stage.cpp │ │ ├── optimize_stage.h │ │ ├── optimizer_utils.cpp │ │ ├── optimizer_utils.h │ │ ├── physical_plan_generator.cpp │ │ ├── physical_plan_generator.h │ │ ├── predicate_pushdown_rewriter.cpp │ │ ├── predicate_pushdown_rewriter.h │ │ ├── predicate_rewrite.cpp │ │ ├── predicate_rewrite.h │ │ ├── predicate_to_join_rule.cpp │ │ ├── predicate_to_join_rule.h │ │ ├── rewrite_rule.h │ │ ├── rewriter.cpp │ │ ├── rewriter.h │ │ └── statistics │ │ │ └── table_statistics.h │ ├── parser │ │ ├── expression_binder.cpp │ │ ├── expression_binder.h │ │ ├── gen_parser.sh │ │ ├── lex_sql.l │ │ ├── parse.cpp │ │ ├── parse.h │ │ ├── parse_defs.h │ │ ├── parse_stage.cpp │ │ ├── parse_stage.h │ │ ├── resolve_stage.cpp │ │ ├── resolve_stage.h │ │ └── yacc_sql.y │ ├── plan_cache │ │ ├── plan_cache_stage.cpp │ │ └── plan_cache_stage.h │ ├── query_cache │ │ ├── query_cache_stage.cpp │ │ └── query_cache_stage.h │ └── stmt │ │ ├── analyze_table_stmt.cpp │ │ ├── analyze_table_stmt.h │ │ ├── calc_stmt.h │ │ ├── create_index_stmt.cpp │ │ ├── create_index_stmt.h │ │ ├── create_table_stmt.cpp │ │ ├── create_table_stmt.h │ │ ├── delete_stmt.cpp │ │ ├── delete_stmt.h │ │ ├── desc_table_stmt.cpp │ │ ├── desc_table_stmt.h │ │ ├── exit_stmt.h │ │ ├── explain_stmt.cpp │ │ ├── explain_stmt.h │ │ ├── filter_stmt.cpp │ │ ├── filter_stmt.h │ │ ├── help_stmt.h │ │ ├── insert_stmt.cpp │ │ ├── insert_stmt.h │ │ ├── load_data_stmt.cpp │ │ ├── load_data_stmt.h │ │ ├── select_stmt.cpp │ │ ├── select_stmt.h │ │ ├── set_variable_stmt.h │ │ ├── show_tables_stmt.h │ │ ├── stmt.cpp │ │ ├── stmt.h │ │ ├── trx_begin_stmt.h │ │ ├── trx_end_stmt.h │ │ ├── update_stmt.cpp │ │ └── update_stmt.h │ └── storage │ ├── buffer │ ├── buffer_pool_log.cpp │ ├── buffer_pool_log.h │ ├── disk_buffer_pool.cpp │ ├── disk_buffer_pool.h │ ├── double_write_buffer.cpp │ ├── double_write_buffer.h │ ├── frame.cpp │ ├── frame.h │ └── page.h │ ├── clog │ ├── disk_log_handler.cpp │ ├── disk_log_handler.h │ ├── integrated_log_replayer.cpp │ ├── integrated_log_replayer.h │ ├── log_buffer.cpp │ ├── log_buffer.h │ ├── log_entry.cpp │ ├── log_entry.h │ ├── log_file.cpp │ ├── log_file.h │ ├── log_handler.cpp │ ├── log_handler.h │ ├── log_module.h │ ├── log_replayer.h │ └── vacuous_log_handler.h │ ├── common │ ├── chunk.cpp │ ├── chunk.h │ ├── codec.cpp │ ├── codec.h │ ├── column.cpp │ ├── column.h │ ├── condition_filter.cpp │ ├── condition_filter.h │ ├── meta_util.cpp │ └── meta_util.h │ ├── db │ ├── db.cpp │ └── db.h │ ├── default │ ├── default_handler.cpp │ └── default_handler.h │ ├── field │ ├── field.cpp │ ├── field.h │ ├── field_meta.cpp │ └── field_meta.h │ ├── index │ ├── bplus_tree.cpp │ ├── bplus_tree.h │ ├── bplus_tree_index.cpp │ ├── bplus_tree_index.h │ ├── bplus_tree_log.cpp │ ├── bplus_tree_log.h │ ├── bplus_tree_log_entry.cpp │ ├── bplus_tree_log_entry.h │ ├── index.cpp │ ├── index.h │ ├── index_meta.cpp │ ├── index_meta.h │ ├── ivfflat_index.h │ ├── latch_memo.cpp │ └── latch_memo.h │ ├── persist │ ├── persist.cpp │ └── persist.h │ ├── record │ ├── heap_record_scanner.cpp │ ├── heap_record_scanner.h │ ├── lsm_record_scanner.cpp │ ├── lsm_record_scanner.h │ ├── record.h │ ├── record_log.cpp │ ├── record_log.h │ ├── record_manager.cpp │ ├── record_manager.h │ ├── record_scanner.cpp │ └── record_scanner.h │ ├── table │ ├── .table_meta.cpp.swp │ ├── heap_table_engine.cpp │ ├── heap_table_engine.h │ ├── lsm_table_engine.cpp │ ├── lsm_table_engine.h │ ├── table.cpp │ ├── table.h │ ├── table_engine.h │ ├── table_meta.cpp │ └── table_meta.h │ └── trx │ ├── lsm_mvcc_trx.cpp │ ├── lsm_mvcc_trx.h │ ├── mvcc_trx.cpp │ ├── mvcc_trx.h │ ├── mvcc_trx_log.cpp │ ├── mvcc_trx_log.h │ ├── trx.cpp │ ├── trx.h │ ├── vacuous_trx.cpp │ └── vacuous_trx.h ├── test ├── case │ ├── README.md │ ├── miniob_test.py │ ├── result │ │ ├── basic.result │ │ ├── vectorized-aggregation-and-group-by.result │ │ └── vectorized-basic.result │ └── test │ │ ├── basic.test │ │ ├── dblab-hash-join.test │ │ ├── dblab-optimizer.test │ │ ├── dblab-sort.test │ │ ├── primary-aggregation-func.test │ │ ├── primary-complex-sub-query.test │ │ ├── primary-date.test │ │ ├── primary-drop-table.test │ │ ├── primary-expression.test │ │ ├── primary-group-by.test │ │ ├── primary-join-tables.test │ │ ├── primary-multi-index.test │ │ ├── primary-null.test │ │ ├── primary-order-by.test │ │ ├── primary-simple-sub-query.test │ │ ├── primary-text.test │ │ ├── primary-unique.test │ │ ├── primary-update.test │ │ ├── vectorized-aggregation-and-group-by.test │ │ └── vectorized-basic.test ├── integration_test │ ├── README.md │ ├── __init__.py │ ├── case_name_mapper.py │ ├── common │ │ ├── config_reader.py │ │ ├── mylog.py │ │ ├── myrc.py │ │ └── mytime_meter.py │ ├── conf.ini │ ├── libminiob_test.py │ ├── miniob │ │ ├── miniob_client.py │ │ └── miniob_server.py │ ├── miniob_adaptor.py │ ├── miniob_test_config.py │ ├── miniob_test_docker_entry.sh │ ├── miniob_test_util.py │ ├── mysql_adaptor.py │ ├── mysql_executor │ │ └── mysql_executor.py │ ├── test_case.py │ ├── test_case_checker.py │ ├── test_cases │ │ ├── MiniOB │ │ │ └── python │ │ │ │ ├── aggregation_func.py │ │ │ │ ├── basic.py │ │ │ │ ├── date.py │ │ │ │ ├── drop_table.py │ │ │ │ └── update.py │ │ └── README.md │ ├── test_config.py │ ├── test_exception.py │ ├── test_executor.py │ ├── test_info.py │ ├── test_initiator.py │ ├── test_instruction.py │ ├── test_request.py │ ├── test_response.py │ ├── test_result.py │ ├── test_suite.py │ ├── test_util.py │ ├── util │ │ ├── backtrace.py │ │ ├── mycompile.py │ │ ├── myshell.py │ │ └── myutil.py │ └── view_result_diff.py └── sysbench │ ├── miniob_common.lua │ ├── miniob_delete.lua │ ├── miniob_insert.lua │ └── miniob_select.lua ├── tools ├── CMakeLists.txt └── clog_dump.cpp └── unittest ├── CMakeLists.txt ├── common ├── CMakeLists.txt ├── bitmap_test.cpp ├── integer_generator_test.cpp ├── log_test.cpp ├── log_test.h ├── lower_bound_test.cpp ├── md5_test.cpp ├── md5_test.h ├── mem_pool_test.cpp ├── pidfile_test.cpp ├── serializer_test.cpp ├── simple_queue_test.cpp └── thread_pool_executor_test.cpp ├── memtracer ├── CMakeLists.txt └── memtracer_test.cpp ├── oblsm ├── CMakeLists.txt ├── ob_arena_test.cpp ├── ob_block_test.cpp ├── ob_bloomfilter_test.cpp ├── ob_compaction_test.cpp ├── ob_lru_cache_test.cpp ├── ob_lsm_manifest_test.cpp ├── ob_lsm_test.cpp ├── ob_lsm_test_base.h ├── ob_lsm_transaction_test.cpp ├── ob_lsm_wal_test.cpp ├── ob_skiplist_test.cpp ├── ob_table_test.cpp └── ob_util_test.cpp └── observer ├── CMakeLists.txt ├── aggregate_hash_table_test.cpp ├── arithmetic_operator_test.cpp ├── bp_manager_test.cpp ├── bplus_tree_log_entry_test.cpp ├── bplus_tree_log_test.cpp ├── bplus_tree_test.cpp ├── buffer_pool_log_test.cpp ├── catalog_test.cpp ├── chunk_test.cpp ├── codec_test.cpp ├── composite_tuple_test.cpp ├── disk_buffer_pool_test.cpp ├── disk_log_handler_test.cpp ├── double_write_buffer_test.cpp ├── expression_test.cpp ├── log_buffer_test.cpp ├── log_entry_test.cpp ├── log_file_test.cpp ├── mvcc_trx_log_test.cpp ├── parser_test.cpp ├── pax_storage_test.cpp ├── persist_test.cpp ├── record_manager_test.cpp └── ring_buffer_test.cpp /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "oceanbase/miniob" 3 | } 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | ** Environment** 14 | Environment Details sometimes important 15 | - OS Version: 16 | - CPU Arch(x86/arm): 17 | - Compiler: 18 | - Others: 19 | 20 | **Fast Reproduce Steps(Required)** 21 | Steps to reproduce the behavior: 22 | 23 | **Expected behavior** 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Actual Behavior** 27 | What is the result? picture is allowed 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement 3 | about: I want to make an enhancement. 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Enhancement** 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: I have a question. 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Question** 11 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### What problem were solved in this pull request? 2 | 3 | Issue Number: close #xxx 4 | 5 | Problem: 6 | 7 | ### What is changed and how it works? 8 | 9 | ### Other information 10 | -------------------------------------------------------------------------------- /.github/workflows/clang-format.yml: -------------------------------------------------------------------------------- 1 | name: Clang Format Checker 2 | on: 3 | pull_request: 4 | branches: [ "main" ] 5 | jobs: 6 | clang-format-checking: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - uses: RafikFarhad/clang-format-github-action@v3 11 | with: 12 | # sources 和 excludes 最终生成的find查找文件的命令大概是这样的 13 | # find . -type f ! -wholename "./src/observer/sql/parser/lex_sql.*" \( -wholename "./**/*.h" -o -wholename "./**/*.cpp" \) 14 | sources: "**/*.h,**/*.cpp,src/**/*.h,src/**/*.cpp" 15 | excludes: "src/observer/sql/parser/lex_sql.*,src/observer/sql/parser/yacc_sql.*,deps/3rd/**/*.cpp,deps/3rd/**/*.h" 16 | style: "file" 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | deps/3rd/* 2 | .vscode 3 | !.vscode/tasks.json 4 | !.vscode/launch.json 5 | .VSCodeCounter/* 6 | docs/doxy/ 7 | build/* 8 | build_* 9 | cmake-build-*/* 10 | build 11 | .cache/* 12 | .DS_Store 13 | .idea 14 | .ccls-cache 15 | compile_commands.json 16 | .name 17 | miniob.iml 18 | vcs.xml 19 | workspace.xml 20 | modules.xml 21 | GRTAGS 22 | GPATH 23 | GTAGS 24 | docs/book 25 | **/__pycache__ 26 | #*# 27 | 28 | # ignore generated files 29 | src/observer/sql/parser/lex_sql.cpp 30 | src/observer/sql/parser/lex_sql.h 31 | src/observer/sql/parser/yacc_sql.cpp 32 | src/observer/sql/parser/yacc_sql.hpp 33 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/3rd/libevent"] 2 | path = deps/3rd/libevent 3 | url = https://github.com/libevent/libevent 4 | [submodule "deps/3rd/jsoncpp"] 5 | path = deps/3rd/jsoncpp 6 | url = https://github.com/open-source-parsers/jsoncpp 7 | [submodule "deps/3rd/googletest"] 8 | path = deps/3rd/googletest 9 | url = https://github.com/google/googletest 10 | [submodule "deps/3rd/benchmark"] 11 | path = deps/3rd/benchmark 12 | url = https://github.com/google/benchmark 13 | [submodule "deps/3rd/replxx"] 14 | path = deps/3rd/replxx 15 | url = https://github.com/AmokHuginnsson/replxx 16 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | coreDump: 2 | enabled: true 3 | image: oceanbase/miniob:latest 4 | -------------------------------------------------------------------------------- /.scanignore: -------------------------------------------------------------------------------- 1 | docker/bin/starter-code.sh 2 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "init", 8 | "type": "shell", 9 | "command": "sudo -E env PATH=$PATH bash ${workspaceFolder}/build.sh init" 10 | }, 11 | { 12 | "label": "build_debug", 13 | "type": "shell", 14 | "command": "bash build.sh debug", 15 | "problemMatcher": [], 16 | "group": { 17 | "kind": "build", 18 | "isDefault": true 19 | } 20 | }, 21 | { 22 | "label": "build_release", 23 | "type": "shell", 24 | "command": "bash build.sh release" 25 | }, 26 | { 27 | "label": "gen_parser", 28 | "type": "shell", 29 | "command": "cd ${workspaceFolder}/src/observer/sql/parser && bash gen_parser.sh" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(benchmark CONFIG REQUIRED) 2 | 3 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/observer) 4 | 5 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 6 | # AUX_SOURCE_DIRECTORY 类似功能 7 | FOREACH (F ${ALL_SRC}) 8 | get_filename_component(prjName ${F} NAME_WE) 9 | MESSAGE("Build ${prjName} according to ${F}") 10 | ADD_EXECUTABLE(${prjName} ${F}) 11 | TARGET_LINK_LIBRARIES(${prjName} common pthread dl benchmark::benchmark) 12 | if(NOT ${prjName} STREQUAL "memtracer_performance_test") 13 | TARGET_LINK_LIBRARIES(${prjName} observer_static oblsm) 14 | endif() 15 | 16 | ENDFOREACH (F) 17 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # 构建 2 | docker-compose build 3 | 4 | # 启动容器 5 | docker-compose up -d 6 | 7 | -d 表示后台启动 8 | 9 | # 进入容器 10 | docker exec -it miniob bash 11 | -------------------------------------------------------------------------------- /docker/bin/starter-sshd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | HOST_KEY_DIR=/etc/ssh/ssh_host_rsa_key 4 | 5 | if [ -f /etc/.firstrun ]; then 6 | echo "root:root" | chpasswd 7 | rm -f /etc/.firstrun 8 | fi 9 | 10 | if [ -f /etc/ssh/sshd_config ]; then 11 | echo "PermitRootLogin yes" >> /etc/ssh/sshd_config 12 | service ssh restart 13 | fi 14 | 15 | if [ ! -f "${HOST_KEY_DIR}" ]; then 16 | ssh-keygen -A 17 | fi 18 | /usr/sbin/sshd 19 | 20 | echo sshd started! 21 | -------------------------------------------------------------------------------- /docker/bin/starter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -lld $HOME/docker/bin/*starter-* | awk '{print $9;}' | xargs -L 1 bash -c 3 | echo 'starter scripts run successfully!' 4 | tail -f /dev/null 5 | -------------------------------------------------------------------------------- /docker/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.3" 2 | services: 3 | miniob-dev: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | image: miniob:v1.1 8 | container_name: miniob 9 | privileged: true 10 | ports: 11 | - "10000:22" 12 | restart: unless-stopped 13 | environment: 14 | # set the env argument PRIVATE_KEY when using ssh clone 15 | # REPO_ADDR format in a private repo: https://:@github.com/oceanbase/miniob.git, '@' in username must be escape to '%40' 16 | # How to run: 17 | # Linux shell: 18 | # export PRIVATE_KEY=$(cat ~/.ssh/id_rsa) && docker-compose up -d --build 19 | # Windows powershell: 20 | # $env:PRIVATE_KEY=$(cat ~/.ssh/id_rsa) && docker-compose up -d --build 21 | - REPO_ADDR=https://github.com/oceanbase/miniob.git 22 | - PRIVATE_KEY=${PRIVATE_KEY} 23 | -------------------------------------------------------------------------------- /docs/docs/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/assets/favicon.ico -------------------------------------------------------------------------------- /docs/docs/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/assets/logo.png -------------------------------------------------------------------------------- /docs/docs/assets/mathjax.js: -------------------------------------------------------------------------------- 1 | window.MathJax = { 2 | tex: { 3 | inlineMath: [ ["\\(","\\)"], ['$', '$'] ], 4 | displayMath: [ ["\\[","\\]"], ['$$', '$$'] ], 5 | tags: 'ams' 6 | }, 7 | options: { 8 | ignoreHtmlClass: ".*|", 9 | processHtmlClass: "arithmatex" 10 | } 11 | }; -------------------------------------------------------------------------------- /docs/docs/blog/images/1-hekaton-storage-engine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-hekaton-storage-engine.png -------------------------------------------------------------------------------- /docs/docs/blog/images/1-range-index-bw-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-range-index-bw-tree.png -------------------------------------------------------------------------------- /docs/docs/blog/images/1-record-lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-record-lock.png -------------------------------------------------------------------------------- /docs/docs/blog/images/1-storage-engine-prototype.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-storage-engine-prototype.png -------------------------------------------------------------------------------- /docs/docs/blog/images/1-transaction-process-phases-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-transaction-process-phases-2.png -------------------------------------------------------------------------------- /docs/docs/blog/images/1-transaction-process-phases.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-transaction-process-phases.png -------------------------------------------------------------------------------- /docs/docs/blog/images/1-transaction-state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/blog/images/1-transaction-state.png -------------------------------------------------------------------------------- /docs/docs/blog/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 介绍 3 | --- 4 | 5 | MiniOB 博客放一些数据库技术实现原理相关的内容,有些来自[OceanBase](https://github.com/oceanbase) 内部分享的一些论文阅读笔记、技术分享、开发心得等,希望能够帮助大家了解数据库。 -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-config-clangd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-config-clangd.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-debug.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-install-clangd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-install-clangd.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-install-cppdbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-install-cppdbg.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-join-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-join-class.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-launch-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-launch-config.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-miniob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-miniob.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-openvscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-openvscode.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-startenv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-startenv.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setup-workspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setup-workspace.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/cloudlab-setupenv-checkdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/cloudlab-setupenv-checkdoc.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/hashjoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/hashjoin.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/miniob-lsmtree-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/miniob-lsmtree-overview.png -------------------------------------------------------------------------------- /docs/docs/db_course_lab/images/transaction-mvcc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/db_course_lab/images/transaction-mvcc.png -------------------------------------------------------------------------------- /docs/docs/design/images/bplus-tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/bplus-tree.jpg -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-deletion-migration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-deletion-migration.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-deletion-move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-deletion-move.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-deletion-move2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-deletion-move2.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-deletion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-deletion.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-index-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-index-file.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-internal-node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-internal-node.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-internal-struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-internal-struct.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-internal-struct2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-internal-struct2.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-leaf-node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-leaf-node.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-leaf-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-leaf-page.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-bplus-tree-pages-in-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-bplus-tree-pages-in-file.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-buffer-pool-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-buffer-pool-directory.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-buffer-pool-implementation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-buffer-pool-implementation.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-buffer-pool-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-buffer-pool-page.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-buffer-pool-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-buffer-pool-record.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-double-write-buffer-struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-double-write-buffer-struct.png -------------------------------------------------------------------------------- /docs/docs/design/images/miniob-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/miniob-overview.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-auth.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-command-packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-command-packet.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-error-packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-error-packet.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-flow.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-handshake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-handshake.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-ok-eof-packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-ok-eof-packet.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-ok-packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-ok-packet.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-packet-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-packet-flow.png -------------------------------------------------------------------------------- /docs/docs/design/images/mysql-result-set-packet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/mysql-result-set-packet.png -------------------------------------------------------------------------------- /docs/docs/design/images/thread-model-one-thread-per-connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/thread-model-one-thread-per-connection.png -------------------------------------------------------------------------------- /docs/docs/design/images/thread-model-thread-pool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/design/images/thread-model-thread-pool.png -------------------------------------------------------------------------------- /docs/docs/design/introduction.md: -------------------------------------------------------------------------------- 1 | # 功能模块设计说明 2 | 3 | - [Miniob架构](./miniob-architecture.md) 4 | - [存储实现](./miniob-buffer-pool.md) 5 | - [Double Write Buffer](./miniob-double-write-buffer.md) 6 | - [事务](./miniob-transaction.md) 7 | - [持久化](./miniob-durability.md) 8 | - [SQL Parser](./miniob-sql-parser.md) 9 | - [如何新增支持一种新类型SQL](./miniob-how-to-add-new-sql.md) 10 | - [表达式解析](./miniob-sql-expression.md) 11 | - [B+树实现](./miniob-bplus-tree.md) 12 | - [并发B+树实现](./miniob-bplus-tree-concurrency.md) 13 | - [线程池模型](./miniob-thread-model.md) 14 | - [通讯协议简介](./miniob-mysql-protocol.md) 15 | - [Doxy文档](./doxy/html/index.html) 16 | -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-breakpoint.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-build_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-build_debug.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-c_dependence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-c_dependence.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-clone_miniob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-clone_miniob.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-dev-containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-dev-containers.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-docker_desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-docker_desktop.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-miniob_build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-miniob_build.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-open-localfile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-open-localfile.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-vscode-contend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-vscode-contend.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev-containers-vscode-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev-containers-vscode-menu.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_github_codespaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_github_codespaces.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_build_init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_build_init.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_build_init_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_build_init_output.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_build_others.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_build_others.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_build_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_build_output.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_build_run_build_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_build_run_build_task.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_build_run_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_build_run_task.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_dashboard.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_debug_breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_debug_breakpoint.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_debug_console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_debug_console.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_debug_debugging_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_debug_debugging_view.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_debug_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_debug_start.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_debug_take_breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_debug_take_breakpoint.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_debug_terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_debug_terminal.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_fork_repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_fork_repo.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_auth.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_auth1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_auth1.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_commit.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_edit_permissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_edit_permissions.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_operations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_operations.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_pre_edit_permissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_pre_edit_permissions.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_git_push_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_git_push_error.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_gitpod_new_workspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_gitpod_new_workspace.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_ides.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_ides.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_miniob_workspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_miniob_workspace.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_open_gitpod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_open_gitpod.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_open_miniob.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_open_miniob.jpg -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_vscode_homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_vscode_homepage.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_by_gitpod_workspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_by_gitpod_workspace.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_Docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_Docker.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone_branch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone_branch.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone_done.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone_file_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_clone_file_info.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_downloadDocker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_downloadDocker.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_plugin.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_prepareDocker1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_prepareDocker1.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_prepareDocker2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_prepareDocker2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_prepareDocker3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_prepareDocker3.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_searchEnv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_searchEnv.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_searchEnv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_searchEnv2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_searchEnv3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_searchEnv3.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_1.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_3.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_docker_container_by_vscode_on_windows_startDocker_in_vscode_4.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_attach.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_attach.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_breakpoint.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_builddebug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_builddebug.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_content.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_debug.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_docker.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_process0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_process0.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_process100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_process100.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_stop.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/dev_in_vscode_GUI_with_docker_container_based_on_windows_task.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/docker_pull_timeout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/docker_pull_timeout.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/github_integration_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/github_integration_test.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_contact_us.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_contact_us.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_mainpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_mainpage.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_miniob_2024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_miniob_2024.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_miniob_2024_question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_miniob_2024_question.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_miniob_2024_question_detail1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_miniob_2024_question_detail1.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_miniob_2024_question_detail2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_miniob_2024_question_detail2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_miniob_2024_submit_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_miniob_2024_submit_code.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/train_miniob_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/train_miniob_result.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_add_new_ssh_host.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_add_new_ssh_host.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_config_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_config_file.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_container_started.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_container_started.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_cpp_extensions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_cpp_extensions.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_debug.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_kit_for_miniob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_kit_for_miniob.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_open_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_open_folder.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_pwd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_pwd.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_remote_ssh_connect_cmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_remote_ssh_connect_cmd.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_remote_ssh_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_remote_ssh_extension.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_server_started.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_server_started.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vsc_ssh_connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vsc_ssh_connect.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_C++_plugs_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_C++_plugs_detail.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_break_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_break_point.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_build_ouput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_build_ouput.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_cmake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_cmake.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_debug_miniob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_debug_miniob.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_clangd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_clangd.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab1.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab3.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_commit_lab4.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_config_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_config_docker.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_cppdbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_cppdbg.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_open_miniob2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_open_miniob2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_open_miniob_as_workspace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_open_miniob_as_workspace.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_run_docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_run_docker.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-config-clangd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-config-clangd.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-debug.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-install-clangd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-install-clangd.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-install-cppdbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-install-cppdbg.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-launch-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup-launch-config.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_check_status_ssh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_check_status_ssh.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_download_ubuntu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_download_ubuntu.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_sshd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_sshd.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu1.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu3.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu4.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu5.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu6.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu7.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu8.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu9.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_init_ubuntu_net.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_ssh_connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_ssh_connection.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_install_ssh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_install_ssh.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_new_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_new_file.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_new_remote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_new_remote.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_new_remote2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_new_remote2.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_workspcae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_dev_with_local_virtual_env_setup_vscode_workspcae.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/vscode_search_plugs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/vscode_search_plugs.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-enable-disable-functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-enable-disable-functions.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-enable-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-enable-service.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-functions.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-search-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-search-service.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-terminal-mutli-shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-terminal-mutli-shell.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-terminal.png -------------------------------------------------------------------------------- /docs/docs/dev-env/images/windows-wsl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/dev-env/images/windows-wsl.png -------------------------------------------------------------------------------- /docs/docs/game/debug-output.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 输出调试信息 3 | --- 4 | 5 | 本篇文档介绍如何向[训练营](https://open.oceanbase.com/train)输出调试信息。 6 | 7 | 在使用训练营提交测试时,有时候会遇到本地环境没有问题,但是训练营上的输出总是不符合预期。但是训练营没有办法调试,这时候就需要在训练营上输出调试信息,以便于定位问题。 8 | 9 | **如何输出调试信息** 10 | 11 | 可以参考文件 `sql_debug.h`,在需要输出调试信息的地方,调用`sql_debug`函数即可。sql_debug 的使用与打印日志类似,不过可以在向客户端输出正常结果后,再输出调试信息。 12 | 执行`sql_debug`同时会在日志中打印DEBUG级别的日志。 13 | 14 | **示例** 15 | 16 | 1. `CreateTableStmt::create` 17 | 2. `TableScanPhysicalOperator::next` 18 | 19 | **注意** 20 | 由于训练营上能够容纳的信息有限,所以输出太多信息会被截断。 21 | 22 | **开关** 23 | 24 | 每个连接都可以开启或关闭调试,可以参考 `Session::sql_debug_`。 25 | 26 | 在交互式命令行中,可以使用 `set sql_debug=1` 开启调试,使用 `set sql_debug=0` 关闭调试。 27 | 28 | > 当前没有实现查看变量的命令。 29 | 30 | 示例 31 | 32 | ```bash 33 | miniob > select * from t; 34 | id 35 | 1 36 | 37 | # get a tuple: 1 38 | miniob > set sql_debug=0; 39 | SUCCESS 40 | miniob > select * from t; 41 | id 42 | 1 43 | 44 | ``` 45 | 46 | 在训练营中,需要手动修改 `session.h` 文件中的代码来开启调试/关闭调试。 47 | ```c++ 48 | // 将 Session::sql_debug_ 设置为 false,关闭调试 49 | bool sql_debug_ = false; 50 | // 将 Session::sql_debug_ 设置为 true,开启调试 51 | bool sql_debug_ = true; 52 | ``` -------------------------------------------------------------------------------- /docs/docs/game/images/add-members.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/add-members.png -------------------------------------------------------------------------------- /docs/docs/game/images/create-repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/create-repo.png -------------------------------------------------------------------------------- /docs/docs/game/images/create-repo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/create-repo2.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-add-people.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-add-people.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-add-tester-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-add-tester-2.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-add-tester.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-add-tester.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-begin-import-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-begin-import-form.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-commit-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-commit-info.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-developer-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-developer-settings.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-fill-out-token-form.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-fill-out-token-form.jpg -------------------------------------------------------------------------------- /docs/docs/game/images/github-generate-new-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-generate-new-token.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-import-done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-import-done.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-import-repository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-import-repository.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-invite-success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-invite-success.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-pending-invite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-pending-invite.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-personal-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-personal-settings.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-save-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-save-token.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-validate-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-validate-token.png -------------------------------------------------------------------------------- /docs/docs/game/images/github-view-repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/github-view-repo.png -------------------------------------------------------------------------------- /docs/docs/game/images/invite-users.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/invite-users.png -------------------------------------------------------------------------------- /docs/docs/game/images/ivfflat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/ivfflat.png -------------------------------------------------------------------------------- /docs/docs/game/images/reporter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/game/images/reporter.png -------------------------------------------------------------------------------- /docs/docs/images/miniob-build-crlf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/images/miniob-build-crlf.png -------------------------------------------------------------------------------- /docs/docs/images/miniob-introduction-running-the-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/images/miniob-introduction-running-the-client.png -------------------------------------------------------------------------------- /docs/docs/images/miniob-introduction-running-the-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/images/miniob-introduction-running-the-server.png -------------------------------------------------------------------------------- /docs/docs/images/miniob-introduction-sql-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/images/miniob-introduction-sql-flow.png -------------------------------------------------------------------------------- /docs/docs/lectures/copyright.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 版权声明 3 | --- 4 | 5 | # 版权声明 6 | 7 | 本版权声明仅针对《数据库管理系统实现基础讲义》(以下简称“本教材”)的所有内容。 8 | 9 | 1. 本教材刊载的所有内容,包括但不限于文字报道、图片、视频、图表、标志标识、商标、版面设计、专栏目录与名称、内容分类标准等,均受《中华人民共和国著作权法》、《中华人民共和国商标法》、《中华人民共和国专利法》及适用之国际公约中有关著作权、商标权、专利权以及或其它财产所有权法律的保护,相应的版权或许可使用权均属华中科技大学谢美意老师、左琼老师所有。 10 | 2. 凡未经华中科技大学谢美意老师、左琼老师授权,任何媒体、网站及个人不得转载、复制、重制、改动、展示或使用《数据库管理系统实现基础讲义》的局部或全部的内容。如果已转载,请自行删除。同时,我们保留进一步追究相关行为主体的法律责任的权利。 11 | 3. 本教材刊载的所有内容授权给北京奥星贝斯科技有限公司。 12 | 13 | -------------------------------------------------------------------------------- /docs/docs/lectures/images/1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/1-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/1.3.1.3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/1.3.1.3-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/1.3.1.3-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/1.3.1.3-2.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-2.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-3.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-4.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-5.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-6.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-7.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/2-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/2-8.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-2-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-2-a.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-2-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-2-b.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-2-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-2-c.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-3-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-3-a.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-3-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-3-b.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-3-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-3-c.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-4.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-5.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-6-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-6-a.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-6-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-6-b.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-7-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-7-a.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-7-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-7-b.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/3-7-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/3-7-c.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/4-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/4-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/4-2.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/4-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/4-3.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/4-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/4-4.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/4-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/4-5.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/4-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/4-6.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5.2.1.1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5.2.1.1-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5.2.1.1-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5.2.1.1-2.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5.2.1.1-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5.2.1.1-3.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5.2.1.1-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5.2.1.1-4.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5.2.2.1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5.2.2.1-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/5.3.1.1-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/5.3.1.1-4.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/6-1.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/6-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/6-2.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/6-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/6-3.png -------------------------------------------------------------------------------- /docs/docs/lectures/images/6-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/docs/docs/lectures/images/6-4.png -------------------------------------------------------------------------------- /docs/docs/lectures/index.md: -------------------------------------------------------------------------------- 1 | # 数据库管理系统实现基础讲义 2 | 3 | 作者 华中科技大学谢美意 左琼 4 | 5 | [版权声明](copyright.md) 6 | 7 | [第1章 数据库管理系统概述](lecture-1.md) 8 | 9 | [第2章 数据库的存储结构](lecture-2.md) 10 | 11 | [第3章 索引结构](lecture-3.md) 12 | 13 | [第4章 查询处理](lecture-4.md) 14 | 15 | [第5章 查询优化](lecture-5.md) 16 | 17 | [第6章 事务处理](lecture-6.md) 18 | 19 | [参考资料](references.md) 20 | -------------------------------------------------------------------------------- /docs/docs/lectures/references.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 参考资料 3 | --- 4 | 5 | # 参考资料 6 | 7 | 1. 王珊, 萨师煊. 数据库系统概论(第5版). 北京: 高等教育出版社, 2014 8 | 2. Hector Garcia-Mlina, Jeffrey D. Ullman, Jennifer Widom. 杨冬青 等译. 数据库系统实现. 北京: 机械工业出版社, 2010 9 | 3. Abraham Silberschatz, Henry F.Korth, S. Sudarshan. 杨冬青 等译. 数据库系统概念(第6版). 北京: 机械工业出版社, 2012 10 | 4. 李海翔. 数据库查询优化器的艺术原理解析与SQL性能优化. 北京: 机械工业出版社, 2014 11 | 5. [CMU 15445](https://15445.courses.cs.cmu.edu/fall2020/schedule.html) 12 | 13 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | mkdocs-material 2 | mkdocs-git-authors-plugin 3 | mkdocs-glightbox -------------------------------------------------------------------------------- /etc/observer.ini: -------------------------------------------------------------------------------- 1 | # observer's configuration 2 | 3 | # log part 4 | [LOG] 5 | # log file's name, default is ${process_name_}.log 6 | LOG_FILE_NAME = observer.log 7 | # LOG_LEVEL_PANIC = 0, 8 | # LOG_LEVEL_ERR = 1, 9 | # LOG_LEVEL_WARN = 2, 10 | # LOG_LEVEL_INFO = 3, 11 | # LOG_LEVEL_DEBUG = 4, 12 | # LOG_LEVEL_TRACE = 5, 13 | # LOG_LEVEL_LAST 14 | # output log level, default is LOG_LEVEL_INFO 15 | LOG_FILE_LEVEL=5 16 | LOG_CONSOLE_LEVEL=1 17 | # the module's log will output whatever level used. 18 | #DefaultLogModules="server.cpp,client.cpp" 19 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(common) 2 | ADD_SUBDIRECTORY(observer) 3 | ADD_SUBDIRECTORY(obclient) 4 | ADD_SUBDIRECTORY(oblsm) 5 | if (WITH_CPPLINGS) 6 | ADD_SUBDIRECTORY(cpplings) 7 | endif() 8 | 9 | if (WITH_MEMTRACER) 10 | ADD_SUBDIRECTORY(memtracer) 11 | endif() 12 | -------------------------------------------------------------------------------- /src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 4 | 5 | #SHARED,动态库 6 | #STATIC,静态库 7 | ADD_LIBRARY(common STATIC ${ALL_SRC} ) 8 | 9 | 10 | IF(USE_MUSL_LIBC) 11 | MESSAGE(STATUS "musl libc need manually link libexecinfo") 12 | TARGET_LINK_LIBRARIES(common execinfo) 13 | ENDIF(USE_MUSL_LIBC) 14 | 15 | TARGET_LINK_LIBRARIES(common replxx::replxx) 16 | MESSAGE(STATUS "common uses replxx") 17 | 18 | # 编译静态库时,自动会把同名的动态库给删除, 因此需要临时设置一下 19 | SET_TARGET_PROPERTIES(common PROPERTIES CLEAN_DIRECT_OUTPUT 1) 20 | 21 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) 22 | 23 | -------------------------------------------------------------------------------- /src/common/lang/algorithm.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::max; 16 | using std::min; 17 | using std::swap; 18 | using std::transform; 19 | -------------------------------------------------------------------------------- /src/common/lang/array.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::array; -------------------------------------------------------------------------------- /src/common/lang/atomic.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::atomic; 16 | using std::atomic_bool; -------------------------------------------------------------------------------- /src/common/lang/bitset.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::bitset; -------------------------------------------------------------------------------- /src/common/lang/charconv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/system_error.h" 16 | 17 | using std::from_chars; 18 | using std::from_chars_result; 19 | -------------------------------------------------------------------------------- /src/common/lang/chrono.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace chrono = std::chrono; 16 | -------------------------------------------------------------------------------- /src/common/lang/cmath.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | #pragma once 11 | 12 | #include 13 | 14 | using std::round; -------------------------------------------------------------------------------- /src/common/lang/comparator.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by wangyunlai on 2021/6/11 13 | // 14 | 15 | #pragma once 16 | 17 | namespace common { 18 | 19 | int compare_int(void *arg1, void *arg2); 20 | int compare_float(void *arg1, void *arg2); 21 | int compare_string(void *arg1, int arg1_max_length, void *arg2, int arg2_max_length); 22 | 23 | } // namespace common -------------------------------------------------------------------------------- /src/common/lang/condition_variable.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::condition_variable; 16 | -------------------------------------------------------------------------------- /src/common/lang/deque.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::deque; -------------------------------------------------------------------------------- /src/common/lang/exception.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::exception; -------------------------------------------------------------------------------- /src/common/lang/filesystem.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/system_error.h" 16 | 17 | namespace filesystem = std::filesystem; 18 | -------------------------------------------------------------------------------- /src/common/lang/fstream.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/new.h" 16 | #include "common/lang/ios.h" 17 | #include "common/lang/exception.h" 18 | 19 | using std::fstream; 20 | using std::ifstream; 21 | using std::ofstream; -------------------------------------------------------------------------------- /src/common/lang/functional.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::equal_to; 16 | using std::function; 17 | using std::hash; 18 | // using std::bind; // conflict with socket::bind 19 | using std::ref; 20 | -------------------------------------------------------------------------------- /src/common/lang/initializer_list.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::initializer_list; 16 | -------------------------------------------------------------------------------- /src/common/lang/iomanip.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::setfill; 16 | using std::setw; -------------------------------------------------------------------------------- /src/common/lang/ios.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::ios; 16 | using std::ios_base; 17 | using std::streamoff; 18 | using std::streampos; 19 | -------------------------------------------------------------------------------- /src/common/lang/iostream.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/exception.h" 16 | #include "common/lang/ios.h" 17 | #include "common/lang/new.h" 18 | 19 | using std::cerr; 20 | using std::cin; 21 | using std::cout; 22 | using std::endl; 23 | using std::istream; 24 | using std::ostream; -------------------------------------------------------------------------------- /src/common/lang/iterator.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::advance; 16 | using std::distance; 17 | using std::random_access_iterator_tag; -------------------------------------------------------------------------------- /src/common/lang/limits.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::numeric_limits; 16 | -------------------------------------------------------------------------------- /src/common/lang/list.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::list; -------------------------------------------------------------------------------- /src/common/lang/map.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/utility.h" 16 | 17 | using std::map; -------------------------------------------------------------------------------- /src/common/lang/memory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::enable_shared_from_this; 16 | using std::make_shared; 17 | using std::make_unique; 18 | using std::shared_ptr; 19 | using std::unique_ptr; -------------------------------------------------------------------------------- /src/common/lang/new.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/exception.h" 16 | 17 | using std::nothrow; -------------------------------------------------------------------------------- /src/common/lang/queue.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::queue; -------------------------------------------------------------------------------- /src/common/lang/random.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::mt19937; 16 | using std::random_device; 17 | using std::uniform_int_distribution; -------------------------------------------------------------------------------- /src/common/lang/ranges.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace ranges = std::ranges; 17 | -------------------------------------------------------------------------------- /src/common/lang/set.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::set; -------------------------------------------------------------------------------- /src/common/lang/span.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::span; -------------------------------------------------------------------------------- /src/common/lang/sstream.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "common/lang/exception.h" 16 | 17 | using std::istringstream; 18 | using std::ostringstream; 19 | using std::stringstream; -------------------------------------------------------------------------------- /src/common/lang/stack.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::stack; -------------------------------------------------------------------------------- /src/common/lang/stdexcept.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::runtime_error; -------------------------------------------------------------------------------- /src/common/lang/string_view.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::string_view; 16 | -------------------------------------------------------------------------------- /src/common/lang/system_error.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::errc; 16 | using std::error_code; 17 | -------------------------------------------------------------------------------- /src/common/lang/thread.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::thread; 16 | namespace this_thread = std::this_thread; -------------------------------------------------------------------------------- /src/common/lang/tuple.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::tuple; 16 | -------------------------------------------------------------------------------- /src/common/lang/unordered_map.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::unordered_map; -------------------------------------------------------------------------------- /src/common/lang/unordered_set.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::unordered_set; 16 | 17 | template 18 | static bool is_subset(const unordered_set &super_set, const unordered_set &child_set) 19 | { 20 | for (const auto &element : child_set) { 21 | if (super_set.find(element) == super_set.end()) { 22 | return false; 23 | } 24 | } 25 | return true; 26 | } -------------------------------------------------------------------------------- /src/common/lang/utility.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::pair; -------------------------------------------------------------------------------- /src/common/lang/vector.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | using std::vector; -------------------------------------------------------------------------------- /src/common/log/backtrace.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by WangYunlai on 2024 13 | // 14 | 15 | #pragma once 16 | 17 | namespace common { 18 | 19 | int backtrace_init(); 20 | 21 | const char *lbt(); 22 | 23 | } // namespace common 24 | -------------------------------------------------------------------------------- /src/common/math/crc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wenbin on 2024/3/25. 13 | // 14 | 15 | #pragma once 16 | 17 | /// 计算buffer的crc校验码 18 | unsigned int crc32(const char *buffer, unsigned int size); 19 | -------------------------------------------------------------------------------- /src/common/math/random_generator.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/20. 13 | // 14 | #pragma once 15 | 16 | #include 17 | 18 | #include "common/lang/random.h" 19 | 20 | namespace common { 21 | 22 | #define DEFAULT_RANDOM_BUFF_SIZE 512 23 | 24 | class RandomGenerator 25 | { 26 | 27 | public: 28 | RandomGenerator(); 29 | virtual ~RandomGenerator(); 30 | 31 | public: 32 | unsigned int next(); 33 | unsigned int next(unsigned int range); 34 | 35 | private: 36 | // The GUN Extended TLS Version 37 | mt19937 randomData; 38 | }; 39 | 40 | } // namespace common 41 | -------------------------------------------------------------------------------- /src/common/math/regex.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2010 13 | // 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "common/math/regex.h" 20 | namespace common { 21 | 22 | int regex_match(const char *str_, const char *pat_) 23 | { 24 | regex_t reg; 25 | if (regcomp(®, pat_, REG_EXTENDED | REG_NOSUB)) 26 | return -1; 27 | 28 | int ret = regexec(®, str_, 0, NULL, 0); 29 | regfree(®); 30 | return ret; 31 | } 32 | 33 | } // namespace common -------------------------------------------------------------------------------- /src/common/math/regex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2010 13 | // 14 | 15 | #pragma once 16 | 17 | namespace common { 18 | 19 | int regex_match(const char *str_, const char *pat_); 20 | 21 | } // namespace common 22 | -------------------------------------------------------------------------------- /src/common/math/simd_util.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #if defined(USE_SIMD) 14 | #include 15 | 16 | static constexpr int SIMD_WIDTH = 8; // AVX2 (256bit) 17 | 18 | /// @brief 从 vec 中提取下标为 i 的 int 类型的值。 19 | int mm256_extract_epi32_var_indx(const __m256i vec, const unsigned int i); 20 | 21 | /// @brief 数组求和 22 | int mm256_sum_epi32(const int *values, int size); 23 | float mm256_sum_ps(const float *values, int size); 24 | 25 | /// @brief selective load 的标量实现 26 | template 27 | void selective_load(V *memory, int offset, V *vec, __m256i &inv); 28 | #endif -------------------------------------------------------------------------------- /src/common/os/os.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2010 13 | // 14 | 15 | #pragma once 16 | 17 | namespace common { 18 | 19 | uint32_t getCpuNum(); 20 | 21 | void print_stacktrace(); 22 | 23 | } // namespace common 24 | -------------------------------------------------------------------------------- /src/common/sys/rc.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2021/5/14. 13 | // 14 | 15 | #include "common/sys/rc.h" 16 | 17 | const char *strrc(RC rc) 18 | { 19 | #define DEFINE_RC(name) \ 20 | case RC::name: { \ 21 | return #name; \ 22 | } break; 23 | 24 | switch (rc) { 25 | DEFINE_RCS; 26 | default: { 27 | return "unknown"; 28 | } 29 | } 30 | #undef DEFINE_RC 31 | } 32 | 33 | bool OB_SUCC(RC rc) { return rc == RC::SUCCESS; } 34 | 35 | bool OB_FAIL(RC rc) { return rc != RC::SUCCESS; } 36 | -------------------------------------------------------------------------------- /src/common/thread/thread_util.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/01/15. 13 | // 14 | 15 | #include 16 | #include 17 | 18 | namespace common { 19 | 20 | int thread_set_name(const char *name) 21 | { 22 | const int namelen = 16; 23 | char buf[namelen]; 24 | snprintf(buf, namelen, "%s", name); 25 | 26 | #ifdef __APPLE__ 27 | return pthread_setname_np(buf); 28 | #elif __linux__ 29 | return pthread_setname_np(pthread_self(), buf); 30 | #endif 31 | } 32 | 33 | } // namespace common -------------------------------------------------------------------------------- /src/common/thread/thread_util.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/01/15. 13 | // 14 | 15 | #pragma once 16 | 17 | namespace common { 18 | 19 | /** 20 | * @brief 设置当前线程的名字 21 | * @details 设置当前线程的名字可以帮助调试多线程程序,比如在gdb或者 top -H命令可以看到线程名字。 22 | * pthread_setname_np在Linux和Mac上实现不同。Linux上可以指定线程号设置名称,但是Mac上不行。 23 | * @param name 线程的名字。按照linux手册中描述,包括\0在内,不要超过16个字符 24 | * @return int 设置成功返回0 25 | */ 26 | int thread_set_name(const char *name); 27 | 28 | } // namespace common -------------------------------------------------------------------------------- /src/cpplings/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | function(add_custom_executable target_name) 2 | add_executable(${target_name} ${ARGN}) 3 | 4 | set_target_properties(${target_name} PROPERTIES 5 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/cpplings" 6 | ) 7 | target_link_libraries(${target_name} PRIVATE pthread) 8 | endfunction() 9 | 10 | add_custom_executable(cas cas.cpp) 11 | add_custom_executable(condition_variable condition_variable.cpp) 12 | add_custom_executable(lambda lambda.cpp) 13 | add_custom_executable(lock lock.cpp) 14 | add_custom_executable(mutex mutex.cpp) 15 | add_custom_executable(smart_pointer smart_pointer.cpp) 16 | add_custom_executable(template template.cpp) 17 | add_custom_executable(stl stl.cpp) 18 | -------------------------------------------------------------------------------- /src/memtracer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(CheckCXXCompilerFlag) 2 | 3 | file(GLOB MEMTRACER_SOURCES "*.cpp") 4 | 5 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) 6 | add_library(memtracer SHARED ${MEMTRACER_SOURCES}) 7 | #ignore missing attributes 8 | #ref jemalloc: https://github.com/jemalloc/jemalloc/blob/master/configure.ac 9 | CHECK_CXX_COMPILER_FLAG("-Wno-missing-attributes" COMPILER_SUPPORTS_NO_MISSING_ATTRIBUTES) 10 | if(COMPILER_SUPPORTS_NO_MISSING_ATTRIBUTES) 11 | target_compile_options(memtracer PRIVATE -Wno-missing-attributes) 12 | endif() 13 | 14 | # hidden memtracer internal interfaces 15 | set_target_properties(memtracer PROPERTIES 16 | CXX_VISIBILITY_PRESET hidden 17 | VISIBILITY_INLINES_HIDDEN YES 18 | ) 19 | target_link_libraries(memtracer pthread) -------------------------------------------------------------------------------- /src/memtracer/common.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include 12 | #include 13 | #include "memtracer/common.h" 14 | 15 | namespace memtracer { 16 | void log_stderr(const char *format, ...) 17 | { 18 | va_list vl; 19 | va_start(vl, format); 20 | vfprintf(stderr, format, vl); 21 | va_end(vl); 22 | } 23 | 24 | } // namespace memtracer -------------------------------------------------------------------------------- /src/memtracer/mt_info.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | #include "memtracer.h" 11 | #include "mt_info.h" 12 | 13 | namespace memtracer { 14 | 15 | mt_visible size_t allocated_memory() { return MT.allocated_memory(); } 16 | 17 | mt_visible size_t meta_memory() { return MT.meta_memory(); } 18 | 19 | mt_visible size_t memory_limit() { return MT.memory_limit(); } 20 | } // namespace memtracer 21 | -------------------------------------------------------------------------------- /src/memtracer/mt_info.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #define mt_visible __attribute__((visibility("default"))) 12 | 13 | namespace memtracer { 14 | mt_visible size_t allocated_memory(); 15 | 16 | mt_visible size_t meta_memory(); 17 | 18 | mt_visible size_t memory_limit(); 19 | } // namespace memtracer -------------------------------------------------------------------------------- /src/obclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(obclient) 2 | MESSAGE("Begin to build " obclient) 3 | 4 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 5 | FOREACH (F ${ALL_SRC}) 6 | 7 | SET(PRJ_SRC ${PRJ_SRC} ${F}) 8 | MESSAGE("Use " ${F}) 9 | 10 | ENDFOREACH (F) 11 | 12 | TARGET_SOURCES(obclient PRIVATE ${PRJ_SRC}) 13 | TARGET_LINK_LIBRARIES(obclient common pthread dl) 14 | 15 | # Target 必须在定义 ADD_EXECUTABLE 之后, programs 不受这个限制 16 | # TARGETS和PROGRAMS 的默认权限是OWNER_EXECUTE, GROUP_EXECUTE, 和WORLD_EXECUTE,即755权限, programs 都是处理脚步类 17 | # 类型分为RUNTIME/LIBRARY/ARCHIVE, prog 18 | INSTALL(TARGETS obclient RUNTIME DESTINATION bin) 19 | -------------------------------------------------------------------------------- /src/oblsm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE OBLSM_SOURCES "*.cpp") 2 | file(GLOB CLIUTIL_SOURCES "client/cliutil/*.cpp") 3 | list(FILTER OBLSM_SOURCES EXCLUDE REGEX "client/.*") 4 | list(FILTER OBLSM_SOURCES EXCLUDE REGEX "benchmarks/.*") 5 | 6 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) 7 | add_library(oblsm STATIC ${OBLSM_SOURCES}) 8 | message("OBLSM_SOURCES: ${OBLSM_SOURCES}") 9 | 10 | FIND_PACKAGE(jsoncpp CONFIG REQUIRED) 11 | 12 | TARGET_LINK_LIBRARIES(oblsm common pthread JsonCpp::JsonCpp) 13 | 14 | ADD_EXECUTABLE(oblsm_cli ${CLIUTIL_SOURCES} client/ob_lsm_client.cpp) 15 | 16 | TARGET_LINK_LIBRARIES(oblsm_cli oblsm) 17 | 18 | ADD_EXECUTABLE(oblsm_bench benchmarks/ob_lsm_bench.cpp) 19 | TARGET_LINK_LIBRARIES(oblsm_bench oblsm) 20 | -------------------------------------------------------------------------------- /src/oblsm/benchmarks/ob_lsm_bench.cpp: -------------------------------------------------------------------------------- 1 | // TODO: add oblsm bench tool, reference leveldb db_bench 2 | int main() { return 0; } -------------------------------------------------------------------------------- /src/oblsm/compaction/ob_compaction.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "oblsm/compaction/ob_compaction.h" 12 | 13 | namespace oceanbase {} // namespace oceanbase -------------------------------------------------------------------------------- /src/oblsm/ob_lsm_define.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | namespace oceanbase { 13 | 14 | static constexpr const char *SSTABLE_SUFFIX = ".sst"; 15 | static constexpr const char *MANIFEST_SUFFIX = ".mf"; 16 | static constexpr const char *WAL_SUFFIX = ".wal"; 17 | 18 | /** 19 | * @enum CompactionType 20 | * @brief Defines the types of compaction strategies in an LSM-Tree or similar systems. 21 | */ 22 | enum class CompactionType 23 | { 24 | TIRED = 0, 25 | LEVELED, 26 | UNKNOWN, 27 | }; 28 | 29 | } // namespace oceanbase -------------------------------------------------------------------------------- /src/oblsm/table/ob_merger.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "common/lang/vector.h" 14 | #include "common/lang/memory.h" 15 | 16 | namespace oceanbase { 17 | 18 | class ObComparator; 19 | class ObLsmIterator; 20 | 21 | /** 22 | * @brief Return an iterator that provided the union of the data in 23 | * children. For example, an iterator that provided 24 | * the union of memtable and sstable. 25 | * 26 | */ 27 | ObLsmIterator *new_merging_iterator(const ObComparator *comparator, vector> &&children); 28 | 29 | } // namespace oceanbase 30 | -------------------------------------------------------------------------------- /src/oblsm/util/ob_arena.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #include "oblsm/util/ob_arena.h" 6 | 7 | namespace oceanbase { 8 | 9 | ObArena::ObArena() : memory_usage_(0) {} 10 | 11 | ObArena::~ObArena() 12 | { 13 | for (size_t i = 0; i < blocks_.size(); i++) { 14 | delete[] blocks_[i]; 15 | } 16 | } 17 | 18 | } // namespace oceanbase 19 | -------------------------------------------------------------------------------- /src/oblsm/util/ob_bloomfilter.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "oblsm/util/ob_bloomfilter.h" 12 | 13 | namespace oceanbase {} // namespace oceanbase 14 | -------------------------------------------------------------------------------- /src/oblsm/util/ob_lru_cache.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "oblsm/util/ob_lru_cache.h" 12 | 13 | namespace oceanbase {} // namespace oceanbase 14 | -------------------------------------------------------------------------------- /src/oblsm/wal/ob_lsm_wal.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "oblsm/wal/ob_lsm_wal.h" 12 | #include "common/log/log.h" 13 | #include "oblsm/util/ob_file_reader.h" 14 | 15 | namespace oceanbase { 16 | RC WAL::recover(const std::string &wal_file, std::vector &wal_records) 17 | { 18 | return RC::UNIMPLEMENTED; 19 | } 20 | 21 | RC WAL::put(uint64_t seq, string_view key, string_view val) 22 | { 23 | return RC::UNIMPLEMENTED; 24 | } 25 | } // namespace oceanbase -------------------------------------------------------------------------------- /src/observer/catalog/catalog.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "catalog/catalog.h" 12 | 13 | const TableStats &Catalog::get_table_stats(int table_id) 14 | { 15 | lock_guard lock(mutex_); 16 | return table_stats_[table_id]; 17 | } 18 | 19 | void Catalog::update_table_stats(int table_id, const TableStats &table_stats) 20 | { 21 | lock_guard lock(mutex_); 22 | table_stats_[table_id] = table_stats; 23 | } -------------------------------------------------------------------------------- /src/observer/common/global_context.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/5/29. 13 | // 14 | 15 | #include "common/global_context.h" 16 | 17 | static GlobalContext global_context; 18 | 19 | GlobalContext &GlobalContext::instance() { return global_context; } 20 | -------------------------------------------------------------------------------- /src/observer/common/ini_setting.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/14. 13 | // 14 | 15 | #pragma once 16 | 17 | //! this document is used for ini setting 18 | 19 | #define CLIENT_ADDRESS "CLIENT_ADDRESS" 20 | #define MAX_CONNECTION_NUM "MAX_CONNECTION_NUM" 21 | #define MAX_CONNECTION_NUM_DEFAULT 8192 22 | #define PORT "PORT" 23 | #define PORT_DEFAULT 6789 24 | 25 | #define SOCKET_BUFFER_SIZE 8192 26 | 27 | #define SESSION_STAGE_NAME "SessionStage" 28 | -------------------------------------------------------------------------------- /src/observer/common/init.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/5/3. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/conf/ini.h" 18 | #include "common/os/process_param.h" 19 | 20 | int init(common::ProcessParam *processParam); 21 | void cleanup(); 22 | -------------------------------------------------------------------------------- /src/observer/common/type/attr_type.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | /** 14 | * @brief 属性的类型 15 | * @details AttrType 枚举列出了属性的各种数据类型。 16 | */ 17 | enum class AttrType 18 | { 19 | UNDEFINED, 20 | CHARS, ///< 字符串类型 21 | INTS, ///< 整数类型(4字节) 22 | FLOATS, ///< 浮点数类型(4字节) 23 | VECTORS, ///< 向量类型 24 | BOOLEANS, ///< boolean类型,当前不是由parser解析出来的,是程序内部使用的 25 | MAXTYPE, ///< 请在 UNDEFINED 与 MAXTYPE 之间增加新类型 26 | }; 27 | 28 | const char *attr_type_to_string(AttrType type); 29 | AttrType attr_type_from_string(const char *s); 30 | -------------------------------------------------------------------------------- /src/observer/common/type/data_type.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "common/type/char_type.h" 12 | #include "common/type/float_type.h" 13 | #include "common/type/integer_type.h" 14 | #include "common/type/data_type.h" 15 | #include "common/type/vector_type.h" 16 | 17 | array, static_cast(AttrType::MAXTYPE)> DataType::type_instances_ = { 18 | make_unique(AttrType::UNDEFINED), 19 | make_unique(), 20 | make_unique(), 21 | make_unique(), 22 | make_unique(), 23 | make_unique(AttrType::BOOLEANS), 24 | }; -------------------------------------------------------------------------------- /src/observer/event/session_event.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #include "session_event.h" 16 | #include "net/communicator.h" 17 | 18 | SessionEvent::SessionEvent(Communicator *comm) : communicator_(comm), sql_result_(communicator_->session()) {} 19 | 20 | SessionEvent::~SessionEvent() {} 21 | 22 | Communicator *SessionEvent::get_communicator() const { return communicator_; } 23 | 24 | Session *SessionEvent::session() const { return communicator_->session(); } 25 | -------------------------------------------------------------------------------- /src/observer/event/sql_event.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/14. 13 | // 14 | 15 | #include "event/sql_event.h" 16 | 17 | #include "event/session_event.h" 18 | #include "sql/stmt/stmt.h" 19 | 20 | SQLStageEvent::SQLStageEvent(SessionEvent *event, const string &sql) : session_event_(event), sql_(sql) {} 21 | 22 | SQLStageEvent::~SQLStageEvent() noexcept 23 | { 24 | if (session_event_ != nullptr) { 25 | session_event_ = nullptr; 26 | } 27 | 28 | if (stmt_ != nullptr) { 29 | delete stmt_; 30 | stmt_ = nullptr; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/observer/event/storage_event.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/14. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/seda/stage_event.h" 18 | 19 | class SQLStageEvent; 20 | 21 | class StorageEvent : public common::StageEvent 22 | { 23 | public: 24 | StorageEvent(SQLStageEvent *sql_event) : sql_event_(sql_event) {} 25 | 26 | virtual ~StorageEvent(); 27 | 28 | SQLStageEvent *sql_event() const { return sql_event_; } 29 | 30 | private: 31 | SQLStageEvent *sql_event_; 32 | }; 33 | -------------------------------------------------------------------------------- /src/observer/mainpage.md: -------------------------------------------------------------------------------- 1 | # MiniOB 2 | 3 | MiniOB 是 OceanBase 与华中科技大学联合开发的、面向"零"基础同学的数据库入门学习项目。 4 | 5 | MiniOB 设计的目标是面向在校学生、数据库从业者、爱好者,或者对基础技术有兴趣的爱好者, 整体代码量少,易于上手并学习, 是一个系统性的数据库学习项目。miniob 设置了一系列由浅入深的题目,以帮助同学们"零"基础入门, 让同学们快速了解数据库并深入学习数据库内核,期望通过相关训练之后,能够熟练掌握数据库内核模块的功能与协同关系, 并能够在使用数据库时,设计出高效的 SQL 。miniob 为了更好的学习数据库实现原理, 对诸多模块都做了简化,比如不考虑并发操作, 安全特性, 复杂的事物管理等功能。 -------------------------------------------------------------------------------- /src/observer/session/thread_data.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/03/07. 13 | // 14 | 15 | #include "session/thread_data.h" 16 | #include "session/session.h" 17 | 18 | thread_local ThreadData *ThreadData::thread_data_; 19 | 20 | Trx *ThreadData::trx() const { return (session_ == nullptr) ? nullptr : session_->current_trx(); } -------------------------------------------------------------------------------- /src/observer/sql/executor/analyze_table_executor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "common/sys/rc.h" 14 | 15 | class SQLStageEvent; 16 | class RecordScanner; 17 | 18 | /** 19 | * @brief 分析表的执行器(analyze table) 20 | * @ingroup Executor 21 | */ 22 | class AnalyzeTableExecutor 23 | { 24 | public: 25 | AnalyzeTableExecutor() = default; 26 | virtual ~AnalyzeTableExecutor(); 27 | 28 | RC execute(SQLStageEvent *sql_event); 29 | 30 | private: 31 | RecordScanner *scanner_ = nullptr; 32 | }; 33 | -------------------------------------------------------------------------------- /src/observer/sql/executor/command_executor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/4/25. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @defgroup Executor 23 | * @brief 一些SQL语句不会生成对应的执行计划,直接使用Executor来执行,比如DDL语句 24 | */ 25 | 26 | /** 27 | * @brief 执行器 28 | * @ingroup Executor 29 | */ 30 | class CommandExecutor 31 | { 32 | public: 33 | CommandExecutor() = default; 34 | virtual ~CommandExecutor() = default; 35 | 36 | RC execute(SQLStageEvent *sql_event); 37 | }; 38 | -------------------------------------------------------------------------------- /src/observer/sql/executor/create_index_executor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/4/25. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @brief 创建索引的执行器 23 | * @ingroup Executor 24 | * @note 创建索引时不能做其它操作。MiniOB当前不完善,没有对一些并发做控制,包括schema的并发。 25 | */ 26 | class CreateIndexExecutor 27 | { 28 | public: 29 | CreateIndexExecutor() = default; 30 | virtual ~CreateIndexExecutor() = default; 31 | 32 | RC execute(SQLStageEvent *sql_event); 33 | }; 34 | -------------------------------------------------------------------------------- /src/observer/sql/executor/create_table_executor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/6/13. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @brief 创建表的执行器 23 | * @ingroup Executor 24 | */ 25 | class CreateTableExecutor 26 | { 27 | public: 28 | CreateTableExecutor() = default; 29 | virtual ~CreateTableExecutor() = default; 30 | 31 | RC execute(SQLStageEvent *sql_event); 32 | }; 33 | -------------------------------------------------------------------------------- /src/observer/sql/executor/desc_table_executor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/6/14. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @brief 描述表的执行器 23 | * @ingroup Executor 24 | */ 25 | class DescTableExecutor 26 | { 27 | public: 28 | DescTableExecutor() = default; 29 | virtual ~DescTableExecutor() = default; 30 | 31 | RC execute(SQLStageEvent *sql_event); 32 | }; 33 | -------------------------------------------------------------------------------- /src/observer/sql/expr/aggregate_state.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | template 12 | class SumState 13 | { 14 | public: 15 | SumState() : value(0) {} 16 | T value; 17 | void update(const T *values, int size); 18 | }; -------------------------------------------------------------------------------- /src/observer/sql/expr/expression_iterator.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2024/05/30. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | #include "common/lang/functional.h" 19 | #include "common/lang/memory.h" 20 | 21 | class Expression; 22 | 23 | class ExpressionIterator 24 | { 25 | public: 26 | static RC iterate_child_expr(Expression &expr, function &)> callback); 27 | }; 28 | -------------------------------------------------------------------------------- /src/observer/sql/operator/delete_logical_operator.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by WangYunlai on 2022/12/26. 13 | // 14 | 15 | #include "sql/operator/delete_logical_operator.h" 16 | 17 | DeleteLogicalOperator::DeleteLogicalOperator(Table *table) : table_(table) {} 18 | -------------------------------------------------------------------------------- /src/observer/sql/operator/group_by_vec_physical_operator.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "sql/operator/group_by_vec_physical_operator.h" -------------------------------------------------------------------------------- /src/observer/sql/operator/hash_join_physical_operator.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "sql/operator/hash_join_physical_operator.h" 12 | -------------------------------------------------------------------------------- /src/observer/sql/operator/hash_join_physical_operator.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "sql/operator/physical_operator.h" 14 | #include "sql/parser/parse.h" 15 | 16 | /** 17 | * @brief Hash Join 算子 18 | * @ingroup PhysicalOperator 19 | */ 20 | class HashJoinPhysicalOperator 21 | {}; -------------------------------------------------------------------------------- /src/observer/sql/operator/insert_logical_operator.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by WangYunlai on 2023/4/25. 13 | // 14 | 15 | #include "sql/operator/insert_logical_operator.h" 16 | 17 | InsertLogicalOperator::InsertLogicalOperator(Table *table, vector values) : table_(table), values_(values) 18 | {} 19 | -------------------------------------------------------------------------------- /src/observer/sql/operator/predicate_logical_operator.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2022/12/13. 13 | // 14 | 15 | #include "sql/operator/predicate_logical_operator.h" 16 | 17 | PredicateLogicalOperator::PredicateLogicalOperator(unique_ptr expression) 18 | { 19 | expressions_.emplace_back(std::move(expression)); 20 | } 21 | -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/README.md: -------------------------------------------------------------------------------- 1 | # Cascade Optimizer 2 | 设计文档请参考 `docs/docs/design/miniob-cascade.md`。 3 | -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/property.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | class Property 14 | {}; 15 | 16 | /** 17 | * @brief Logical Property, such as the cardinality of logical operator 18 | */ 19 | class LogicalProperty 20 | { 21 | public: 22 | explicit LogicalProperty(int card) : card_(card) {} 23 | LogicalProperty() = default; 24 | ~LogicalProperty() = default; 25 | 26 | int get_card() const { return card_; } 27 | 28 | private: 29 | int card_ = 0; /// cardinality 30 | }; -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/tasks/cascade_task.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "sql/optimizer/cascade/tasks/cascade_task.h" 12 | #include "sql/optimizer/cascade/optimizer_context.h" 13 | #include "sql/optimizer/cascade/group_expr.h" 14 | #include "sql/optimizer/cascade/rules.h" 15 | #include "sql/optimizer/cascade/memo.h" 16 | 17 | Memo &CascadeTask::get_memo() const {return context_->get_memo(); } 18 | 19 | RuleSet &CascadeTask::get_rule_set() const { return context_->get_rule_set(); } 20 | 21 | void CascadeTask::push_task(CascadeTask *task) { context_->push_task(task); } -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/tasks/e_group_task.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "sql/optimizer/cascade/tasks/e_group_task.h" 12 | #include "sql/optimizer/cascade/tasks/o_expr_task.h" 13 | #include "common/log/log.h" 14 | 15 | void ExploreGroup::perform() 16 | { 17 | LOG_TRACE("ExploreGroup::perform() "); 18 | if (group_->has_explored()) { 19 | return; 20 | } 21 | 22 | for (auto &logical_expr : group_->get_logical_expressions()) { 23 | push_task(new OptimizeExpression(logical_expr, context_)); 24 | } 25 | 26 | group_->set_explored(); 27 | } -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/tasks/e_group_task.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "sql/optimizer/cascade/tasks/cascade_task.h" 14 | #include "sql/optimizer/cascade/group.h" 15 | 16 | /** 17 | * @brief ExploreGroup 18 | */ 19 | class ExploreGroup : public CascadeTask 20 | { 21 | public: 22 | ExploreGroup(Group *group, OptimizerContext *context) 23 | : CascadeTask(context, CascadeTaskType::EXPLORE_GROUP), group_(group) 24 | {} 25 | 26 | void perform() override; 27 | 28 | private: 29 | Group *group_; 30 | }; -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/tasks/o_expr_task.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "sql/optimizer/cascade/tasks/cascade_task.h" 14 | 15 | /** 16 | * OptimizeExpression 17 | */ 18 | class OptimizeExpression : public CascadeTask 19 | { 20 | public: 21 | OptimizeExpression(GroupExpr *group_expr, OptimizerContext *context) 22 | : CascadeTask(context, CascadeTaskType::OPTIMIZE_EXPR), group_expr_(group_expr) 23 | {} 24 | 25 | void perform() override; 26 | 27 | private: 28 | GroupExpr *group_expr_; 29 | }; -------------------------------------------------------------------------------- /src/observer/sql/optimizer/cascade/tasks/o_group_task.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "sql/optimizer/cascade/tasks/cascade_task.h" 14 | #include "sql/optimizer/cascade/group.h" 15 | 16 | /** 17 | * @brief: OptimizeGroup, find the best plan for a group 18 | */ 19 | class OptimizeGroup : public CascadeTask 20 | { 21 | public: 22 | OptimizeGroup(Group *group, OptimizerContext *context) 23 | : CascadeTask(context, CascadeTaskType::OPTIMIZE_GROUP), group_(group) 24 | {} 25 | 26 | void perform() override; 27 | 28 | private: 29 | Group *group_; 30 | }; -------------------------------------------------------------------------------- /src/observer/sql/optimizer/optimizer_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "common/lang/string.h" 14 | #include "common/lang/memory.h" 15 | #include "sql/operator/physical_operator.h" 16 | 17 | class OptimizerUtils 18 | { 19 | public: 20 | static string dump_physical_plan(const unique_ptr &root); 21 | }; -------------------------------------------------------------------------------- /src/observer/sql/optimizer/predicate_rewrite.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2022/12/29. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "sql/optimizer/rewrite_rule.h" 18 | 19 | /** 20 | * @brief 谓词重写规则 21 | * @ingroup Rewriter 22 | * @details 有些谓词可以在真正运行之前就知道结果,那么就可以提前运算出来,比如1=1,1=0。 23 | */ 24 | class PredicateRewriteRule : public RewriteRule 25 | { 26 | public: 27 | PredicateRewriteRule() = default; 28 | virtual ~PredicateRewriteRule() = default; 29 | 30 | RC rewrite(unique_ptr &oper, bool &change_made) override; 31 | }; 32 | -------------------------------------------------------------------------------- /src/observer/sql/optimizer/predicate_to_join_rule.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "sql/optimizer/predicate_to_join_rule.h" 12 | -------------------------------------------------------------------------------- /src/observer/sql/optimizer/predicate_to_join_rule.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | #include "common/lang/vector.h" 14 | #include "sql/optimizer/rewrite_rule.h" 15 | 16 | /** 17 | * @brief 将一些谓词表达式下推到join中 18 | * @ingroup Rewriter 19 | */ 20 | class PredicateToJoinRewriter 21 | {}; 22 | -------------------------------------------------------------------------------- /src/observer/sql/optimizer/statistics/table_statistics.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #pragma once 12 | 13 | class TableStatistics 14 | {}; -------------------------------------------------------------------------------- /src/observer/sql/parser/gen_parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | flex --outfile lex_sql.cpp --header-file=lex_sql.h lex_sql.l 3 | `which bison` -d --output yacc_sql.cpp yacc_sql.y 4 | -------------------------------------------------------------------------------- /src/observer/sql/parser/parse.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Meiyi 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | #include "sql/parser/parse_defs.h" 19 | 20 | RC parse(const char *st, ParsedSqlResult *sql_result); 21 | -------------------------------------------------------------------------------- /src/observer/sql/parser/parse_stage.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @brief 解析SQL语句,解析后的结果可以参考parse_defs.h 23 | * @ingroup SQLStage 24 | */ 25 | class ParseStage 26 | { 27 | public: 28 | RC handle_request(SQLStageEvent *sql_event); 29 | }; 30 | -------------------------------------------------------------------------------- /src/observer/sql/parser/resolve_stage.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @brief 执行Resolve,将解析后的SQL语句,转换成各种Stmt(Statement), 同时会做错误检查 23 | * @ingroup SQLStage 24 | */ 25 | class ResolveStage 26 | { 27 | public: 28 | RC handle_request(SQLStageEvent *sql_event); 29 | }; 30 | -------------------------------------------------------------------------------- /src/observer/sql/plan_cache/plan_cache_stage.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #include 16 | 17 | #include "plan_cache_stage.h" 18 | 19 | #include "common/conf/ini.h" 20 | #include "common/io/io.h" 21 | #include "common/lang/string.h" 22 | #include "common/log/log.h" 23 | 24 | using namespace common; 25 | -------------------------------------------------------------------------------- /src/observer/sql/plan_cache/plan_cache_stage.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | /** 20 | * @brief 尝试从Plan的缓存中获取Plan,如果没有命中,则执行Optimizer 21 | * @ingroup SQLStage 22 | * @details 实际上现在什么都没做。不过PlanCache对数据库的优化提升明显,是一个非常有趣的功能, 23 | * 感兴趣的同学可以参考OceanBase的实现 24 | */ 25 | class PlanCacheStage 26 | {}; 27 | -------------------------------------------------------------------------------- /src/observer/sql/query_cache/query_cache_stage.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #include 16 | 17 | #include "query_cache_stage.h" 18 | 19 | #include "common/conf/ini.h" 20 | #include "common/io/io.h" 21 | #include "common/lang/string.h" 22 | #include "common/log/log.h" 23 | 24 | using namespace common; 25 | 26 | RC QueryCacheStage::handle_request(SQLStageEvent *sql_event) 27 | { 28 | return RC::SUCCESS; 29 | } 30 | -------------------------------------------------------------------------------- /src/observer/sql/query_cache/query_cache_stage.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021/4/13. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "common/sys/rc.h" 18 | 19 | class SQLStageEvent; 20 | 21 | /** 22 | * @brief 查询缓存处理 23 | * @ingroup SQLStage 24 | * @details 当前什么都没做 25 | */ 26 | class QueryCacheStage 27 | { 28 | public: 29 | QueryCacheStage() = default; 30 | virtual ~QueryCacheStage() = default; 31 | 32 | public: 33 | RC handle_request(SQLStageEvent *sql_event); 34 | }; 35 | -------------------------------------------------------------------------------- /src/observer/sql/stmt/analyze_table_stmt.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "sql/stmt/analyze_table_stmt.h" 12 | #include "storage/db/db.h" 13 | 14 | RC AnalyzeTableStmt::create(Db *db, const AnalyzeTableSqlNode &analyze_table, Stmt *&stmt) 15 | { 16 | if (db->find_table(analyze_table.relation_name.c_str()) == nullptr) { 17 | return RC::SCHEMA_TABLE_NOT_EXIST; 18 | } 19 | stmt = new AnalyzeTableStmt(analyze_table.relation_name); 20 | return RC::SUCCESS; 21 | } 22 | -------------------------------------------------------------------------------- /src/observer/sql/stmt/desc_table_stmt.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/6/14. 13 | // 14 | 15 | #include "sql/stmt/desc_table_stmt.h" 16 | #include "storage/db/db.h" 17 | 18 | RC DescTableStmt::create(Db *db, const DescTableSqlNode &desc_table, Stmt *&stmt) 19 | { 20 | if (db->find_table(desc_table.relation_name.c_str()) == nullptr) { 21 | return RC::SCHEMA_TABLE_NOT_EXIST; 22 | } 23 | stmt = new DescTableStmt(desc_table.relation_name); 24 | return RC::SUCCESS; 25 | } 26 | -------------------------------------------------------------------------------- /src/observer/sql/stmt/exit_stmt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2023/6/14. 13 | // 14 | 15 | #pragma once 16 | 17 | #include "sql/stmt/stmt.h" 18 | 19 | /** 20 | * @brief Exit 语句,表示断开连接,现在什么成员都没有 21 | * @ingroup Statement 22 | */ 23 | class ExitStmt : public Stmt 24 | { 25 | public: 26 | ExitStmt() {} 27 | virtual ~ExitStmt() = default; 28 | 29 | StmtType type() const override { return StmtType::EXIT; } 30 | 31 | static RC create(Stmt *&stmt) 32 | { 33 | stmt = new ExitStmt(); 34 | return RC::SUCCESS; 35 | } 36 | }; -------------------------------------------------------------------------------- /src/observer/sql/stmt/update_stmt.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Wangyunlai on 2022/5/22. 13 | // 14 | 15 | #include "sql/stmt/update_stmt.h" 16 | 17 | UpdateStmt::UpdateStmt(Table *table, Value *values, int value_amount) 18 | : table_(table), values_(values), value_amount_(value_amount) 19 | {} 20 | 21 | RC UpdateStmt::create(Db *db, const UpdateSqlNode &update, Stmt *&stmt) 22 | { 23 | // TODO 24 | stmt = nullptr; 25 | return RC::INTERNAL; 26 | } 27 | -------------------------------------------------------------------------------- /src/observer/storage/common/codec.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "storage/common/codec.h" 12 | 13 | const byte_t OrderedCode::term[] = {0x00, 0x01}; 14 | const byte_t OrderedCode::lit00[] = {0x00, 0xff}; 15 | const byte_t OrderedCode::litff[] = {0xff, 0x00}; 16 | const byte_t OrderedCode::inf[] = {0xff, 0xff}; 17 | const byte_t OrderedCode::msb[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe}; -------------------------------------------------------------------------------- /src/observer/storage/index/index.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by wangyunlai.wyl on 2021/5/19. 13 | // 14 | 15 | #include "storage/index/index.h" 16 | 17 | RC Index::init(const IndexMeta &index_meta, const FieldMeta &field_meta) 18 | { 19 | index_meta_ = index_meta; 20 | field_meta_ = field_meta; 21 | return RC::SUCCESS; 22 | } 23 | -------------------------------------------------------------------------------- /src/observer/storage/record/record_scanner.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | #include "storage/record/record_scanner.h" -------------------------------------------------------------------------------- /src/observer/storage/table/.table_meta.cpp.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oceanbase/miniob/e45ff643a1306f1a6ef5aa230db2c1835947b363/src/observer/storage/table/.table_meta.cpp.swp -------------------------------------------------------------------------------- /test/case/README.md: -------------------------------------------------------------------------------- 1 | # miniob-test 2 | miniob自动化功能测试 3 | 4 | 运行所有测试用例: 5 | ```bash 6 | python3 miniob_test.py 7 | ``` 8 | 9 | 运行指定测试用例 10 | ```bash 11 | python3 miniob_test.py --test-cases=`case-name` --report-only 12 | ``` 13 | 14 | > 把`case-name` 换成你想测试的用例名称。 15 | > 如果要运行多个测试用例,则在 --test-cases 参数中使用 ',' 分隔写多个即可 16 | 17 | **注意**: 由于当前绝大部分测试已经没有result文件,所以无法正常测试。示例命令中增加了参数 `--report-only` 就不会真正的运行测试。 18 | 19 | 你可以设计自己的测试用例,并填充 result 文件后,删除 `--report-only` 参数进行测试。你可以用这种方法进行日常回归测试,防止在实现新功能时破坏了之前编写的功能。 20 | 21 | 运行 basic 测试用例 22 | ```bash 23 | python3 miniob_test.py --test-cases=basic 24 | ``` 25 | 26 | 注意:MiniOB 的题目要求是运行结果与 MySQL8.0 的结果一致,因此删除了过时的结果文件。如果不清楚某个测试用例的预期结果,参考 MySQL8.0 的运行结果即可。 27 | 28 | 更多运行方法和参数可以参考 miniob_test.py 29 | 30 | -------------------------------------------------------------------------------- /test/case/test/primary-unique.test: -------------------------------------------------------------------------------- 1 | -- echo initialization 2 | CREATE TABLE unique_table(id int, col1 int, col2 int); 3 | INSERT INTO unique_table VALUES (1,1,1); 4 | 5 | -- echo 1. unique test 6 | CREATE UNIQUE INDEX index_id on unique_table(id); 7 | INSERT INTO unique_table VALUES (2,1,1); 8 | CREATE UNIQUE INDEX index_id on unique_table(id); 9 | INSERT INTO unique_table VALUES (3,2,1); 10 | INSERT INTO unique_table VALUES (1,2,1); 11 | 12 | -- echo 2. select 13 | -- sort SELECT * FROM unique_table; -------------------------------------------------------------------------------- /test/integration_test/README.md: -------------------------------------------------------------------------------- 1 | # integration_test 介绍 2 | 3 | MiniOB 对应的集成测试,支持运行单测,性能测试,功能性测试(同时在 MiniOB 和 MySQL 上运行相同的 SQL 测试用例以对比其结果)等。 -------------------------------------------------------------------------------- /test/integration_test/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | ''' 5 | ''' 6 | 7 | __this_file = os.path.abspath(__file__) 8 | __root_dir = os.path.dirname(os.path.dirname(__this_file)) 9 | 10 | if not __root_dir in sys.path: 11 | sys.path.insert(0, __root_dir) 12 | -------------------------------------------------------------------------------- /test/integration_test/common/mytime_meter.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python3 2 | import logging 3 | import time 4 | 5 | _logger = logging.getLogger('time-meter') 6 | 7 | class TimeMeter: 8 | def __init__(self, started=True): 9 | self.__start_ts = 0 10 | self.__stop_ts = 0 11 | 12 | if started: 13 | self.start() 14 | 15 | def start(self): 16 | self.__start_ts = time.monotonic() 17 | 18 | def stop(self): 19 | self.__stop_ts = time.monotonic() 20 | 21 | def passed_ms(self) -> float: 22 | return (self.__stop_ts - self.__start_ts) * 1000 23 | -------------------------------------------------------------------------------- /test/integration_test/conf.ini: -------------------------------------------------------------------------------- 1 | [test_env] 2 | #env=prod 3 | env=dev 4 | task_queue_size=10 5 | # mock, default 6 | alipay_task_fetcher_name=mock 7 | # alipay mock file. put me in the `auto_test` directory 8 | alipay_task_fetcher_mock_file=alipay_mock.txt 9 | test_base_dir=`your test dir` 10 | cmake_args=-DCMAKE_COMMON_FLAGS='-w -fmax-errors=1' 11 | # python, text 12 | test_case_type=python 13 | 14 | # alipay api dev 15 | 16 | test_suite=miniob 17 | #player= 18 | 19 | [mysql_connect] 20 | enabled=on 21 | host=127.0.0.1 22 | port=3306 23 | 24 | [test_task] 25 | 26 | [repo] 27 | #github_user= 28 | #github_token= 29 | #gitee_user= 30 | #gitee_token= 31 | #gitee_user= 32 | #gitee_token= 33 | #clone_timeout_seconds=600 34 | -------------------------------------------------------------------------------- /test/integration_test/miniob_test_docker_entry.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | function init_coredump_settings() 4 | { 5 | sudo mkdir -p /corefile 6 | sudo chmod 777 /corefile 7 | sudo ulimit -c unlimited 8 | 9 | # 这两个配置在容器中不生效,需要在宿主机上配置 10 | sudo sysctl -w kernel.core_uses_pid=1 11 | sudo sysctl -w kernel.core_pattern=/corefile/core.%p 12 | } 13 | 14 | function is_mysql_server_up() 15 | { 16 | mysqladmin ping 17 | return $? 18 | } 19 | 20 | function start_mysql_server() 21 | { 22 | is_mysql_server_up 23 | ret=$? 24 | if [ $ret -eq 0 ]; 25 | then 26 | echo "mysql server started" 27 | else 28 | # 初始化多次会报错,但是不会覆盖 29 | sudo mysqld --initialize-insecure 30 | sudo nohup mysqld --user=root & 31 | # sleep 一段时间。因为使用脚本执行命令时,上一行命令可能还没有就绪 32 | sleep 10 33 | is_mysql_server_up 34 | ret=$? 35 | echo "mysql server start done. ret =" $ret 36 | 37 | fi 38 | return $ret 39 | } 40 | 41 | function main() 42 | { 43 | init_coredump_settings 44 | start_mysql_server 45 | } 46 | 47 | main 48 | -------------------------------------------------------------------------------- /test/integration_test/test_cases/README.md: -------------------------------------------------------------------------------- 1 | 此目录下可放置多个测试集合(可以认为每个测试集合中包含了可多个测试 case)。 2 | 每个测试 case 可以对应到训练营中的一个题目(例如 basic 题目)。 -------------------------------------------------------------------------------- /test/integration_test/test_exception.py: -------------------------------------------------------------------------------- 1 | 2 | class TestBaseException(Exception): 3 | def __init__(self, *args: object) -> None: 4 | super().__init__(*args) 5 | 6 | class TestUserException(TestBaseException): 7 | ''' 8 | 由于选手的程序导致的异常,比如启动observer失败,连接服务端失败 9 | ''' 10 | def __init__(self, *args: object) -> None: 11 | super().__init__(*args) 12 | 13 | class TestPlatformException(TestBaseException): 14 | ''' 15 | 由于测试程序本身或者测试环境导致的异常,比如代码BUG、文件权限问题、测试用例本身有BUG 16 | ''' 17 | def __init__(self, *args: object) -> None: 18 | super().__init__(*args) 19 | -------------------------------------------------------------------------------- /test/integration_test/test_info.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from typing import List 3 | 4 | class TestTask: 5 | def __init__(self, *, task_id = None, player: str = None, git_repo: str, branch: str = None, commit_id: str = None, test_suite:str=None): 6 | self.task_id = task_id 7 | self.player = player 8 | self.git_repo = git_repo 9 | self.branch = branch 10 | self.commit_id = commit_id 11 | self.cases:List[str] = None 12 | self.test_suite:str = test_suite 13 | 14 | def to_string(self): 15 | return f'task_id={str(self.task_id)},git_repo={str(self.git_repo)},branch={str(self.branch)},commit_id={str(self.commit_id)},test_suite={str(self.test_suite)}' 16 | 17 | def __str__(self): 18 | return self.to_string() 19 | 20 | @staticmethod 21 | def default_player() -> str: 22 | return "test" 23 | -------------------------------------------------------------------------------- /test/integration_test/test_request.py: -------------------------------------------------------------------------------- 1 | 2 | class Request: 3 | def __init__(self, command:str, data:str): 4 | self.command:str = command 5 | self.data:str = data 6 | 7 | def __str__(self): 8 | return f'command:{self.command},data:{self.data}' 9 | -------------------------------------------------------------------------------- /test/integration_test/test_suite.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from typing import List 3 | from test_case import TestCase 4 | from test_initiator import TestInitiator, DefaultTestInitiator 5 | 6 | _logger = logging.getLogger('TestSuite') 7 | 8 | 9 | class TestSuite: 10 | """ 11 | 描述一个测试集合 12 | 一个测试集合有一个测试初始化工作器,一系列测试用例。 13 | 每次执行这一套测试的时候,先执行初始化,再执行一系列的测试用例。 14 | 初始化,比如对测试源码做编译。 15 | """ 16 | def __init__(self): 17 | self.test_initiator: TestInitiator = DefaultTestInitiator() 18 | self.test_cases: List[TestCase] = [] 19 | 20 | def name(self) -> str: 21 | return self.test_initiator.name 22 | 23 | def description(self) -> str: 24 | return self.test_initiator.description 25 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(clog_dump clog_dump.cpp) 2 | TARGET_LINK_LIBRARIES(clog_dump observer_static) 3 | TARGET_INCLUDE_DIRECTORIES(clog_dump PRIVATE ${PROJECT_SOURCE_DIR}/src/observer/) 4 | 5 | # Target 必须在定义 ADD_EXECUTABLE 之后, programs 不受这个限制 6 | # TARGETS和PROGRAMS 的默认权限是OWNER_EXECUTE, GROUP_EXECUTE, 和WORLD_EXECUTE,即755权限, programs 都是处理脚步类 7 | # 类型分为RUNTIME/LIBRARY/ARCHIVE, prog 8 | INSTALL(TARGETS clog_dump RUNTIME DESTINATION bin) 9 | -------------------------------------------------------------------------------- /unittest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 可以获取父cmake的变量 2 | MESSAGE("${CMAKE_COMMON_FLAGS}") 3 | 4 | find_package(GTest CONFIG REQUIRED) 5 | 6 | include(GoogleTest) 7 | 8 | ADD_SUBDIRECTORY(common) 9 | ADD_SUBDIRECTORY(oblsm) 10 | 11 | IF (WITH_MEMTRACER) 12 | ADD_SUBDIRECTORY(memtracer) 13 | ENDIF (WITH_MEMTRACER) 14 | 15 | ADD_SUBDIRECTORY(observer) 16 | -------------------------------------------------------------------------------- /unittest/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #get_filename_component( FileName 2 | # PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH 3 | # [CACHE]) 4 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 5 | # AUX_SOURCE_DIRECTORY 类似功能 6 | FOREACH (F ${ALL_SRC}) 7 | get_filename_component(prjName ${F} NAME_WE) 8 | MESSAGE("Build ${prjName} according to ${F}") 9 | ADD_EXECUTABLE(${prjName} ${F}) 10 | TARGET_LINK_LIBRARIES(${prjName} common pthread dl GTest::gtest_main) 11 | add_test(NAME ${prjName} COMMAND ${prjName}) 12 | ENDFOREACH (F) 13 | -------------------------------------------------------------------------------- /unittest/common/log_test.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021 13 | // 14 | 15 | #ifndef CTESTLOG_H_ 16 | #define CTESTLOG_H_ 17 | 18 | #include "common/lang/string.h" 19 | 20 | /* 21 | * 22 | */ 23 | class LogTest 24 | { 25 | public: 26 | LogTest(); 27 | virtual ~LogTest(); 28 | 29 | int init(const string &logFile = "test.log"); 30 | 31 | void *log_loop(void *param); 32 | }; 33 | 34 | #endif /* CTESTLOG_H_ */ 35 | -------------------------------------------------------------------------------- /unittest/common/md5_test.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved. 2 | miniob is licensed under Mulan PSL v2. 3 | You can use this software according to the terms and conditions of the Mulan PSL v2. 4 | You may obtain a copy of Mulan PSL v2 at: 5 | http://license.coscl.org.cn/MulanPSL2 6 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 7 | EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 8 | MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 9 | See the Mulan PSL v2 for more details. */ 10 | 11 | // 12 | // Created by Longda on 2021 13 | // 14 | 15 | #ifndef CTESTMD5_H_ 16 | #define CTESTMD5_H_ 17 | 18 | /* 19 | * 20 | */ 21 | class Md5Test 22 | { 23 | public: 24 | Md5Test(); 25 | virtual ~Md5Test(); 26 | 27 | void string(); 28 | }; 29 | 30 | #endif /* CTESTMD5_H_ */ 31 | -------------------------------------------------------------------------------- /unittest/memtracer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #get_filename_component( FileName 2 | # PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH 3 | # [CACHE]) 4 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 5 | # AUX_SOURCE_DIRECTORY 类似功能 6 | FOREACH (F ${ALL_SRC}) 7 | get_filename_component(prjName ${F} NAME_WE) 8 | MESSAGE("Build ${prjName} according to ${F}") 9 | ADD_EXECUTABLE(${prjName} ${F}) 10 | TARGET_LINK_LIBRARIES(${prjName} pthread dl GTest::gtest_main memtracer) 11 | add_test(NAME ${prjName} COMMAND ${prjName}) 12 | ENDFOREACH (F) 13 | -------------------------------------------------------------------------------- /unittest/oblsm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 2 | 3 | FOREACH (F ${ALL_SRC}) 4 | get_filename_component(prjName ${F} NAME_WE) 5 | MESSAGE("Build ${prjName} according to ${F}") 6 | ADD_EXECUTABLE(${prjName} ${F}) 7 | TARGET_LINK_LIBRARIES(${prjName} GTest::gtest_main oblsm) 8 | add_test(NAME ${prjName} COMMAND ${prjName}) 9 | ENDFOREACH (F) 10 | -------------------------------------------------------------------------------- /unittest/observer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/observer) 2 | 3 | #get_filename_component( FileName 4 | # PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH 5 | # [CACHE]) 6 | FILE(GLOB_RECURSE ALL_SRC *.cpp) 7 | # AUX_SOURCE_DIRECTORY 类似功能 8 | FOREACH (F ${ALL_SRC}) 9 | get_filename_component(prjName ${F} NAME_WE) 10 | MESSAGE("Build ${prjName} according to ${F}") 11 | ADD_EXECUTABLE(${prjName} ${F}) 12 | TARGET_LINK_LIBRARIES(${prjName} observer_static GTest::gtest_main) 13 | add_test(NAME ${prjName} COMMAND ${prjName}) 14 | ENDFOREACH (F) 15 | --------------------------------------------------------------------------------