diff --git a/db/sqlite.go b/db/sqlite.go index 3bd6b78..03e362d 100644 --- a/db/sqlite.go +++ b/db/sqlite.go @@ -9,6 +9,10 @@ import ( "strings" "time" ) +/* +sqlite extract: https://stackoverflow.com/questions/15448373/how-to-dump-a-file-stored-in-a-sqlite-database-as-a-blob +sqlite3 my.db "SELECT writefile('object0.gz', MyBlob) FROM MyTable WHERE id = 1" +*/ const migrateScript = ` alter table blocks add mtime integer default 0; diff --git a/mapblockparser/metadata.go b/mapblockparser/metadata.go index fb29ee7..e692e65 100644 --- a/mapblockparser/metadata.go +++ b/mapblockparser/metadata.go @@ -11,6 +11,10 @@ import ( "strings" ) +/* +lua vm: https://github.com/yuin/gopher-lua +*/ + const ( INVENTORY_TERMINATOR = "EndInventory" INVENTORY_END = "EndInventoryList" @@ -103,7 +107,7 @@ func parseMetadata(mapblock *MapBlock, data []byte) (int, error) { txt := scanner.Text() offset += len(txt) + 1 - log.WithFields(logrus.Fields{"txt":txt, "position":position}).Info("Parsing inventory") + log.WithFields(logrus.Fields{"txt":txt, "position":position}).Trace("Parsing inventory") if strings.HasPrefix(txt, INVENTORY_START) { diff --git a/mapobjectdb/accessor.go b/mapobjectdb/accessor.go index 275fce0..4c92b60 100644 --- a/mapobjectdb/accessor.go +++ b/mapobjectdb/accessor.go @@ -4,6 +4,12 @@ import ( "mapserver/coords" ) +/* +sqlite perf: https://stackoverflow.com/questions/1711631/improve-insert-per-second-performance-of-sqlite?rq=1 +PRAGMA synchronous = OFF +PRAGMA journal_mode = MEMORY +*/ + type Tile struct { Pos *coords.TileCoords Data []byte diff --git a/mapobjectdb/sqlite_migrate.go b/mapobjectdb/sqlite_migrate.go index e182f93..71a2c83 100644 --- a/mapobjectdb/sqlite_migrate.go +++ b/mapobjectdb/sqlite_migrate.go @@ -30,6 +30,9 @@ create table if not exists tiles( zoom int, primary key(x,y,zoom,layerid) ); + +-- PRAGMA synchronous = OFF; +-- PRAGMA journal_mode = MEMORY; ` type Sqlite3Accessor struct {