xSQL Sample Raid

This sample demonstrates a configuration involving a persistent database server using a RAID-0 disk system for storage with a static dictionary defined in the xsql.cfg file. The database is stored in files, which may be located on different physical devices.

The config file looks like the following:

 
    #
    #  Simple In-Memory configuration
    #
    database_name : diskdb,
    devices : [
     {
     type : memory,
     assignment : database,
     name : "diskdb-db",
     size : 10m
     },
     {
     type : memory,
     assignment : cache,
     name : "diskdb-cache",
     size : 10m
     },
     {
     type : file,
     assignment : log,
     name : "diskdb.log"
     },
     {
     type : raid,
     assignment : persistent,
     level : 0,
     name : "file1.dbs"
     },
     {
     type : raid,
     assignment : persistent,
     level : 0,
     segment_size : 10m,
     name : "file2.dbs"
     }
     ],
     
     runtime_configuration : {
         debug_library : false,
         disk_support : true,
         shared_memory : false,
         transaction_manager : mursiw
       },
     schema : "
     #define uint2     unsigned<2>
     
     declare database  locatedb;
     
     class Employee
     {
       string name;
       uint2 dept_no;
       
       unique tree<name> Iname;
       tree<dept_no>     Idept;
     };
     ",
     db_params: {
         mem_page_size : 512,
         disk_page_size : 8192
     },
     
     sql_trace : false,
     sql_port : 5500,
     sql_statements : "INSERT INTO Employee(name, dept_no) VALUES (['Luke Skywalker', 'Han Solo', 'Darth Vader'], [1,1,2]);"
             

Note that section schema defines the database with inline DDL text and the sql_statements section specifies the SQL statements to be executed once the database has been created.

This sample can be run from directory samples\xsql\configs\raid with the following command:

 
    ..\..\..\..\target\bin\xsql -c xsql.cfg -i
     

With xSQL started in interactive mode, we can now execute SQL statements. For example:

 
    XSQL>select * from Employee;
    name    dept_no
    ------------------------------------------------------------------------------
    Darth Vader     2
    Han Solo        1
    Luke Skywalker  1
     
    Selected records: 3