JP2658964B2 - Data record storage position control method - Google Patents

Data record storage position control method

Info

Publication number
JP2658964B2
JP2658964B2 JP7087552A JP8755295A JP2658964B2 JP 2658964 B2 JP2658964 B2 JP 2658964B2 JP 7087552 A JP7087552 A JP 7087552A JP 8755295 A JP8755295 A JP 8755295A JP 2658964 B2 JP2658964 B2 JP 2658964B2
Authority
JP
Japan
Prior art keywords
block
buffer
previous
data
subsequent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP7087552A
Other languages
Japanese (ja)
Other versions
JPH08263339A (en
Inventor
規子 宮部
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP7087552A priority Critical patent/JP2658964B2/en
Publication of JPH08263339A publication Critical patent/JPH08263339A/en
Application granted granted Critical
Publication of JP2658964B2 publication Critical patent/JP2658964B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明はデータレコード格納位置
制御方式に関し、特にデータレコードがある順序関係に
従って記憶媒体上に格納されデータレコードの更新およ
び削除が頻繁に発生するデータファイルにおけるデータ
レコード格納位置制御方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data record storage position control method, and more particularly to a data record storage position in a data file in which data records are stored on a storage medium according to a certain order and data records are frequently updated and deleted. Related to the control method.

【0002】[0002]

【従来の技術】従来のデータレコード格納位置制御方式
は、データレコードの更新および削除が行われ、ブロッ
ク内の全てのデータレコードが削除された場合に、ブロ
ックの不要となった領域が記憶媒体上で再利用可能な状
態にされる方式であった。
2. Description of the Related Art In a conventional data record storage position control method, when data records are updated and deleted, and all data records in a block are deleted, an unnecessary area of the block is stored on a storage medium. The system was made reusable.

【0003】[0003]

【発明が解決しようとする課題】上述した従来のデータ
レコード格納位置制御方式では、更新処理および削除処
理が繰り返されるデータファイルにおいて、初期格納時
にデータレコードが配置されたブロックに関しては、ブ
ロック内の一部のデータレコードが削除されても、その
領域はブロック内に不要な空き領域として保有されてし
まっていたので、更新処理および削除処理の結果、デー
タファイル内のデータレコードの配置に偏りが生じ、削
除処理によりブロック内に生じた不要な空き領域はブロ
ック内の全てのデータレコードが削除されるまで解放さ
れず、再利用されにくくなるという問題点があった。
In the above-described conventional data record storage position control method, in a data file in which update processing and deletion processing are repeated, a block in which a data record is arranged at the time of initial storage is one in the block. Even if some data records were deleted, the area was held as unnecessary free space in the block, so as a result of the update processing and deletion processing, the data record arrangement in the data file was biased, Unnecessary free space generated in the block due to the deletion process is not released until all the data records in the block are deleted, and there is a problem that it is difficult to reuse the unused space.

【0004】本発明の目的は、上述の点に鑑み、利用者
により指定されたデータファイルが記憶媒体上に保有す
る不要な空き領域をブロック毎に収集管理して再利用可
能とするデータレコード格納位置制御方式を提供するこ
とにある。
SUMMARY OF THE INVENTION In view of the above, it is an object of the present invention to store and manage a data record designated by a user so that an unnecessary empty area held on a storage medium can be reused by collecting and managing block by block. It is to provide a position control method.

【0005】なお、先行技術として、特開平5−250
234号公報に開示されたデータレコード格納方式,特
開平5−165686号公報に開示されたデータ格納制
御方式等があるが、いずれも本願発明のように、データ
ファイルが保有する不要な空き領域をブロック毎に収集
管理して再利用可能とするためのものではない。
The prior art is disclosed in Japanese Patent Application Laid-Open No. 5-250.
There are a data record storage method disclosed in Japanese Patent Application Laid-Open No. 234, No. 234, a data storage control method disclosed in Japanese Patent Application Laid-Open No. Hei 5-165686, and the like. It is not intended to collect and manage each block so that it can be reused.

【0006】[0006]

【課題を解決するための手段】本発明のデータレコード
格納位置制御方式は、データレコードを格納するための
記憶領域をデータファイル内でブロック単位に動的に確
保し、ブロック内に次ブロックポインタを持つことで、
ブロック間の順序関係がデータファイル内で管理される
データファイルに対して、データレコードの格納位置を
制御するデータレコード格納位置制御方式において、前
記データファイルからブロック間の順序関係に従ってブ
ロックを検索し、前側となるブロックを前ブロックバッ
ファに前ブロックとして読み出し、後ろ側となるブロッ
クを後ブロックバッファに後ブロックとして読み出すデ
ータブロック検索手段と、前ブロックバッファ内の前ブ
ロックの前ブロック残り容量を取得する前ブロック残り
容量取得手段と、この前ブロック残り容量取得手段によ
り取得された前ブロック残り容量を格納する前ブロック
残り容量格納領域と、後ブロックバッファ内の後ブロッ
クの後ブロック使用容量を取得する後ブロック使用容量
取得手段と、この後ブロック使用容量取得手段により取
得された後ブロック使用容量を格納する後ブロック使用
容量格納領域と、前記前ブロック残り容量格納領域およ
び前記後ブロック使用容量格納領域より前ブロック残り
容量および後ブロック使用容量を取得し前ブロックバッ
ファ内の前ブロックの空き領域に後ブロックバッファ内
の後ブロックの全てのデータレコードが格納可能かどう
かを判断し、格納不可の場合には前記データブロック検
索手段を呼び出すブロック容量比較手段と、このブロッ
ク容量比較手段により前ブロックバッファ内の前ブロッ
クの空き領域に後ブロックバッファ内の後ブロックの全
てのデータレコードが格納可能と判断された場合に呼び
出され前記データファイルを更新するデータファイル更
新手段と、前記データファイル更新手段において、後ブ
ロックバッファ内の後ブロックのデータレコードを前ブ
ロックバッファ内の前ブロックの空き領域に移送するデ
ータレコード移送手段と、前記データファイル更新手段
において、前ブロックバッファ内の前ブロックの次ブロ
ックポインタを後ブロックバッファ内の後ブロックの次
ブロックポインタに書き換える次ブロックポインタ更新
手段と、前記データファイル更新手段において、後ブロ
ックバッファ内の後ブロックを再利用可能な空ブロック
として解放するブロック解放手段と、前記データファイ
ル更新手段において、前ブロックバッファ内の前ブロッ
クおよび後ブロックバッファ内の後ブロックを前記デー
タファイル内の該当するブロックに上書きするブロック
上書き手段とを有する。
According to the data record storage position control method of the present invention, a storage area for storing a data record is dynamically secured in block units in a data file, and a next block pointer is stored in a block. By having
In a data record storage position control method for controlling a storage position of a data record for a data file in which the order relation between blocks is managed in the data file, blocks are stored in accordance with the order relation between blocks from the data file.
Searches for the lock, reads the block on the front side into the front block buffer as the previous block , and reads the block on the back side.
Data block search means for reading the block as a subsequent block into the subsequent block buffer, a previous block remaining capacity obtaining means for obtaining the previous block remaining capacity of the previous block in the previous block buffer, and a data obtained by the previous block remaining capacity obtaining means. After the previous block remaining capacity storage area for storing the previous block remaining capacity, the rear block used capacity obtaining means for obtaining the post-block used capacity of the post-block in the post-block buffer, and after the post-block used capacity obtaining means A block used capacity storage area for storing a block used capacity, and a previous block remaining capacity and a rear block used capacity obtained from the previous block remaining capacity storage area and the rear block used capacity storage area, and of the previous block in the previous block buffer. All of the subsequent block in the subsequent block buffer in the free area It is determined whether or not the data record can be stored. If the data record cannot be stored, the block size comparison means calls the data block search means. A data file updating unit that is called when all data records of the subsequent block in the buffer are determined to be storable and updates the data file; and in the data file updating unit, the data record of the subsequent block in the rear block buffer Record data transfer means for transferring the next block pointer of the previous block in the previous block buffer to the next block pointer of the next block in the rear block buffer. Next b Block pointer updating means, in the data file updating means, a block releasing means for releasing a subsequent block in a subsequent block buffer as a reusable empty block, and in the data file updating means, a preceding block and a following block in a preceding block buffer. Block overwriting means for overwriting a subsequent block in the block buffer with a corresponding block in the data file.

【0007】[0007]

【作用】本発明のデータレコード格納位置制御方式で
は、データブロック検索手段がデータファイルからブロ
ック間の順序関係に従ってブロックを検索し、前側とな
るブロックを前ブロックバッファに前ブロックとして読
み出し、後ろ側となるブロックを後ブロックバッファに
後ブロックとして読み出し、前ブロック残り容量取得手
段が前ブロックバッファ内の前ブロックの前ブロック残
り容量を取得し、前ブロック残り容量格納領域が前ブロ
ック残り容量取得手段により取得された前ブロック残り
容量を格納し、後ブロック使用容量取得手段が後ブロッ
クバッファ内の後ブロックの後ブロック使用容量を取得
し、後ブロック使用容量格納領域が後ブロック使用容量
取得手段により取得された後ブロック使用容量を格納
し、ブロック容量比較手段が前ブロック残り容量格納領
域および後ブロック使用容量格納領域より前ブロック残
り容量および後ブロック使用容量を取得し前ブロックバ
ッファ内の前ブロックの空き領域に後ブロックバッファ
内の後ブロックの全てのデータレコードが格納可能かど
うかを判断し、格納不可の場合にはデータブロック検索
手段を呼び出し、データファイル更新手段がブロック容
量比較手段により前ブロックバッファ内の前ブロックの
空き領域に後ブロックバッファ内の後ブロックの全ての
データレコードが格納可能と判断された場合に呼び出さ
れ、データレコード移送手段が後ブロックバッファ内の
後ブロックのデータレコードを前ブロックバッファ内の
前ブロックの空き領域に移送し、次ブロックポインタ更
新手段が前ブロックバッファ内の前ブロックの次ブロッ
クポインタを後ブロックバッファ内の後ブロックの次ブ
ロックポインタに書き換え、ブロック解放手段が後ブロ
ックバッファ内の後ブロックを再利用可能な空ブロック
として解放し、ブロック上書き手段が前ブロックバッフ
ァ内の前ブロックおよび後ブロックバッファ内の後ブロ
ックをデータファイル内の該当するブロックに上書きす
る。
[Action] In the data record storage position control method of the present invention, Bro data block retrieval means from the data file
Blocks are searched according to the order relationship between blocks, and
Block is read into the previous block buffer as the previous block.
Out look, it reads as a post-block block to be behind the rear block buffer, before block remaining amount acquiring means acquires the previous block remaining capacity before block before the block in the buffer, before the block remaining amount storage area previous block The previous block remaining capacity obtained by the remaining capacity obtaining means is stored, the rear block used capacity obtaining means obtains the post-block used capacity of the post-block in the post-block buffer, and the post-block used capacity storage area is the post-block used capacity. The post-block use capacity acquired by the acquisition means is stored, and the block capacity comparison means acquires the pre-block remaining capacity and the post-block use capacity from the pre-block remaining capacity storage area and the post-block use capacity storage area, and All of the subsequent block in the subsequent block buffer is stored in the free area of the previous block. Judge whether or not the data record of the previous block can be stored. If the data record cannot be stored, the data block retrieving means is called. Is called when it is determined that all the data records of the subsequent block can be stored, the data record transfer means transfers the data record of the subsequent block in the subsequent block buffer to the free space of the previous block in the previous block buffer, The next block pointer updating means rewrites the next block pointer of the previous block in the previous block buffer with the next block pointer of the next block in the next block buffer, and the block releasing means re-uses the next block in the rear block buffer. And the block overwriting means Overwrite block after the previous block and the succeeding block buffer in a block buffer to the appropriate block in the data file.

【0008】[0008]

【実施例】次に、本発明について図面を参照して詳細に
説明する。
Next, the present invention will be described in detail with reference to the drawings.

【0009】図1は、本発明の一実施例に係るデータレ
コード格納位置制御方式の構成を示すブロック図であ
る。本実施例のデータレコード格納位置制御方式は、デ
ータファイル1と、データブロック検索手段2と、前ブ
ロックバッファ21と、後ブロックバッファ22と、前
ブロック残り容量取得手段3と、前ブロック残り容量格
納領域4と、後ブロック使用容量取得手段5と、後ブロ
ック使用容量格納領域6と、ブロック容量比較手段7
と、データレコード移送手段9,次ブロックポインタ更
新手段10,ブロック解放手段11およびブロック上書
き手段12を含むデータファイル更新手段8とから構成
されている。
FIG. 1 is a block diagram showing a configuration of a data record storage position control method according to an embodiment of the present invention. The data record storage position control method of the present embodiment includes a data file 1, a data block search unit 2, a previous block buffer 21, a rear block buffer 22, a previous block remaining capacity acquisition unit 3, and a previous block remaining capacity storage. Area 4, rear block used capacity obtaining means 5, rear block used capacity storage area 6, and block capacity comparing means 7
And a data file updating means 8 including a data record transfer means 9, a next block pointer updating means 10, a block releasing means 11 and a block overwriting means 12.

【0010】データファイル1は、データレコードを格
納するための記憶領域を内部でブロック単位に動的に確
保し、ブロック内に次ブロックポインタを持つことで、
ブロック間の順序関係が内部で管理されるファイルであ
る。
The data file 1 dynamically secures a storage area for storing data records in units of blocks internally, and has a next block pointer in a block,
A file in which the order relation between blocks is managed internally.

【0011】データブロック検索手段2、前ブロック
バッファ21および後ブロックバッファ22を管理し、
データファイル1からブロック間の順序関係に従ってブ
ロックを検索し、前側となるブロックを前ブロックバッ
ファ21に前ブロックとして読み出し、後ろ側となるブ
ロックを後ブロックバッファ22に後ブロックとして読
み出す。詳しくは、データブロック検索手段2は、後ブ
ロックバッファ22内の後ブロックの次ブロックポイン
タが空ブロックを指せば前ブロックバッファ21内の前
ブロックの次ブロックポインタが指すブロックをデータ
ファイル1から後ブロックバッファ22に読み出し、後
ブロックバッファ22内の後ブロックの次ブロックポイ
ンタが空ブロックを指さなければ後ブロックバッファ2
2内の後ブロックを前ブロックバッファ21に転送した
後に前ブロックバッファ21内の前ブロックの次ブロッ
クポインタが指すブロックをデータファイル1から後ブ
ロックバッファ22に読み出す。
[0011] data block retrieval means 2, prior to manage the block buffer 21 and the rear block buffer 22,
Blocks from data file 1 according to the order relationship between blocks
Search for locks and replace the previous block with the previous block
Read out as the front block to the
The lock is read into the rear block buffer 22 as a rear block.
Protrude. More specifically, if the next block pointer of the subsequent block in the subsequent block buffer 22 points to an empty block , the data block search means 2 extracts the block indicated by the next block pointer of the previous block in the previous block buffer 21 from the data file 1 to the subsequent block. The data is read into the buffer 22, and if the next block pointer of the subsequent block in the subsequent block buffer 22 does not point to an empty block, the subsequent block buffer 2
After transferring the subsequent block in 2 to the previous block buffer 21, the block pointed to by the next block pointer of the previous block in the previous block buffer 21 is read from the data file 1 to the rear block buffer 22.

【0012】前ブロック残り容量取得手段3は、前ブロ
ックバッファ21内の前ブロックの残り容量(以下、前
ブロック残り容量という)を取得する。
The previous block remaining capacity obtaining means 3 obtains the remaining capacity of the previous block in the previous block buffer 21 (hereinafter referred to as the previous block remaining capacity).

【0013】前ブロック残り容量格納領域4は、前ブロ
ック残り容量取得手段3により取得された前ブロック残
り容量を格納する。
The previous block remaining capacity storage area 4 stores the previous block remaining capacity acquired by the previous block remaining capacity acquisition means 3.

【0014】後ブロック使用容量取得手段5は、後ブロ
ックバッファ22内の後ブロックの使用容量(以下、後
ブロック使用容量という)を取得する。
The post-block used capacity obtaining means 5 obtains the used capacity of the post-block in the post-block buffer 22 (hereinafter referred to as the post-block used capacity).

【0015】後ブロック使用容量格納領域6は、後ブロ
ック使用容量取得手段5により取得された後ブロック使
用容量を格納する。
The post-block used capacity storage area 6 stores the post-block used capacity obtained by the post-block used capacity obtaining means 5.

【0016】ブロック容量比較手段7は、前ブロック残
り容量格納領域4および後ブロック使用容量格納領域6
より前ブロック残り容量および後ブロック使用容量を取
得し、前ブロックバッファ21内の前ブロックの空き領
域に後ブロックバッファ22内の後ブロックの全てのデ
ータレコードが格納可能かどうかを判断し、格納不可の
場合にはデータブロック検索手段2を呼び出し、格納可
能の場合にはデータファイル更新手段8を呼び出す。
The block capacity comparing means 7 stores the previous block remaining capacity storage area 4 and the rear block used capacity storage area 6.
The remaining capacity of the previous block and the used capacity of the subsequent block are acquired, and it is determined whether or not all data records of the subsequent block in the subsequent block buffer 22 can be stored in the free area of the previous block in the previous block buffer 21, and cannot be stored. In this case, the data block search means 2 is called, and if the data can be stored, the data file updating means 8 is called.

【0017】データファイル更新手段8は、ブロック容
量比較手段7の比較結果により格納可能と判断された場
合にデータファイル1を更新する。
The data file updating means 8 updates the data file 1 when it is determined from the comparison result of the block capacity comparing means 7 that the data can be stored.

【0018】データレコード移送手段9は、データファ
イル更新手段8において、後ブロックバッファ22内の
後ブロックのデータレコードを前ブロックバッファ21
内の前ブロックの空き領域に移送する。
The data record transfer means 9 stores the data record of the subsequent block in the rear block buffer 22 in the front block buffer 21 in the data file updating means 8.
To the empty area of the previous block in

【0019】次ブロックポインタ更新手段10は、デー
タファイル更新手段8において、前ブロックバッファ2
1内の前ブロックの次ブロックポインタを後ブロックバ
ッファ22内の後ブロックの次ブロックポインタに書き
換える。
The next block pointer updating means 10 is provided in the data file updating means 8 so that the previous block buffer 2
1 is rewritten with the next block pointer of the previous block in the rear block buffer 22.

【0020】ブロック解放手段11は、データファイル
更新手段8において、後ブロックバッファ22内の後ブ
ロックを再利用可能な空ブロックとして解放する。
The block releasing means 11 releases the subsequent block in the rear block buffer 22 as a reusable empty block in the data file updating means 8.

【0021】ブロック上書き手段12は、データファイ
ル更新手段8において、前ブロックバッファ21内の前
ブロックおよび後ブロックバッファ22内の後ブロック
をデータファイル1の該当するブロックに上書きする。
The block overwriting means 12 overwrites the corresponding block of the data file 1 with the preceding block in the preceding block buffer 21 and the succeeding block in the following block buffer 22 in the data file updating means 8.

【0022】図2を参照すると、データブロック検索手
段2の処理は、先頭ブロック読出しステップS21と、
後ブロックの次ブロックポインタ取得ステップS22
と、次ブロックポインタ終了判定ステップS23と、次
ブロックポインタ空ブロック指示判定ステップS24
と、後ブロックの前ブロックバッファへの移送ステップ
S25と、前ブロックの次ブロックポインタ取得ステッ
プS26と、次ブロックポインタ指示ブロック読出しス
テップS27とからなる。
Referring to FIG. 2, the processing of the data block search means 2 includes a head block reading step S21,
Next block pointer acquisition step for subsequent block S22
, Next block pointer end determination step S23, next block pointer empty block indication determination step S24
, A step S25 of transferring the subsequent block to the previous block buffer, a step S26 of acquiring the next block pointer of the previous block, and a step S27 of reading the next block pointer designated block.

【0023】図3を参照すると、ブロック容量比較手段
7の処理は、前ブロック残り容量取得ステップS71
と、後ブロック使用容量取得ステップS72と、前ブロ
ック残り容量/後ブロック使用容量比較ステップS73
と、データブロック検索手段呼出しステップS74と、
データファイル更新手段呼出しステップS75とからな
る。
Referring to FIG. 3, the processing of the block capacity comparing means 7 includes a previous block remaining capacity acquisition step S71.
And a subsequent block used capacity acquisition step S72 and a previous block remaining capacity / rear block used capacity comparison step S73.
And data block search means calling step S74;
It comprises a data file updating means calling step S75.

【0024】図4を参照すると、データファイル更新手
段8の処理は、データレコード移送ステップS81と、
次ブロックポインタ更新ステップS82と、後ブロック
解放ステップS83と、データファイルへの上書きステ
ップS84と、データブロック検索手段呼出しステップ
S85とからなる。
Referring to FIG. 4, the processing of the data file updating means 8 includes a data record transfer step S81,
It comprises a next block pointer updating step S82, a subsequent block releasing step S83, a data file overwriting step S84, and a data block searching means calling step S85.

【0025】図5(a)および(b)は、本実施例のデ
ータレコード格納位置制御方式に基づいて、データファ
イル1の更新を行っていく際の、データファイル1内の
ブロックの状況を例示する図である。〜はデータレ
コードの格納順序を示し、ブロック番号01のブロック
ではおよびに相当するデータレコードが削除されて
おり、ブロック番号03のブロックではおよびに相
当するデータレコードが削除されている。なお、ブロッ
クの使用容量は先頭データレコードから最終データレコ
ードまでの容量を意味し、データレコード間に生じる空
き領域を含める。一方、ブロックの残り容量は最終デー
タレコードの後からのブロック内の残り容量を意味し、
データレコード間に生じる空き領域を含めない。
FIGS. 5A and 5B illustrate the status of blocks in the data file 1 when updating the data file 1 based on the data record storage position control method of the present embodiment. FIG. Indicates the storage order of the data records, and the data record corresponding to and is deleted in the block of block number 01, and the data record corresponding to and in the block of block number 03. The used capacity of a block means the capacity from the first data record to the last data record, and includes a free area generated between data records. On the other hand, the remaining capacity of the block means the remaining capacity in the block after the last data record,
Do not include the space that occurs between data records.

【0026】次に、このように構成された本実施例のデ
ータレコード格納位置制御方式の動作について説明す
る。
Next, the operation of the data record storage position control method of the present embodiment configured as described above will be described.

【0027】まず、データブロック検索手段2は、利用
者により指定されたデータファイル1の先頭ブロックを
後ブロックバッファ22に読み出す(ステップS2
1)。
First, the data block search means 2 reads the first block of the data file 1 designated by the user into the rear block buffer 22 (step S2).
1).

【0028】次に、データブロック検索手段2は、後ブ
ロックバッファ22内の後ブロックの次ブロックポイン
タを取得し(ステップS22)、次ブロックポインタが
次ブロックがないことを示す値LSTであるかどうかを
判定する(ステップS23)。
Next, the data block search means 2 acquires the next block pointer of the subsequent block in the subsequent block buffer 22 (step S22), and determines whether or not the next block pointer is a value LST indicating that there is no next block. Is determined (step S23).

【0029】次ブロックポインタが値LSTでなけれ
ば、データブロック検索手段2は、次ブロックポインタ
が後ブロックが空ブロックであることを示す値0である
かどうかを判定する(ステップS24)。
If the next block pointer is not the value LST, the data block search means 2 determines whether or not the next block pointer has a value 0 indicating that the succeeding block is an empty block (step S24).

【0030】次ブロックポインタが値0でなければ、デ
ータブロック検索手段2は、後ブロックバッファ22内
の後ブロックを前ブロックバッファ21に転送して前ブ
ロックとする(ステップS25)。
If the value of the next block pointer is not 0, the data block search means 2 transfers the subsequent block in the subsequent block buffer 22 to the previous block buffer 21 and sets it as the previous block (step S25).

【0031】続いて、データブロック検索手段2は、前
ブロックバッファ21内の前ブロックの次ブロックポイ
ンタを取得し(ステップS26)、取得した次ブロック
ポインタが指すブロックを後ブロックバッファ22に読
み出す(ステップS27)。
Subsequently, the data block search means 2 acquires the next block pointer of the previous block in the previous block buffer 21 (step S26), and reads out the block pointed to by the acquired next block pointer to the subsequent block buffer 22 (step S26). S27).

