Graph database_neo4j 底层存储结构分析(2)
3 neo4j存储结构
neo4j 中,主要有4类节点,属性,关系等文件是以数组作为核心存储结构;同时对节点,属性,关系等类型的每个数据项都会分配一个唯一的ID,在存储时以该ID 为数组的下标。这样,在访问时通过其ID作为下标,实现快速定位。所以在图遍历等操作时,可以实现 free-index。
3.1 neo4j 的 store 部分类图

3.1.1 CommonAbstractStore.java
CommonAbstractStore 是所有 Store 类的基类,下面的代码片段是 CommonAbstractStore 的成员变量,比较重要的是飘红的几个,特别是IdGenerator,每种Store 的实例都有自己的 id 分配管理器; StoreChannel 是负责Store文件的读写和定位;WindowsPool 是与Store Record相关的缓存,用来提升性能的。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
</pre><div>public abstract class CommonAbstractStore implements IdSequence{public static abstract class Configuration{public static final Setting store_dir = InternalAbstractGraphDatabase.Configuration.store_dir;public static final Setting neo_store = InternalAbstractGraphDatabase.Configuration.neo_store;public static final Setting read_only = GraphDatabaseSettings.read_only;public static final Setting backup_slave = GraphDatabaseSettings.backup_slave;public static final Setting use_memory_mapped_buffers = GraphDatabaseSettings.use_memory_mapped_buffers;}public static final String ALL_STORES_VERSION = "v0.A.2";public static final String UNKNOWN_VERSION = "Uknown";protected Config configuration;private final IdGeneratorFactory idGeneratorFactory;private final WindowPoolFactory windowPoolFactory;protected FileSystemAbstraction fileSystemAbstraction;protected final File storageFileName;protected final IdType idType;protected StringLogger stringLogger;private IdGenerator idGenerator = null;private StoreChannel fileChannel = null;private WindowPool windowPool;private boolean storeOk = true;private Throwable causeOfStoreNotOk;private FileLock fileLock;private boolean readOnly = false;private boolean backupSlave = false;private long highestUpdateRecordId = -1; |
1.2 neo4j 的db文件及对应的存储格式类型
| 文件名 | 文件存储格式 |
| neostore.labeltokenstore.db | LabelTokenStore(TokenStore) |
| neostore.labeltokenstore.db.id | ID 类型 |
| neostore.labeltokenstore.db.names | StringPropertyStore (AbstractDynamicStore, NAME_STORE_BLOCK_SIZE = 30) |
| neostore.labeltokenstore.db.names.id | ID 类型 |
| neostore.nodestore.db | NodeStore |
| neostore.nodestore.db.id | ID 类型 |
| neostore.nodestore.db.labels | ArrayPropertyStore (AbstractDynamicStorelabel_block_size=60) |
| neostore.nodestore.db.labels.id | ID 类型 |
| neostore.propertystore.db | PropertyStore |
| neostore.propertystore.db.arrays | ArrayPropertyStore (AbstractDynamicStorearray_block_size=120) |
| neostore.propertystore.db.arrays.id | ID 类型 |
| neostore.propertystore.db.id | ID 类型 |
| neostore.propertystore.db.index | PropertyIndexStore |
| neostore.propertystore.db.index.id | ID 类型 |
| neostore.propertystore.db.index.keys | StringPropertyStore (AbstractDynamicStore, NAME_STORE_BLOCK_SIZE = 30) |
| neostore.propertystore.db.index.keys.id | ID 类型 |
| neostore.propertystore.db.strings | StringPropertyStore (AbstractDynamicStorestring_block_size=120) |
| neostore.propertystore.db.strings.id | ID 类型 |
| neostore.relationshipgroupstore.db | RelationshipGroupStore |
| neostore.relationshipgroupstore.db.id | ID 类型 |
| neostore.relationshipstore.db | RelationshipStore |
| neostore.relationshipstore.db.id | ID 类型 |
| neostore.relationshiptypestore.db | RelationshipTypeTokenStore(TokenStore) |
| neostore.relationshiptypestore.db.id | ID 类型 |
| neostore.relationshiptypestore.db.names | StringPropertyStore (AbstractDynamicStore, NAME_STORE_BLOCK_SIZE = 30) |
| neostore.relationshiptypestore.db.names.id | ID 类型 |
| neostore.schemastore.db | SchemaStore(AbstractDynamicStore, BLOCK_SIZE = 56) |
| neostore.schemastore.db.id | ID 类型 |
Graph database_neo4j 底层存储结构分析(2)的更多相关文章
- Graph database_neo4j 底层存储结构分析(8)
3.8 示例1:neo4j_exam 下面看一个简单的例子,然后看一下几个主要的存储文件,有助于理解<3–neo4j存储结构>描述的neo4j 的存储格式. 3.8.1 neo4j ...
- Graph database_neo4j 底层存储结构分析(7)
3.7 Relationship 的存储 下面是neo4j graph db 中,Relationship数据存储对应的文件: neostore.relationshipgroupstore.db ...
- Graph database_neo4j 底层存储结构分析(6)
3.6 Node 数据存储 neo4j 中, Node 的存储是由 NodeStore 和 ArrayPropertyStore 2中类型配合来完成的. node 的label 内容是存在Array ...
- Graph database_neo4j 底层存储结构分析(5)
3.5 Property 的存储 下面是neo4j graph db 中,Property数据存储对应的文件: neostore.propertystore.db neostore.propertys ...
- Graph database_neo4j 底层存储结构分析(1)
1 neo4j 中节点和关系的物理存储模型 1.1 neo4j存储模型 The node records contain only a pointer to their first pr ...
- Graph database_neo4j 底层存储结构分析(4)
3.3.2 DynamicStore 类型 3.3.2.1 AbstractDynamicStore 的存储格式 neo4j 中对于字符串等变长值的保存策略是用一组定长的 block ...
- Graph database_neo4j 底层存储结构分析(3)
3.3 通用的Store 类型 3.3.1 id 类型 下面是 neo4j db 中,每种Store都有自己的ID文件(即后缀.id 文件),它们的格式都是一样的. [test00]$ls - ...
- Redis(一) 数据结构与底层存储 & 事务 & 持久化 & lua
参考文档:redis持久化:http://blog.csdn.net/freebird_lb/article/details/7778981 https://blog.csdn.net/jy69240 ...
- HBase底层存储原理
HBase底层存储原理——我靠,和cassandra本质上没有区别啊!都是kv 列存储,只是一个是p2p另一个是集中式而已! 首先HBase不同于一般的关系数据库, 它是一个适合于非结构化数据存储的数 ...
随机推荐
- [原] eclipse 无法找到 run as junit
碰见这个问题,折磨我好一下! 问题根源和解决方式 第一,保证有junit jar包,基本不会犯这错误: 第二,保证你这个类是Source可编译文件,要是这个类在普通文件夹下,工程是不会编译它的,也就找 ...
- Javascript - Vue - 指令
指令 v-cloak 解决闪烁,闪烁是指在网速较慢的情况下可能会出现插值表达式{{}}还没有填充数据时会把该表达式直接显示在页面上,如果不希望看到插值表达式则可以使用v-cloak指令,具体做法如下 ...
- nested exception is com.svorx.core.dao.PersistenceException
在quartz定时执行任务的时候,hibernate报错,在只读事务中进行了update语句: [ERROR] 2018/08/03 10:35:00,827 org.quartz.core.JobR ...
- word技巧
1.插入注解(脚注和尾注) 2.复制的图片显示不全怎么办? 横向显示,或者图片另存为然后保存为PPT 3.word修订标记的添加和删除(最终版) 4.word中表格样式调整 5.修改标题的样式和标题的 ...
- linux 查看有哪些service
一.利用进程来查看命令里 ps -aux | grep xxx 是查看某个进程或者服务是否存在.二.利用chkconfig配置工具chkconfig --list 可以列出所有的服务在各个runlev ...
- 不能访问本地服务器场。没有注册带有FeatureDependencyId 的 Cmdlet
不能访问本地服务器场.没有注册带有FeatureDependencyId 的 Cmdlet. 原因: 我有两个域管理员账号,分别:sp\administrator,sp\spadmin 其中后者才 ...
- robotium 中通过id获取 View 以及进行相应的操作
robotium 中id的几种表现形式 1)字符串形式:例如id/btn_example,源码中的布局里些的hierachy 中看见的都是这种. 2)数字形式:例如0x7f0700D,打开R.java ...
- 【linux】shell中命令替换$(cmd)和符号`cmd`
来源:https://zhidao.baidu.com/question/485498670.html 作用: $(cmd)和`cmd`的作用是相同的,在执行一条命令时,会先将其中的 ``,或者是$( ...
- javaweb笔记六
指令包含:可以在一个jsp中包含另一个jsp中的内容.会将包含页面和被包含页面放在一起编译,形成一个java类.所以,是在编译时发生的.只能包含文件,不允许两个页面之间存在同名变量.被包含页面也不应该 ...
- MyEclipse、IDEA常用快捷键
一.MyEclipse快捷键 1. ctrl+shift+r:打开资源这可能是所有快捷键组合中最省时间的了.这组快捷键可以让你打开你的工作区中任何一个文件,而你只需要按下文件名或mask名中的前几个字 ...