diff --git a/docs/Design/B+ Tree Layer.md b/docs/Design/B+ Tree Layer.md index 86ea12f8..bab757a4 100644 --- a/docs/Design/B+ Tree Layer.md +++ b/docs/Design/B+ Tree Layer.md @@ -981,7 +981,6 @@ int BPlusTree::splitInternal(int intBlockNum, InternalEntry internalEntries[]) { // set leftBlkHeader with the following values // - number of entries = (MAX_KEYS_INTERNAL)/2 = 50 - // - rblock = rightBlkNum // and update the header using BlockBuffer::setHeader() /* diff --git a/docs/Design/Buffer Layer/BlockBuffer.md b/docs/Design/Buffer Layer/BlockBuffer.md index ccf495a1..7ca6532b 100644 --- a/docs/Design/Buffer Layer/BlockBuffer.md +++ b/docs/Design/Buffer Layer/BlockBuffer.md @@ -233,7 +233,7 @@ int BlockBuffer::setHeader(struct HeadInfo *head){ #### Description -The block number to which this instance of `BlockBuffer` is associated (given by the `blockNum` member field) is freed from the buffer and the disk. The `blockNum` field of the object is invalidated (set to `INVALID_BLOCK` (-1)). +The block number to which this instance of `BlockBuffer` is associated (given by the `blockNum` member field) is freed from the buffer and the disk. The `blockNum` field of the object is invalidated (set to `INVALID_BLOCKNUM` (-1)). #### Arguments @@ -245,7 +245,7 @@ Nil :::caution note -- The `BlockBuffer` class is a higher level abstraction to the disk blocks. It makes use of the `StaticBuffer` to access/modify the values in the disk block. When `releaseBlock()` is called, the corresponding disk block is freed from the buffer(if present) and set as an unused block in the disk. However, the `BlockBuffer` object itself remains as is with its `blockNum` set to `INVALID_BLOCK`. This object is only deallocated at the end of it's lifetime. +- The `BlockBuffer` class is a higher level abstraction to the disk blocks. It makes use of the `StaticBuffer` to access/modify the values in the disk block. When `releaseBlock()` is called, the corresponding disk block is freed from the buffer(if present) and set as an unused block in the disk. However, the `BlockBuffer` object itself remains as is with its `blockNum` set to `INVALID_BLOCKNUM`. This object is only deallocated at the end of it's lifetime. - If `releaseBlock()` method is called again after having successfully released for the first time (or if the `blockNum` field is invalid), then this method will not perform any operation. ::: @@ -255,7 +255,7 @@ Nil ```cpp void BlockBuffer::releaseBlock(){ - // if blockNum is INVALID_BLOCK (-1), or it is invalidated already, do nothing + // if blockNum is INVALID_BLOCKNUM (-1), or it is invalidated already, do nothing // else /* get the buffer number of the buffer assigned to the block diff --git a/docs/Design/Schema Layer.md b/docs/Design/Schema Layer.md index c50264d7..dbf509c8 100644 --- a/docs/Design/Schema Layer.md +++ b/docs/Design/Schema Layer.md @@ -166,7 +166,7 @@ int Schema::deleteRel(char *relName) { // if the relation to delete is either Relation Catalog or Attribute Catalog, // return E_NOTPERMITTED // (check if the relation names are either "RELATIONCAT" and "ATTRIBUTECAT". - // you may use the following constants: RELCAT_NAME and ATTRCAT_NAME) + // you may use the following constants: RELCAT_RELNAME and ATTRCAT_RELNAME) // get the rel-id using appropriate method of OpenRelTable class by // passing relation name as argument @@ -218,7 +218,7 @@ int createIndex(char relName[ATTR_SIZE],char attrName[ATTR_SIZE]){ // if the relName is either Relation Catalog or Attribute Catalog, // return E_NOTPERMITTED // (check if the relation names are either "RELATIONCAT" and "ATTRIBUTECAT". - // you may use the following constants: RELCAT_NAME and ATTRCAT_NAME) + // you may use the following constants: RELCAT_RELNAME and ATTRCAT_RELNAME) // get the relation's rel-id using OpenRelTable::getRelId() method @@ -262,7 +262,7 @@ int Schema::dropIndex(char *relName, char *attrName) { // if the relName is either Relation Catalog or Attribute Catalog, // return E_NOTPERMITTED // (check if the relation names are either "RELATIONCAT" and "ATTRIBUTECAT". - // you may use the following constants: RELCAT_NAME and ATTRCAT_NAME) + // you may use the following constants: RELCAT_RELNAME and ATTRCAT_RELNAME) // get the rel-id using OpenRelTable::getRelId() @@ -322,7 +322,7 @@ int renameRel(char oldRelName[ATTR_SIZE], char newRelName[ATTR_SIZE]) { // if the oldRelName or newRelName is either Relation Catalog or Attribute Catalog, // return E_NOTPERMITTED // (check if the relation names are either "RELATIONCAT" and "ATTRIBUTECAT". - // you may use the following constants: RELCAT_NAME and ATTRCAT_NAME) + // you may use the following constants: RELCAT_RELNAME and ATTRCAT_RELNAME) // if the relation is open // (check if OpenRelTable::getRelId() returns E_RELNOTOPEN) @@ -367,7 +367,7 @@ int Schema::renameAttr(char *relName, char *oldAttrName, char *newAttrName) { // if the relName is either Relation Catalog or Attribute Catalog, // return E_NOTPERMITTED // (check if the relation names are either "RELATIONCAT" and "ATTRIBUTECAT". - // you may use the following constants: RELCAT_NAME and ATTRCAT_NAME) + // you may use the following constants: RELCAT_RELNAME and ATTRCAT_RELNAME) // if the relation is open // (check if OpenRelTable::getRelId() returns E_RELNOTOPEN) @@ -442,7 +442,7 @@ int closeRel(char relName[ATTR_SIZE]) { // if the relName is either Relation Catalog or Attribute Catalog, // return E_NOTPERMITTED // (check if the relation names are either "RELATIONCAT" and "ATTRIBUTECAT". - // you may use the following constants: RELCAT_NAME and ATTRCAT_NAME) + // you may use the following constants: RELCAT_RELNAME and ATTRCAT_RELNAME) // get the relation's rel-id using OpenRelTable::getRelationId() method diff --git a/docs/Roadmap/Stage01.md b/docs/Roadmap/Stage01.md index 47ce4cb2..27c3bda1 100644 --- a/docs/Roadmap/Stage01.md +++ b/docs/Roadmap/Stage01.md @@ -52,7 +52,7 @@ The [Disk class](../Design/Physical%20Layer.md#disk-class) has a _constructor_ a ## Reading and Writing -In this stage, we will try to use the provided Disk functions to do I/O operations on the disk. In your `mynitcbase` folder, you will find a `main.c` file. We will be editing this file to read and write from a random block on the disk. In the very first line of the `main` function, you will find a declaration of an instance of `Disk` class for reasons we mentioned earlier. The commented-out lines following this declaration are relevant only in later stages and will be covered in due time. +In this stage, we will try to use the provided Disk functions to do I/O operations on the disk. In your `mynitcbase` folder, you will find a `main.cpp` file. We will be editing this file to read and write from a random block on the disk. In the very first line of the `main` function, you will find a declaration of an instance of `Disk` class for reasons we mentioned earlier. The commented-out lines following this declaration are relevant only in later stages and will be covered in due time. As you read in [Disk model](../Design/Physical%20Layer.md#disk-model), each block of the disk is 2048 bytes. The disk functions expect two arguments: a buffer of size 2048 bytes and the block number that we want to work with. @@ -93,7 +93,7 @@ Additionally comment out the call to the `handleFrontend` function for now. We w So, in summary, your main function should look like so. -```cpp title="the modified main.c file" +```cpp title="the modified main.cpp file" int main(int argc, char *argv[]) { Disk disk_run; diff --git a/docs/Roadmap/Stage02.md b/docs/Roadmap/Stage02.md index 816bb855..36c5fdaa 100644 --- a/docs/Roadmap/Stage02.md +++ b/docs/Roadmap/Stage02.md @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) { -Now, let us implement the functions that we invoked from the `main()` function. Open the `BlockAccess.cpp` file in the `Buffer` folder and complete the following. +Now, let us implement the functions that we invoked from the `main()` function. Open the `BlockBuffer.cpp` file in the `Buffer` folder and complete the following.
Buffer/BlockBuffer.cpp diff --git a/docs/Roadmap/Stage04.md b/docs/Roadmap/Stage04.md index e3e7273c..1486f9dd 100644 --- a/docs/Roadmap/Stage04.md +++ b/docs/Roadmap/Stage04.md @@ -23,7 +23,7 @@ We discussed the relation and attribute cache in the previous stage. Your implem ## The Search Operation -A search operation involves fetching all records that satisfy some condition. This is also known as a selection operation in [relational algebra](https://en.wikipedia.org/wiki/Relational_algebra). NITCbase supports selection with the following operators: `=`, `!=`, `>`, `>=`, `<` `>=`. We'll implement a function that will do the appropriate search and return to us a record that satisfies our condition each time it's called. Higher levels can call this function repeatedly until there are no more records to be found. +A search operation involves fetching all records that satisfy some condition. This is also known as a selection operation in [relational algebra](https://en.wikipedia.org/wiki/Relational_algebra). NITCbase supports selection with the following operators: `=`, `!=`, `>`, `>=`, `<` `<=`. We'll implement a function that will do the appropriate search and return to us a record that satisfies our condition each time it's called. Higher levels can call this function repeatedly until there are no more records to be found. You might've realized that the above function would require some global state to work as intended. We'll need to keep track of the previously found record so that we can fetch the next record that satisfies the condition. And that is exactly what the `searchIndex` field in the relation cache does. `searchIndex` in a relation cache entry stores the `rec-id = {block, slot}` of the last hit during linear search on that relation. A value of `rec-id = {-1, -1}` indicates that the search should start over from the beginning again. @@ -518,5 +518,5 @@ SELECT * FROM Students INTO null WHERE Marks>=90; ```plain SELECT * FROM RELATIONCAT INTO null WHERE #Records > five; # Error: Mismatch in attribute type SELECT * FROM RELATIONCAT INTO null WHERE Name = Students; # Error: Attribute does not exist -SELECT * FROM Students INTO null WHERE Batch=J; # Error: Relation is not open +SELECT * FROM Participants INTO null WHERE regNo>0; # Error: Relation is not open ``` diff --git a/docs/Roadmap/Stage05.md b/docs/Roadmap/Stage05.md index 7617a3ce..d04de290 100644 --- a/docs/Roadmap/Stage05.md +++ b/docs/Roadmap/Stage05.md @@ -316,7 +316,7 @@ Selected successfully into null Selected successfully into null ``` -**Q3.** In this exercise, we will test the error conditions of the _open_ functionality. Run the following **in your NITCbase** to create some test relations. (You could make use of the [run](../User%20Interface%20Commands/utility.md#run-batch-execution-command) command to run multiple commands easily.) +**Q3.** In this exercise, we will test the error conditions of the _open_ functionality. Run the following **in your XFS interface** to create some test relations. (You could make use of the [run](../User%20Interface%20Commands/utility.md#run-batch-execution-command) command to run multiple commands easily.) ```sql create table a(id NUM); diff --git a/docs/Roadmap/Stage08.md b/docs/Roadmap/Stage08.md index 5e219f31..b83a06cb 100644 --- a/docs/Roadmap/Stage08.md +++ b/docs/Roadmap/Stage08.md @@ -321,7 +321,7 @@ Your NITCbase now supports the creation of relations. With that, we have now imp ## Exercises -**Q1.** In your NITCbase, run the file [s8test.txt](/roadmap_files/stage8/script.txt) to test your implementation. Place the files [products.csv](/roadmap_files/stage8/products.txt) and [stores.csv](/roadmap_files/stage8/stores.txt) in the `Files/Input_Files` directory. Place [s8test.txt](/roadmap_files/stage8/script.txt) in the `Files/Batch_Execution_Files` directory. Once you have placed the files, execute the [run](../User%20Interface%20Commands/utility.md#run-batch-execution-command) command in your NITCbase as below. +**Q1.** In your NITCbase, run the file [s8test.txt](/roadmap_files/stage8/script.txt) to test your implementation. Place the files [s8products.csv](/roadmap_files/stage8/products.txt) and [s8stores.csv](/roadmap_files/stage8/stores.txt) in the `Files/Input_Files` directory. Place [s8test.txt](/roadmap_files/stage8/script.txt) in the `Files/Batch_Execution_Files` directory. Once you have placed the files, execute the [run](../User%20Interface%20Commands/utility.md#run-batch-execution-command) command in your NITCbase as below. ``` run s8test.txt