【0032】データブロック検索手段2により前ブロッ
クバッファ21に前ブロックが、後ブロックバッファ2
2に後ブロックがそれぞれ設定された状態になると、前
ブロック残り容量取得手段3は、前ブロックバッファ2
1内の前ブロックの前ブロック残り容量を取得し、前ブ
ロック残り容量格納領域4に格納する。
The previous block is stored in the front block buffer 21 by the data block search means 2,
When each of the subsequent blocks is set in the second block 2, the previous block remaining capacity obtaining means 3 sets the previous block buffer 2
The remaining capacity of the previous block of the previous block in 1 is obtained and stored in the previous block remaining capacity storage area 4.

【0033】また、後ブロック使用容量取得手段4は、
後ブロックバッファ22内の後ブロックの後ブロック使
用容量を取得し、後ブロック使用容量格納領域6に格納
する。
Further, the rear block used capacity obtaining means 4 comprises:
The post-block use capacity of the post-block in the post-block buffer 22 is acquired and stored in the post-block use capacity storage area 6.

【0034】続いて、ブロック容量比較手段7は、前ブ
ロック残り容量格納領域4および後ブロック使用容量格
納領域6より前ブロック残り容量および後ブロック使用
容量を取得し(ステップS71およびS72)、前ブロ
ックバッファ21内の前ブロックの空き領域に後ブロッ
クバッファ22内の後ブロックのすべてのデータレコー
ドが格納可能かどうかを判定する(ステップS73)。
Subsequently, the block capacity comparison means 7 obtains the previous block remaining capacity and the rear block used capacity from the previous block remaining capacity storage area 4 and the rear block used capacity storage area 6 (steps S71 and S72), and obtains the previous block. It is determined whether all data records of the subsequent block in the subsequent block buffer 22 can be stored in the free area of the previous block in the buffer 21 (step S73).

