From 179083fc80f0bef945316dbd867a87a6dffadacb Mon Sep 17 00:00:00 2001 From: Lunastra Date: Tue, 30 Nov 2021 23:59:10 -0800 Subject: [PATCH 1/6] Add perfomance test case for different block size --- src/dbCode/Performance.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/dbCode/Performance.txt diff --git a/src/dbCode/Performance.txt b/src/dbCode/Performance.txt new file mode 100644 index 0000000..600a3ca --- /dev/null +++ b/src/dbCode/Performance.txt @@ -0,0 +1,7 @@ +Number of Records: 3,318,784 +Uncompressed size: 683.00 MB +Block Size Time Space(MB) +2KB 3m 47s 207ms 181.63 +4KB 2m 42s 961ms 159.50 +8KB 57s 572ms 342.50 +16KB From 641e43030e9e7e470add191645c88a8e253f5926 Mon Sep 17 00:00:00 2001 From: Lunastra Date: Tue, 30 Nov 2021 23:59:59 -0800 Subject: [PATCH 2/6] Add sql code for different sizes --- src/dbCode/Bigtable.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/dbCode/Bigtable.txt b/src/dbCode/Bigtable.txt index 16aaf2a..8e753c3 100644 --- a/src/dbCode/Bigtable.txt +++ b/src/dbCode/Bigtable.txt @@ -22,6 +22,20 @@ ALTER TABLE key_block_size_8 key_block_size=8 row_format=compressed; INSERT INTO key_block_size_8 SELECT * FROM big_table; commit; +-- Create a new table that is the same but compressed 16KB block size +CREATE TABLE key_block_size_16 LIKE big_table; +ALTER TABLE key_block_size_16 key_block_size=16 row_format=compressed; +-- Insert 3 millions row into the table to compressed +INSERT INTO key_block_size_16 SELECT * FROM big_table; +commit; + +-- Create a new table that is the same but compressed 4KB block size +CREATE TABLE key_block_size_4 LIKE big_table; +ALTER TABLE key_block_size_4 key_block_size=4 row_format=compressed; +-- Insert 3 millions row into the table to compressed +INSERT INTO key_block_size_4 SELECT * FROM big_table; +commit; + drop table key_block_size_4; SELECT * FROM information_schema.INNODB_CMP; From 296f7756cee292c4a75752aa8763a71b99d6bc4a Mon Sep 17 00:00:00 2001 From: Lunastra Date: Fri, 3 Dec 2021 14:28:12 -0800 Subject: [PATCH 3/6] Add display statement to file --- src/dbCode/Bigtable.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dbCode/Bigtable.txt b/src/dbCode/Bigtable.txt index 8e753c3..011f4b7 100644 --- a/src/dbCode/Bigtable.txt +++ b/src/dbCode/Bigtable.txt @@ -43,4 +43,8 @@ SELECT * FROM information_schema.INNODB_CMPMEM; select count(*) as count_row from big_table; -select count(*) as count_row from key_block_size_8; \ No newline at end of file +select count(*) as count_row from key_block_size_8; + +-- For the console +-- SELECT * FROM information_schema.INNODB_CMPMEM\G +-- SELECT * FROM information_schema.INNODB_CMP\G \ No newline at end of file From 2dabab9b53823772475da144b9bbad4358be340d Mon Sep 17 00:00:00 2001 From: Lunastra Date: Fri, 3 Dec 2021 20:07:48 -0800 Subject: [PATCH 4/6] Update gitignore file to ignore vsCode files --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a2fb5e8..6f55928 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ *.idea venv/ HaskellCode/.vscode/tasks.json -Notes/ \ No newline at end of file +Notes/ + +.vscode/* +!.vscode/launch.json \ No newline at end of file From bcfedfec60078b466093868a78360a1ebb7a73a3 Mon Sep 17 00:00:00 2001 From: Lunastra Date: Fri, 3 Dec 2021 20:12:17 -0800 Subject: [PATCH 5/6] Add VisualStudio ignore files --- .gitignore | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 390 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6f55928..5548ce4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,393 @@ HaskellCode/.vscode/tasks.json Notes/ .vscode/* -!.vscode/launch.json \ No newline at end of file +!.vscode/launch.json + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Nuget personal access tokens and Credentials +# nuget.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +.idea/ +*.sln.iml \ No newline at end of file From 96224ef96f96bc10b6ecec3af009b770a7b25611 Mon Sep 17 00:00:00 2001 From: Lunastra Date: Fri, 3 Dec 2021 20:16:05 -0800 Subject: [PATCH 6/6] Add Factory Design pattern Factory design patter is added Some print line for place holder Need to imiplement Private instances --- src/Archive/.vscode/launch.json | 26 ++++++++++++++ src/Archive/.vscode/tasks.json | 42 +++++++++++++++++++++++ src/Archive/app/ArchiveController.cs | 51 ++++++++++++++++++++++++++++ src/Archive/app/DataSourceFactory.cs | 18 ++++++++++ src/Archive/app/Factory.cs | 6 ++++ src/Archive/app/IDataSource.cs | 15 ++++++++ src/Archive/app/NewFactory.cs | 0 src/Archive/app/SQLSource.cs | 41 ++++++++++++++++++++++ src/Archive/app/TxtSource.cs | 29 ++++++++++++++++ src/Archive/app/app.csproj | 10 ++++++ 10 files changed, 238 insertions(+) create mode 100644 src/Archive/.vscode/launch.json create mode 100644 src/Archive/.vscode/tasks.json create mode 100644 src/Archive/app/ArchiveController.cs create mode 100644 src/Archive/app/DataSourceFactory.cs create mode 100644 src/Archive/app/Factory.cs create mode 100644 src/Archive/app/IDataSource.cs create mode 100644 src/Archive/app/NewFactory.cs create mode 100644 src/Archive/app/SQLSource.cs create mode 100644 src/Archive/app/TxtSource.cs create mode 100644 src/Archive/app/app.csproj diff --git a/src/Archive/.vscode/launch.json b/src/Archive/.vscode/launch.json new file mode 100644 index 0000000..7fc25d8 --- /dev/null +++ b/src/Archive/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/app/bin/Debug/net6.0/app.dll", + "args": [], + "cwd": "${workspaceFolder}/app", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/src/Archive/.vscode/tasks.json b/src/Archive/.vscode/tasks.json new file mode 100644 index 0000000..e2af24a --- /dev/null +++ b/src/Archive/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/app/app.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/app/app.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/app/app.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/src/Archive/app/ArchiveController.cs b/src/Archive/app/ArchiveController.cs new file mode 100644 index 0000000..bad7df0 --- /dev/null +++ b/src/Archive/app/ArchiveController.cs @@ -0,0 +1,51 @@ +using System; + +namespace app +{ + class ArchiveController{ + static void Main(string[] args) + { + string dsName = "SQL"; + string cmd = ""; + Console.WriteLine("Hello World!"); + + //SQLConnection myconnection = new SQLConnection(); + + // Creating a DataSource Factory to make Data sources + DataSourceFactory dsFactory = new DataSourceFactory(); + + // Creating a SQL data source objects to gain access to the SQL database + IDataSource dataSource = dsFactory.getDataSource("SQL"); + + // Read from the database + dataSource.ReadData("a"); + + // Write to the database + dataSource.WriteData("Insert newName"); + + // Update the datasource + dataSource.UpdateData(); + + // Delete from the datasource + dataSource.DeleteData(); + + Console.WriteLine("-----------------"); + // Creating a Data Source for text files + IDataSource txtSource = dsFactory.getDataSource("txt"); + + // Read from the database + txtSource.ReadData("a"); + + // Write to the database + txtSource.WriteData("a"); + + // Update the datasource + txtSource.UpdateData(); + + // Delete from the datasource + txtSource.DeleteData(); + + } + } + +} diff --git a/src/Archive/app/DataSourceFactory.cs b/src/Archive/app/DataSourceFactory.cs new file mode 100644 index 0000000..b2d10b7 --- /dev/null +++ b/src/Archive/app/DataSourceFactory.cs @@ -0,0 +1,18 @@ + +class DataSourceFactory{ + public IDataSource getDataSource(string name){ + + if (name == "SQL"){ + return new SQLSource(); + } + else if (String.Equals(name, "TXT", StringComparison.OrdinalIgnoreCase)){ + return new TxtSource(); + } + else if(name == "XML"){ + return null; + } + else { + return null; + } + } +} \ No newline at end of file diff --git a/src/Archive/app/Factory.cs b/src/Archive/app/Factory.cs new file mode 100644 index 0000000..3b306b9 --- /dev/null +++ b/src/Archive/app/Factory.cs @@ -0,0 +1,6 @@ + +abstract class Factory{ + + //Method to make a datasource object + public abstract IDataSource getDataSource(string name); +} \ No newline at end of file diff --git a/src/Archive/app/IDataSource.cs b/src/Archive/app/IDataSource.cs new file mode 100644 index 0000000..6c8bf88 --- /dev/null +++ b/src/Archive/app/IDataSource.cs @@ -0,0 +1,15 @@ + +interface IDataSource{ + + // Method for reading data, return 0 for sucessful operation + int ReadData(string cmd); + + // Method for Writing data to a data source + int WriteData(string cmd); + + //Method for deleteing data from a data source, 0 for successful + int DeleteData(); + + // Method for updating data from a data source, 0 for sucessful + int UpdateData(); +} \ No newline at end of file diff --git a/src/Archive/app/NewFactory.cs b/src/Archive/app/NewFactory.cs new file mode 100644 index 0000000..e69de29 diff --git a/src/Archive/app/SQLSource.cs b/src/Archive/app/SQLSource.cs new file mode 100644 index 0000000..feb9870 --- /dev/null +++ b/src/Archive/app/SQLSource.cs @@ -0,0 +1,41 @@ + +class SQLSource : IDataSource{ + //private SQLConnection conn; + + // public SQLSource(){ + // conn = new SQLConnection("usernamePasword"); + // } + + public int ReadData(string cmd){ + try{ + // conn.open(); + // conn.Execute(); + Console.WriteLine("Access a SQL database"); + Console.WriteLine("Select * from archive"); + + // while (myReader) + // Print to console + // conn.close(); + return 0; + } + catch (Exception e){ + Console.WriteLine(e.Message); + return -1; + } + } + + public int WriteData(string cmd){ + Console.WriteLine("Writing data to a SQL database"); + return 0; + } + + public int DeleteData() { + Console.WriteLine("Deleting data from a SQL database"); + return 0; + } + + public int UpdateData() { + Console.WriteLine("Update data to a SQL database"); + return 0; + } +} \ No newline at end of file diff --git a/src/Archive/app/TxtSource.cs b/src/Archive/app/TxtSource.cs new file mode 100644 index 0000000..84bc3f0 --- /dev/null +++ b/src/Archive/app/TxtSource.cs @@ -0,0 +1,29 @@ + +class TxtSource : IDataSource{ + private string fileName; + public int ReadData(string a){ + try{ + Console.WriteLine("Access a text file"); + return 0; + } + catch (Exception e){ + Console.WriteLine(e.Message); + return -1; + } + } + + public int WriteData(string cmd){ + Console.WriteLine("Writing data to a text file"); + return 0; + } + + public int DeleteData() { + Console.WriteLine("Deleting data from a text file"); + return 0; + } + + public int UpdateData() { + Console.WriteLine("Update data to a text file"); + return 0; + } +} \ No newline at end of file diff --git a/src/Archive/app/app.csproj b/src/Archive/app/app.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/src/Archive/app/app.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + +