This commit is contained in:
Im_Alpha 2021-12-03 14:25:57 -08:00
commit 5be774e5ab
28 changed files with 412 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 314 KiB

23
doc/Images/references.txt Normal file
View File

@ -0,0 +1,23 @@
https://aws.amazon.com/rds/
https://aws.amazon.com/rds/features/#administration
https://docs.microsoft.com/en-us/azure/mariadb/concepts-supported-versions
https://cloud.google.com/sql/pricing
https://calculator.aws/#/createCalculator/RDSMariaDB
https://azure.microsoft.com/en-us/pricing/calculator/
https://aws.amazon.com/about-aws/whats-new/2019/06/rds-storage-auto-scaling/
https://aws.amazon.com/blogs/database/scaling-your-amazon-rds-instance-vertically-and-horizontally/
https://cloud.google.com/architecture/elastically-scaling-your-mysql-environment
https://techcommunity.microsoft.com/t5/azure-database-support-blog/how-to-auto-scale-azure-sql-databases/ba-p/2235441
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.MultiAZ.html
https://docs.microsoft.com/en-us/azure/security/fundamentals/encryption-overview
https://cloud.google.com/security/encryption/default-encryption
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Encryption.html
https://cloud.google.com/compute/docs/regions-zones
https://docs.microsoft.com/en-us/azure/availability-zones/az-overview
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
https://azure.microsoft.com/en-us/pricing/details/bandwidth/
https://aws.amazon.com/ec2/pricing/on-demand/
https://cloud.google.com/vpc/network-pricing
https://azure.microsoft.com/en-us/pricing/details/azure-sql-database/single/
https://azure.microsoft.com/en-us/pricing/details/azure-sql-managed-instance/single/

BIN
doc/LowLevel/archiving.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,49 @@
title Use Case: Archiving
participant ArchiveController.cs
participant DataConnection
participant DataSourceFactory
participant SQLSource
participant MariaDB
activate ArchiveController.cs
activate DataConnection
ArchiveController.cs ->DataConnection:static DataConnection getDataConnection()
DataConnection -->ArchiveController.cs:return DataConnection
deactivate DataConnection
activate DataSourceFactory
DataSourceFactory ->DataSourceFactory:DataSourceFactory()\nconstructor
ArchiveController.cs <-- DataSourceFactory:return DataSourceFactory
deactivate DataSourceFactory
activate SQLSource
ArchiveController.cs->SQLSource: IDataSource DataSourceFact.GetDataSource(String sourceName)
SQLSource->SQLSource: SQLSource()\nconstructor
SQLSource --> ArchiveController.cs :return SQLSource
loop #lightblue while true
alt #lightgreen date == 1
ArchiveController.cs -> SQLSource: int Compress(DataConnection conn, IDataSource ds, String logList[])
activate MariaDB
alt #lightgreen archive == 0
SQLSource -> MariaDB: int createArchive(DataConnection conn, String SQLcmd)
MariaDB -->SQLSource:return 0
end
SQLSource ->SQLSource: int updateArchive(DataConnection conn, String logList[])
SQLSource ->MariaDB: int CopremovyEntries(DataConnection conn, String logList[])
MariaDB --> SQLSource: return 0
SQLSource ->MariaDB: int RemoveEntries(DataConnection conn, String logList[])
MariaDB-->SQLSource:return 0
end
deactivate MariaDB
SQLSource-->ArchiveController.cs:return 0
end
deactivate ArchiveController.cs
deactivate SQLSource

BIN
doc/LowLevel/archiving2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,44 @@
title Use Case: Archiving
participant ArchiveController.cs
participant DataSourceFactory
participant SQLSource
participant MariaDB
activate ArchiveController.cs
ArchiveController.cs->DataSourceFactory:new DataSourceFactory()
activate DataSourceFactory
DataSourceFactory ->DataSourceFactory:DataSourceFactory()\nconstructor
ArchiveController.cs <-- DataSourceFactory:return DataSourceFactory
deactivate DataSourceFactory
activate SQLSource
ArchiveController.cs->SQLSource: IDataSource DataSourceFact.GetDataSource(String sourceName)
SQLSource->SQLSource: SQLSource()\nconstructor
SQLSource --> ArchiveController.cs :return SQLSource
loop #lightblue while true
alt #lightgreen date == 1
ArchiveController.cs -> SQLSource: int Compress(DataConnection conn, IDataSource ds, String logList[])
activate MariaDB
alt #lightgreen archive == 0
SQLSource -> MariaDB: int createArchive(DataConnection conn, String SQLcmd)
MariaDB -->SQLSource:return 0
end
SQLSource ->SQLSource: int updateArchive(DataConnection conn, String logList[])
SQLSource ->MariaDB: int CopremovyEntries(DataConnection conn, String logList[])
MariaDB --> SQLSource: return 0
SQLSource ->MariaDB: int RemoveEntries(DataConnection conn, String logList[])
MariaDB-->SQLSource:return 0
end
deactivate MariaDB
SQLSource-->ArchiveController.cs:return 0
end
deactivate ArchiveController.cs
deactivate SQLSource