【0035】前ブロックバッファ21内の前ブロックの
空き領域に後ブロックバッファ22内の後ブロックのす
べてのデータレコードが格納可能でなければ、ブロック
容量比較手段7は、データブロック検索手段2を入り口
Aで呼び出し(ステップS74)、次の前ブロックおよ
び後ブロックを前ブロックバッファ21および後ブロッ
クバッファ22にそれぞれ格納させる。
If all data records of the subsequent block in the subsequent block buffer 22 cannot be stored in the free area of the previous block in the previous block buffer 21, the block capacity comparing means 7 sets the data block searching means 2 to the entrance A (Step S74), and the next preceding block and the following block are stored in the preceding block buffer 21 and the following block buffer 22, respectively.

【0036】一方、前ブロックバッファ21内の前ブロ
ックの空き領域に後ブロックバッファ22内の後ブロッ
クのすべてのデータレコードが格納可能であれば、ブロ
ック容量比較手段7は、データファイル更新手段8を呼
び出す(ステップS75)。
On the other hand, if all data records of the succeeding block in the succeeding block buffer 22 can be stored in the free area of the preceding block in the preceding block buffer 21, the block capacity comparing means 7 Called (step S75).

【0037】データファイル更新手段8は、まず、デー
タレコード移送手段9により、後ブロックバッファ22
内の後ブロックの全てのデータレコードを前ブロックバ
ッファ21内の前ブロックの空き領域に順次移送する
(ステップS81)。例えば、図5(a)に示すブロッ
ク番号03のブロック内ののデータレコードをブロッ
ク番号01のブロック内ののデータレコードの後に移
送して、図5(b)に示すようにする。
The data file updating means 8 firstly transmits data to the rear block buffer 22 by the data record transfer means 9.
All the data records of the subsequent block in the block are sequentially transferred to the free area of the previous block in the previous block buffer 21 (step S81). For example, the data record in the block with the block number 03 shown in FIG. 5A is transferred after the data record in the block with the block number 01, as shown in FIG. 5B.

