From c9b8065f2be72c6c7b2abc9657444d225974c62a Mon Sep 17 00:00:00 2001 From: yutao1115 Date: Fri, 23 May 2025 15:30:41 +0800 Subject: [PATCH] rocksdb interface port---rdb_cf_manager.h-1 --- storage/rocksdb/rdb_cf_manager.h | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 storage/rocksdb/rdb_cf_manager.h diff --git a/storage/rocksdb/rdb_cf_manager.h b/storage/rocksdb/rdb_cf_manager.h new file mode 100644 index 000000000..366a48221 --- /dev/null +++ b/storage/rocksdb/rdb_cf_manager.h @@ -0,0 +1,54 @@ +/* + Copyright (c) 2014, SkySQL Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#pragma once + +/* C++ system header files */ +#include +#include +#include + +/* MySQL header files */ +#include "src/runtime/sql_class.h" + +/* RocksDB header files */ +#include "rocksdb/db.h" + +/* MyRocks header files */ +#include "./rdb_cf_options.h" +#include "./rdb_datadic.h" +#include "./rdb_global.h" + +namespace myrocks { + +/* + We need a Column Family (CF) manager. Its functions: + - create column families (synchronized, don't create the same twice) + - keep count in each column family. + = the count is kept on-disk. + = there are no empty CFs. initially count=1. + = then, when doing DDL, we increase or decrease it. + (atomicity is maintained by being in the same WriteBatch with DDLs) + = if DROP discovers that now count=0, it removes the CF. + + Current state is: + - CFs are created in a synchronized way. We can't remove them, yet. +*/ + +class Rdb_cf_manager { + std::map> + m_cf_name_map; + std::map> m_cf_id_map; -- Gitee