View File

@ -0,0 +1,63 @@
title Use Case: Archiving
participant ArchiveController.cs
participant DataConnection
participant DataSourceFactory
participant SQLSource
participant MariaDB
activate ArchiveController.cs
ArchiveController.cs ->DataConnection:static DataConnection getDataConnection()
DataConnection -->ArchiveController.cs:return DataConnection
ArchiveController.cs->DataSourceFactory:new DataSourceFactory()
activate DataSourceFactory
DataSourceFactory ->DataSourceFactory:DataSourceFactory()\nconstructor
ArchiveController.cs <-- DataSourceFactory:return DataSourceFactory
deactivate DataSourceFactory
activate SQLSource
ArchiveController.cs->SQLSource: IDataSource DataSourceFact.GetDataSource(String sourceName)
SQLSource->SQLSource: SQLSource()\nconstructor
SQLSource --> ArchiveController.cs :return SQLSource
loop #lightblue while true
alt #lightgreen date == 1
ArchiveController.cs -> SQLSource: int Compress(DataConnection conn, IDataSource ds, String logList[])
activate MariaDB
alt #lightgreen archive == 0 (If Archive have not exist already
SQLSource -> MariaDB: int createArchive(DataConnection conn, String SQLcmd)
SQLSource <-- MariaDB:return 0
end
alt #red No error when doing executing copy SQL command
SQLSource ->SQLSource: int updateArchive(DataConnection conn, String logList[])
SQLSource ->MariaDB: int CopremovyEntries(DataConnection conn, String logList[])
MariaDB --> SQLSource: return 0
SQLSource -->ArchiveController.cs: return 0
else Error occur when executing copy SQL command on Database
MariaDB -->SQLSource: throw SQLException
SQLSource -->ArchiveController.cs: throw SQLException
ArchiveController.cs ->ArchiveController.cs: Console.WriteLine(SQLException.Message) \n (As a form of handling error)
end
alt #red No error when doing executing remove SQL command
SQLSource ->MariaDB: int RemoveEntries(DataConnection conn, String logList[])
MariaDB-->SQLSource:return 0
SQLSource -->ArchiveController.cs: return 0
else Error occur when executing removing SQL command on Database
MariaDB -->SQLSource: throw SQLException
SQLSource -->ArchiveController.cs: throw SQLException
ArchiveController.cs ->ArchiveController.cs: Console.WriteLine(SQLException.Message) \n (As a form of handling error)
end
end
deactivate MariaDB
SQLSource-->ArchiveController.cs:return 0
end
deactivate ArchiveController.cs
deactivate SQLSource

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
doc/Resources/IJ0350020.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
https://csu-lb.primo.exlibrisgroup.com/permalink/01CALS_ULB/dfriqe/cdi_proquest_journals_2512916339
https://csu-lb.primo.exlibrisgroup.com/permalink/01CALS_ULB/dfriqe/cdi_nrf_kci_oai_kci_go_kr_ARTI_4401754

32
src/dbCode/Bigtable.txt Normal file
View File

@ -0,0 +1,32 @@
-- Create an uncompressed table with a million or two rows. (3 millions row)
CREATE TABLE big_table AS SELECT * FROM information_schema.columns;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
INSERT INTO big_table SELECT * FROM big_table;
-- How many rows does this has?
SELECT count(*) FROM information_schema.columns;
-- Create a new table that is the same but compressed
CREATE TABLE key_block_size_8 LIKE big_table;
ALTER TABLE key_block_size_8 key_block_size=8 row_format=compressed;
-- Insert 3 millions row into the table to compressed
INSERT INTO key_block_size_8 SELECT * FROM big_table;
commit;
drop table key_block_size_4;
SELECT * FROM information_schema.INNODB_CMP;
SELECT * FROM information_schema.INNODB_CMPMEM;
select count(*) as count_row from big_table;
select count(*) as count_row from key_block_size_8;

57
src/dbCode/archiving.sql Normal file
View File