【0038】次に、データファイル更新手段8は、次ブ
ロックポインタ更新手段10により、前ブロックバッフ
ァ21内の前ブロックの次ブロックポインタを後ブロッ
クバッファ22内の後ブロックの次ブロックポインタで
更新する(ステップS82)。例えば、図5(a)に示
すブロック番号03のブロック内の次ブロックポインタ
であるブロック番号02をブロック番号01のブロック
内の次ブロックポインタであるブロック番号03に上書
きして、図5(b)に示すように、ブロック番号01の
ブロック内の次ブロックポインタをブロック番号02と
する。
Next, in the data file updating means 8, the next block pointer updating means 10 updates the next block pointer of the previous block in the previous block buffer 21 with the next block pointer of the subsequent block in the rear block buffer 22 ( Step S82). For example, the block number 02 which is the next block pointer in the block with the block number 03 shown in FIG. 5A is overwritten with the block number 03 which is the next block pointer in the block with the block number 01, and FIG. , The next block pointer in the block with the block number 01 is set to the block number 02.

【0039】続いて、データファイル更新手段8は、ブ
ロック解放手段11により、後ブロックバッファ22内
の後ブロックの次ブロックポインタを空ブロックである
ことを示すブロック番号0に書き変えて、後ブロックを
再利用可能とする(ステップS83)。例えば、図5
(a)に示すブロック番号03のブロック内の次ブロッ
クポインタであるブロック番号02を、図5(b)に示
すようにブロック番号0とする。
Subsequently, the data file updating means 8 rewrites the next block pointer of the succeeding block in the succeeding block buffer 22 to the block number 0 indicating an empty block by the block releasing means 11, and It is made reusable (step S83). For example, FIG.
The block number 02 which is the next block pointer in the block with the block number 03 shown in FIG. 5A is set to the block number 0 as shown in FIG. 5B.

