(Re)loading the R Tree with spatialindex library

℡╲_俬逩灬. 提交于 2019-12-23 02:00:37

问题


I am bulkloading an R Tree with spatialindex (http://libspatialindex.github.com/) library:

string baseName = "streets";
size_t capacity = 10 * 1024 * 1024;
bool bWriteThrough = false;
indexIdentifier = 0;

IStorageManager *disk = StorageManager::createNewDiskStorageManager(baseName, 512);
fileInMem = StorageManager
   ::createNewRandomEvictionsBuffer(*disk, capacity, bWriteThrough);

// bulkLoads my tree
bulkLoadRTree();

cout << "tree info:" << endl;
cout << *tree << endl;

delete disk;

The following is output at the info about the built tree:

    Dimension: 2 
    Fill factor: 0.7 
    Index capacity: 100 
    Leaf capacity: 100 
    Tight MBRs: enabled 
    Near minimum overlap factor: 32 
    Reinsert factor: 0.3 
    Split distribution factor: 0.4 
    Utilization: 69% 
    Reads: 1 
    Writes: 35980 
    Hits: 0 
    Misses: 0 
    Tree height: 4 
    Number of data: 2482376 
    Number of nodes: 35979 
    Level 0 pages: 35463 
    Level 1 pages: 507 
    Level 2 pages: 8 
    Level 3 pages: 1 
    Splits: 0 
    Adjustments: 0 
    Query results: 0 

now I am trying to load what I have saved in the disk:

IStorageManager *ldisk = StorageManager::loadDiskStorageManager(baseName);
SpatialIndex::StorageManager::IBuffer* fileLoadBuffer = StorageManager
    ::createNewRandomEvictionsBuffer(*ldisk, capacity, bWriteThrough);

id_type id = 1;
tree = RTree::loadRTree(*fileLoadBuffer, id);
cout << *tree << endl;

and the tree has only one node (the output of the tree is:)

    Dimension: 2
    Fill factor: 0.7
    Index capacity: 100
    Leaf capacity: 100
    Tight MBRs: enabled
    Near minimum overlap factor: 32
    Reinsert factor: 0.3
    Split distribution factor: 0.4
    Utilization: 0%
    Reads: 0
    Writes: 0
    Hits: 0
    Misses: 0
    Tree height: 1
    Number of data: 0
    Number of nodes: 1
    Level 0 pages: 1
    Splits: 0
    Adjustments: 0
    Query results: 0

What do I do wrong? Why don't I load the whole tree from the disk?


回答1:


Did you maybe not sync your changes to disc?

Plus, usually one would implement the tree on-disk, and not read it completely on the first access. So at this point, it cannot report accurate statistics.

Or maybe your bulkLoadRTree does not use fileInMem.




回答2:


One has to delete the fileInMem so the pages are further sent back to disk and further sent back to delete *disk. This line needs to be added before delete disk:

delete fileInMem


来源:https://stackoverflow.com/questions/13253270/reloading-the-r-tree-with-spatialindex-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!