@ -0,0 +1,57 @@
create table archive
(
LtimeStamp datetime null,
logID int not null
primary key,
LvName varchar(50) not null,
catName varchar(50) not null,
userOP varchar(50) not null,
logMessage varchar(255) not null
);
create table logcategories
(
catName varchar(50) not null
primary key,
catComment varchar(255) not null
);
create table loglevel
(
LvName varchar(50) not null
primary key,
LvComment varchar(500) not null
);
create table log
(
LtimeStamp datetime default current_timestamp() null,
logID int auto_increment
primary key,
LvName varchar(50) not null,
catName varchar(50) not null,
userOP varchar(50) not null,
logMessage varchar(255) not null,
constraint LogCatName_fk
foreign key (catName) references logcategories (catName),
constraint LogLvName_fk
foreign key (LvName) references loglevel (LvName)
);
create table persons
(
PersonID int null,
LastName varchar(255) null,
FirstName varchar(255) null,
Address varchar(255) null,
City varchar(255) null
);
create table users
(
user_id int not null
primary key,
b varchar(200) null
);

103
src/dbCode/archivingDDL.txt Normal file
View File

@ -0,0 +1,103 @@
create schema Hobby;
SET Global innodb_file_per_table=ON;
-- SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_default_row_format='dynamic';
SET GLOBAL innodb_compression_algorithm='zlib';
-- Check for system settings
SHOW VARIABLES LIKE 'innodb_compression_algorithm';
SHOW VARIABLES LIKE 'innodb_default_row_format';
SHOW VARIABLES LIKE '%innodb%';
CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
CREATE DATABASE testDB;
-- Hobby DDL
-- Log level table
create table LogLevel
(
LvName varchar(50) not null,
LvComment varchar(500) not null,
constraint LogLevel_pk
primary key (LvName)
);
-- Log categories table
create table LogCategories
(
catName varchar(50) not null,
catComment varchar(255) not null,
constraint LogCategories_pk primary key (catName)
);
-- DDL for log table
create table Log
(
LtimeStamp datetime default CURRENT_TIMESTAMP null,
logID int auto_increment not null,
LvName varchar(50) not null,
catName varchar(50) not null,
userOP varchar(50) not null,
logMessage varchar(255) not null,
constraint LogLvName_fk foreign key (LvName) references loglevel (LvName),
constraint LogCatName_fk foreign key (catName) references logcategories (catName),
constraint Log_pk primary key (logID)
);
create table Archive
(
LtimeStamp datetime null,
logID int not null,
LvName varchar(50) not null,
catName varchar(50) not null,
userOP varchar(50) not null,
logMessage varchar(255) not null,
constraint Archive_pk primary key (logID)
)
ENGINE=InnoDB
PAGE_COMPRESSED=1
PAGE_COMPRESSION_LEVEL=9;
drop table archive;
-- Dummy data for testing purposes
-- Log categories data
INSERT into logcategories(catName, catComment) values
('View', 'view layer'),
('Business', 'business layer'),
('Server', 'server layer'),
('Data', 'data layer');
-- Log level data
INSERT into loglevel(lvname, lvcomment) values
('Info', 'some sys flow'),
('Debug', 'info for fixing bugs'),
('Warning', 'track system failure'),
('Error', 'some sys errors');
-- Log table data
INSERT into log(lvname, catname, userop, logmessage) values
('Info', 'View', 'create some projects', 'new account created'),
('Info', 'Business', 'create some projects', 'new projects made'),
('Info', 'View', 'log out', 'log out successful'),
('Info', 'Business', 'log in', 'log in successfully'),
('Info', 'View', 'search for projects', 'result return');
select * from logcategories;
select * from log;

39
src/dbCode/arhiving.sql Normal file
View File

@ -0,0 +1,39 @@
create table logcategories
(
catName varchar(50) not null
primary key,
catComment varchar(255) not null
);
create table loglevel
(
LvName varchar(50) not null
primary key,
LvComment varchar(500) not null
);
create table log
(
LtimeStamp datetime default current_timestamp() null,
logID int auto_increment
primary key,
LvName varchar(50) not null,
catName varchar(50) not null,
userOP varchar(50) not null,
logMessage varchar(255) not null,
constraint LogCatName_fk
foreign key (catName) references logcategories (catName),
constraint LogLvName_fk
foreign key (LvName) references loglevel (LvName)
);
create table persons
(
PersonID int null,
LastName varchar(255) null,
FirstName varchar(255) null,
Address varchar(255) null,
City varchar(255) null
);