【0040】次に、データファイル更新手段8は、ブロ
ック上書き手段12により、前ブロックバッファ21内
の前ブロックおよび後ブロックバッファ22内の後ブロ
ックを、データファイル1内の該当するブロックにそれ
ぞれ上書きしてデータファイル1を更新する(ステップ
S84)。
Next, the data file updating means 8 overwrites the corresponding block in the data file 1 with the previous block in the previous block buffer 21 and the subsequent block in the rear block buffer 22 by the block overwriting means 12. To update the data file 1 (step S84).

【0041】最後に、データファイル更新手段8は、デ
ータブロック検索手段2を入り口Aで呼び出す(ステッ
プS85)。
Finally, the data file updating means 8 calls the data block retrieving means 2 at the entrance A (step S85).

【0042】データファイル更新手段8から呼び出され
ると、データブロック検索手段2は、後ブロックバッフ
ァ22内の後ブロックの次ブロックポインタを取得し
(ステップS22)、データファイル更新手段8から呼
び出された場合にはかならず次ブロックポインタが値0
になっているので(ステップS24でイエス)、後ブロ
ックバッファ22内の後ブロック(空ブロック)を前ブ
ロックバッファ21に移送することなく(ステップS2
5をスキップし)、前ブロックバッファ21内の前ブロ
ックの次ブロックポインタを取得し(ステップS2
6)、次ブロックポインタが指すブロックをデータファ
イル1から後ブロックバッファ22に読み出す(ステッ
プS27)。例えば、図5(b)に示すブロック番号0
1のブロック内の次ブロックポインタが指すブロック番
号02のブロックを後ブロックバッファ22に読み出
す。
When called from the data file updating means 8, the data block searching means 2 acquires the next block pointer of the succeeding block in the following block buffer 22 (step S22). The next block pointer always has the value 0
(YES in step S24), the rear block (empty block) in the rear block buffer 22 is not transferred to the front block buffer 21 (step S2).
5), and obtains the next block pointer of the previous block in the previous block buffer 21 (step S2).
6), the block pointed to by the next block pointer is read from the data file 1 to the subsequent block buffer 22 (step S27). For example, block number 0 shown in FIG.
The block of block number 02 indicated by the next block pointer in the block of 1 is read out to the subsequent block buffer 22.

【0043】このようにして、データブロック検索手段
2,前ブロック残り容量取得手段3,後ブロック使用容
量取得手段5,ブロック容量比較手段7およびデータフ
ァイル更新手段8の処理を繰り返し、データブロック検
索手段2のステップS23で次ブロックポインタが値L
STになれば、処理を終了する。
In this manner, the processing of the data block search means 2, the previous block remaining capacity acquisition means 3, the rear block use capacity acquisition means 5, the block capacity comparison means 7 and the data file update means 8 is repeated, and the data block search means In step S23 of step 2, the next block pointer is set to the value L.
When it comes to ST, the process ends.

【0044】なお、上記実施例では、次ブロックポイン
タをブロック番号としたが、これをブロック先頭アドレ
ス等の他のポインタとしても、本発明が同様に実現可能
であることはいうまでもない。
In the above embodiment, the next block pointer is a block number. However, it is needless to say that the present invention can be similarly implemented by using another pointer such as a block head address.

【0045】[0045]

【発明の効果】以上説明したように本発明は、データブ
ロック検索手段,前ブロックバッファ,後ブロックバッ
ファ,前ブロック残り容量取得手段,前ブロック残り容
量格納領域,後ブロック使用容量取得手段,後ブロック
使用容量格納領域,ブロック容量比較手段,データファ
イル更新手段,データレコード移送手段,次ブロックポ
インタ更新手段,ブロック解放手段およびブロック上書
き手段を設け、データファイル内の後ブロックの全ての
データレコードが前ブロックの空き領域に格納可能であ
る場合には、後ブロックの全てのデータレコードを前ブ
ロックの空き領域に移送して、後ブロックを空ブロック
として再利用可能とすることにより、各ブロック毎に管
理されるデータファイル内の不要な空き領域を収集し
て、ブロック単位に不要領域を記憶媒体上で再利用可能
な状態にすることが可能となるという効果がある。
As described above, the present invention provides a data block search means, a previous block buffer, a rear block buffer, a previous block remaining capacity acquisition means, a previous block remaining capacity storage area, a rear block used capacity acquisition means, and a rear block. A used capacity storage area, a block capacity comparing means, a data file updating means, a data record transferring means, a next block pointer updating means, a block releasing means and a block overwriting means are provided. When the data can be stored in the empty area of the next block, all data records of the subsequent block are transferred to the empty area of the previous block, and the subsequent block can be reused as an empty block, so that the data records are managed for each block. Collect unnecessary free space in the data file There is an effect that it is possible to the main area reusable state on the storage medium.

【0046】さらに、物理I/Oの単位であるブロック
毎にデータレコードの配置を制御することにより、デー
タファイル内のデータレコードの全件アクセス時の物理
I/Oが減り、アクセス効率の向上にもつながるという
利点がある。
Further, by controlling the arrangement of data records for each block, which is a unit of physical I / O, physical I / O at the time of accessing all data records in the data file is reduced, thereby improving access efficiency. Also has the advantage of being connected.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の一実施例に係るデータレコード格納位
置制御方式の構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a data record storage position control method according to an embodiment of the present invention.

【図2】図1中のデータブロック検索手段の処理を示す
流れ図である。
FIG. 2 is a flowchart showing a process of a data block search unit in FIG. 1;

【図3】図1中のブロック容量比較手段の処理を示す流
れ図である。
FIG. 3 is a flowchart showing a process of a block capacity comparing means in FIG. 1;

【図4】図1中のデータファイル更新手段の処理を示す
流れ図である。
FIG. 4 is a flowchart showing a process of a data file updating unit in FIG. 1;

【図5】(a)は本実施例のデータレコード格納位置制
御方式による処理前のデータファイル内のブロックの状
況を例示し、(b)は本実施例のデータレコード格納位
置制御方式による処理後のデータファイル内のブロック
の状況を例示する図である。
FIG. 5A illustrates the state of a block in a data file before processing according to the data record storage position control method according to the embodiment, and FIG. 5B illustrates the state after processing according to the data record storage position control method according to the embodiment. FIG. 8 is a diagram illustrating an example of the status of blocks in the data file of FIG.

【符号の説明】[Explanation of symbols]

1 データファイル 2 データブロック検索手段 3 前ブロック残り容量取得手段 4 前ブロック残り容量格納領域 5 後ブロック使用容量取得手段 6 後ブロック使用容量格納領域 7 ブロック容量比較手段 8 データファイル更新手段 9 データレコード移送手段 10 次ブロックポインタ更新手段 11 ブロック解放手段 12 ブロック上書き手段 21 前ブロックバッファ 22 後ブロックバッファ REFERENCE SIGNS LIST 1 data file 2 data block search means 3 previous block remaining capacity acquisition means 4 previous block remaining capacity storage area 5 rear block used capacity acquisition means 6 rear block used capacity storage area 7 block capacity comparison means 8 data file updating means 9 data record transfer Means 10 Next block pointer updating means 11 Block releasing means 12 Block overwriting means 21 Previous block buffer 22 Rear block buffer

