From 01352d48aa7e953ae16724f5faf012ea27be295d Mon Sep 17 00:00:00 2001 From: Ameenafz248 <87686699+Ameenafz248@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:52:33 +0530 Subject: [PATCH 1/9] Update Stage05.md create table is not implemented in the nitcbase by this stage yet. --- docs/Roadmap/Stage05.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From c965ca5e422c374f7fea1c83fb45c27b6e527e90 Mon Sep 17 00:00:00 2001 From: Ameenafz248 <87686699+Ameenafz248@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:54:32 +0530 Subject: [PATCH 2/9] Update Stage01.md Changed the file name from main.c to main.cpp. --- docs/Roadmap/Stage01.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 6c919c8e972550bc27d7c85e9e88311c2e89f166 Mon Sep 17 00:00:00 2001 From: Ameenafz248 <87686699+Ameenafz248@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:56:49 +0530 Subject: [PATCH 3/9] Update Stage02.md Changed from BlockAccess.cpp to BlockBuffer.cpp --- docs/Roadmap/Stage02.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f5de8f8f5ddce5de492533425bab087180ac8260 Mon Sep 17 00:00:00 2001 From: Ameenafz248 <87686699+Ameenafz248@users.noreply.github.com> Date: Tue, 15 Aug 2023 17:04:35 +0530 Subject: [PATCH 4/9] Update Stage04.md Student relation has already been hardcoded as open in the previous exercise. --- docs/Roadmap/Stage04.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ``` From 84e2c9432fc7b27a1b22f64bdc3ec7af4e4beb33 Mon Sep 17 00:00:00 2001 From: Mohammed Ameen <87686699+Ameenafz248@users.noreply.github.com> Date: Tue, 15 Aug 2023 18:49:24 +0530 Subject: [PATCH 5/9] corrected mentioning of constant values changed RELCAT_NAME and ATTRCAT_NAME to RELCAT_RELNAME and ATTRCAT_RELNAME respectively. --- docs/Design/Schema Layer.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/Design/Schema Layer.md b/docs/Design/Schema Layer.md index c50264d7..0348a7be 100644 --- a/docs/Design/Schema Layer.md +++ b/docs/Design/Schema Layer.md @@ -1,4 +1,4 @@ ---- +/--- sidebar_position: 4 title: "Schema Layer" --- @@ -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 From e2a8557e8a8c2fb3a1566565f819ea457733f1a3 Mon Sep 17 00:00:00 2001 From: Mohammed Ameen <87686699+Ameenafz248@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:44:49 +0530 Subject: [PATCH 6/9] change INVALID_BLOCK to INVALID_BLOCKNUM --- docs/Design/Buffer Layer/BlockBuffer.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From 604379442e1fefa46acc8f8f7e172586171e82f4 Mon Sep 17 00:00:00 2001 From: Mohammed Ameen <87686699+Ameenafz248@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:41:42 +0530 Subject: [PATCH 7/9] Update Stage08.md changed to products.csv and stores.csv to s8products.csv and s8stores.csv respectively to match the naming within the s8test.txt file --- docs/Roadmap/Stage08.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 10ef2093a0c83808a3ae5d3cae28e901a59deb5f Mon Sep 17 00:00:00 2001 From: Mohammed Ameen <87686699+Ameenafz248@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:06:17 +0530 Subject: [PATCH 8/9] Update Schema Layer.md --- docs/Design/Schema Layer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Design/Schema Layer.md b/docs/Design/Schema Layer.md index 0348a7be..dbf509c8 100644 --- a/docs/Design/Schema Layer.md +++ b/docs/Design/Schema Layer.md @@ -1,4 +1,4 @@ -/--- +--- sidebar_position: 4 title: "Schema Layer" --- From b6f0d1a5baf83b6635bb160c886ff68d1247463d Mon Sep 17 00:00:00 2001 From: Mohammed Ameen <87686699+Ameenafz248@users.noreply.github.com> Date: Sun, 3 Sep 2023 07:58:56 +0530 Subject: [PATCH 9/9] Update B+ Tree Layer.md rblock and lblock has no significance for an internal index block --- docs/Design/B+ Tree Layer.md | 1 - 1 file changed, 1 deletion(-) 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() /*