Merge remote-tracking branch 'origin/TRANSLATE_0001'
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
#!/bin/bash
|
||||
printf "importing...\n"
|
||||
sudo mysql -u root -pdbas --default-character-set=utf8mb4 < backupdb2.sql
|
||||
printf "optimizing...\n"
|
||||
sudo mysql -u root -pdbas --default-character-set=utf8mb4 < optimize.sql
|
||||
printf "stopping mariadb service\n"
|
||||
sudo service mariadb stop
|
||||
printf "truncating logs\n"
|
||||
sudo truncate /var/log/mariadb/adrastea.log -s 0
|
||||
sudo truncate /var/log/mariadb/adrastea-slow.log -s 0
|
||||
printf "restarting mariadb service\n"
|
||||
sudo service mariadb start
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Translate.Interface;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text;
|
||||
|
||||
@@ -8,8 +7,8 @@ namespace Translate.Services
|
||||
/// <summary>
|
||||
/// This program performs translations from a MySql dump file to a file that can be imported by MariaDb.
|
||||
/// The main purpose is to translate 'utf8mb4_0900_ai_ci' embeddings in the MySql dump file to 'utf8mb4_unicode_ci'
|
||||
/// which is what MariaDb can recognize. It also skips the MySql database and only imports the
|
||||
/// market_data, portfolio_data, and user_data databases.
|
||||
/// which is what MariaDb can recognize.
|
||||
/// The import includes MySql, market_data, portfolio_data, and user_data databases.
|
||||
/// It also has some logic for options I used for debugging like skipping the insert statements and limting the numnber of output lines
|
||||
/// </summary>
|
||||
public class MainService : IMainService
|
||||
@@ -19,7 +18,7 @@ namespace Translate.Services
|
||||
bool includeInserts = true;
|
||||
bool useMaxLines = false;
|
||||
long maxLines = 2000;
|
||||
int writerBufferSize=65536;
|
||||
int writerBufferSize=65536; // the write buffer size for the output stream
|
||||
|
||||
String strTargetItem="utf8mb4_0900_ai_ci";
|
||||
String strReplacementItem="utf8mb4_general_ci"; // "utf8mb4_unicode_ci"
|
||||
@@ -32,7 +31,6 @@ namespace Translate.Services
|
||||
|
||||
Console.WriteLine($"Replacing {strTargetItem} with {strReplacementItem}");
|
||||
|
||||
|
||||
Console.WriteLine("Input: {0}, Output:{1}, correct Y/N?",args[0],args[1]);
|
||||
String response = Console.ReadLine();
|
||||
if(!"YES".Equals(response,StringComparison.InvariantCultureIgnoreCase))return;
|
||||
@@ -49,12 +47,13 @@ namespace Translate.Services
|
||||
|
||||
if(File.Exists(pathOutput))
|
||||
{
|
||||
Console.WriteLine($"Deleting {pathOutput}");
|
||||
File.Delete(pathOutput);
|
||||
}
|
||||
|
||||
// if encounter these in the input then stop
|
||||
String[] unexpectedLines =
|
||||
{
|
||||
// "-- Current Database: `mysql`",
|
||||
"-- Current Database: `performance_schema`",
|
||||
"-- Current Database: `information_schema`",
|
||||
"-- Current Database: `sys`",
|
||||
@@ -94,9 +93,10 @@ namespace Translate.Services
|
||||
|
||||
if(strLine.StartsWith("-- Current Database: `mysql`"))
|
||||
{
|
||||
Console.WriteLine("skipping mysql");
|
||||
writing=false;
|
||||
continue;
|
||||
//Console.WriteLine("skipping mysql");
|
||||
// writing=false;
|
||||
// continue;
|
||||
writing=true;
|
||||
}
|
||||
else if(strLine.StartsWith("-- Current Database: `market_data`"))
|
||||
{
|
||||
|
||||
@@ -3,5 +3,3 @@ cd /home/pi/ARM64/Translate/Translate/bin/Debug/net8.0
|
||||
./translate /mnt/mariadb/backupdb.sql /mnt/mariadb/backupdb2.sql
|
||||
cd /mnt/mariadb
|
||||
./restoredb.sh
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user