Claims (3)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 データレコードを格納するための記憶領
域をデータファイル内でブロック単位に動的に確保し、
ブロック内に次ブロックポインタを持つことで、ブロッ
ク間の順序関係がデータファイル内で管理されるデータ
ファイルに対して、データレコードの格納位置を制御す
るデータレコード格納位置制御方式において、 前記データファイルからブロック間の順序関係に従って
ブロックを検索し、前側となるブロックを前ブロックバ
ッファに前ブロックとして読み出し、後ろ側となるブロ
ックを後ブロックバッファに後ブロックとして読み出す
データブロック検索手段と、 前ブロックバッファ内の前ブロックの前ブロック残り容
量を取得する前ブロック残り容量取得手段と、 この前ブロック残り容量取得手段により取得された前ブ
ロック残り容量を格納する前ブロック残り容量格納領域
と、 後ブロックバッファ内の後ブロックの後ブロック使用容
量を取得する後ブロック使用容量取得手段と、 この後ブロック使用容量取得手段により取得された後ブ
ロック使用容量を格納する後ブロック使用容量格納領域
と、 前記前ブロック残り容量格納領域および前記後ブロック
使用容量格納領域より前ブロック残り容量および後ブロ
ック使用容量を取得し前ブロックバッファ内の前ブロッ
クの空き領域に後ブロックバッファ内の後ブロックの全
てのデータレコードが格納可能かどうかを判断し、格納
不可の場合には前記データブロック検索手段を呼び出す
ブロック容量比較手段と、 このブロック容量比較手段により前ブロックバッファ内
の前ブロックの空き領域に後ブロックバッファ内の後ブ
ロックの全てのデータレコードが格納可能と判断された
場合に呼び出され前記データファイルを更新するデータ
ファイル更新手段と、 前記データファイル更新手段において、後ブロックバッ
ファ内の後ブロックのデータレコードを前ブロックバッ
ファ内の前ブロックの空き領域に移送するデータレコー
ド移送手段と、 前記データファイル更新手段において、前ブロックバッ
ファ内の前ブロックの次ブロックポインタを後ブロック
バッファ内の後ブロックの次ブロックポインタに書き換
える次ブロックポインタ更新手段と、 前記データファイル更新手段において、後ブロックバッ
ファ内の後ブロックを再利用可能な空ブロックとして解
放するブロック解放手段と、 前記データファイル更新手段において、前ブロックバッ
ファ内の前ブロックおよび後ブロックバッファ内の後ブ
ロックを前記データファイル内の該当するブロックに上
書きするブロック上書き手段とを有することを特徴とす
るデータレコード格納位置制御方式。
1. A storage area for storing a data record is dynamically secured in block units in a data file.
By having a next block pointer in a block, in a data record storage position control method for controlling a storage position of a data record for a data file in which the order relation between blocks is managed in the data file, According to the order relationship between the blocks
A block is searched, the block on the front side is read out to the previous block buffer as the previous block , and the block on the rear side is read.
Data block search means for reading a block as a subsequent block into a subsequent block buffer, a previous block remaining capacity obtaining means for obtaining a previous block remaining capacity of a previous block in a previous block buffer, and a previous block remaining capacity obtaining means. The previous block remaining capacity storage area for storing the previous block remaining capacity, the rear block used capacity obtaining means for obtaining the post-block used capacity in the rear block in the rear block buffer, and the post-block used capacity obtaining means A post-block used capacity storage area for storing a post-block used capacity; a pre-block in a pre-block buffer obtained by acquiring a pre-block remaining capacity and a post-block used capacity from the pre-block remaining capacity storage area and the post-block used capacity storage area; To the free area of the rear block buffer. It is determined whether or not all data records can be stored. If storage is not possible, a block capacity comparison unit that calls the data block search unit; A data file updating unit that is called when all the data records of the subsequent block in the subsequent block buffer are determined to be storable and updates the data file; A data record transfer means for transferring a data record to a free area of a previous block in a previous block buffer; and the data file updating means for setting a next block pointer of the previous block in the previous block buffer to a position next to the succeeding block in the subsequent block buffer. Rewrite to block pointer Next block pointer updating means, in the data file updating means, a block releasing means for releasing a subsequent block in a subsequent block buffer as a reusable empty block; and in the data file updating means, A block overwriting means for overwriting a block and a subsequent block in the subsequent block buffer with a corresponding block in the data file.
【請求項2】 前記データブロック検索手段が、後ブロ
ックバッファ内の後ブロックの次ブロックポインタが空
ブロックを指せば前ブロックバッファ内の前ブロックの
次ブロックポインタが指すブロックを前記データファイ
ルから後ブロックバッファに読み出し、後ブロックバッ
ファ内の後ブロックの次ブロックポインタが空ブロック
を指さなけければ後ブロックバッファ内の後ブロックを
前ブロックバッファに転送した後に前ブロックバッファ
内の前ブロックの次ブロックポインタが指すブロックを
前記データファイルから後ブロックバッファに読み出す
請求項1記載のデータレコード格納位置制御方式。
2. The data block search means according to claim 1, wherein, if the next block pointer of the next block in the next block buffer points to an empty block, the data block search unit searches the next block pointer of the next block of the previous block in the previous block buffer from the data file. If the next block pointer of the subsequent block in the subsequent block buffer does not point to an empty block, the next block pointer of the previous block in the previous block buffer is transferred after transferring the subsequent block in the subsequent block buffer to the previous block buffer. 2. The data record storage position control method according to claim 1, wherein the block indicated by the data record is read from the data file to a subsequent block buffer.
【請求項3】 前記次ブロックポインタが、ブロック番
号でなる請求項1記載のデータレコード格納位置制御方
式。
3. The data record storage position control method according to claim 1, wherein said next block pointer is a block number.
JP7087552A 1995-03-20 1995-03-20 Data record storage position control method Expired - Fee Related JP2658964B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7087552A JP2658964B2 (en) 1995-03-20 1995-03-20 Data record storage position control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7087552A JP2658964B2 (en) 1995-03-20 1995-03-20 Data record storage position control method

Publications (2)

Publication Number Publication Date
JPH08263339A JPH08263339A (en) 1996-10-11
JP2658964B2 true JP2658964B2 (en) 1997-09-30

Family

ID=13918159

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7087552A Expired - Fee Related JP2658964B2 (en) 1995-03-20 1995-03-20 Data record storage position control method

Country Status (1)

Country Link
JP (1) JP2658964B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008120359A1 (en) * 2007-03-29 2008-10-09 Fujitsu Limited Database management program

Also Published As

Publication number Publication date
JPH08263339A (en) 1996-10-11

Similar Documents

Publication Publication Date Title
US6311193B1 (en) Computer system
US4934823A (en) Staging method and system in electronic file apparatus
US5829014A (en) Method of supervising storage of data in a memory card having EEPROM and a memory card system using the same
JP3985430B2 (en) Database management apparatus and method
JP2658964B2 (en) Data record storage position control method
CN109325005B (en) Data processing method and electronic equipment
JP2003122646A (en) Ic card and memory access control method for ic card
JP4060639B2 (en) Data management device
US5978810A (en) Data management system and method for storing a long record in a set of shorter keyed records
JP2985385B2 (en) Image data retrieval system
JP2537706B2 (en) File system
JPH096653A (en) Data base checking information processor
JP2828354B2 (en) Database management device
JP2608093B2 (en) Data management device
JP2000148548A (en) Unnecessary record deleting device
JPS63311451A (en) Access system for low-speed access medium incapable of rewriting
JPH07200378A (en) Library file management equipment
JPH09152985A (en) Method and system for journal backup
JPH07219827A (en) Journal file division management system and method thereof
JP2944232B2 (en) Rollback recovery method
CN117194329A (en) Vehicle driving data storage access method, device and equipment
JPH04299749A (en) Magneto-optical disk system
JP2643918B2 (en) File recovery system
JPH0566976A (en) Master file managing system
JP2000099533A (en) File access method/system

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080606

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090606

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100606

Year of fee payment: 13

LAPS Cancellation because of no payment of annual fees