-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimal setup takes ridiculous amounts of disk space #124
Comments
I've pasted some text from a wiki page I wrote when I was evaluating tiedot for a project. The line numbers are no longer correct, but it looks like all the settings are still the same. Hope that helps!
|
Hyvaa huomenta! I entirely agree with you, the initial data file size can be quite large, and you probably have a 6-core Xeon E3 or Intel i7 extreme edition. Those numbers were written down as constants because altering them after creation of a collection is quite a challenging task. If tiedot used a tree or skip list data structure for indexes, those huge numbers can be avoided. And that reminds me of the famous quote "today's constant is tomorrow's variable". tiedot has seen very infrequent updates in the recent months, therefore it may be viable to maintain a fork with tweaked constants. I hope that helps. |
Is there any reason these couldn't be configured using environmental variables? If you wanted me to make a pull request I'm sure I could get around to it in the next couple days. |
It was an incorrect decision to make them constants in the beginning. How about this: write down collection and hashtable parameters into a JSON or text file underneath database directory. If the file exists, the parameters from the file will be used to operate on collections; if it does not exist, the default value (the current constants) will be used instead, and the file shall be created and default values written down. |
Sounds like a plan, I will start working on a pr |
Wonderful to hear! Many thanks for your help. |
#157 Added this, let me know what you think. |
import (
"github.com/HouzuoGuo/tiedot/db"
"strconv"
"io/ioutil"
"os"
//"sync"
)
const (
NUM_PARTS = 2
)
//
// Pre-write concurrent configuration to prevent excessive hard disk pre-allocation
//
func writeDBConfig(dbname string) (err error) {
// Multi-threaded locking
num := []byte(strconv.Itoa(NUM_PARTS))
numFile := "./db_base_path/"+ dbname +"/"+ db.PART_NUM_FILE
// Ignore if the file already exists
if _, err := os.Stat(numFile); err == nil {
return nil
}
if err := ioutil.WriteFile(numFile, num, 0600); err != nil {
return err
}
return nil
} |
I created the most minimal database to test tiedot a bit.
I created one collection,
test
, and inserted one document into it:I checked the filesystem, and there's 768MB of files created by tiedot.
I can understand some preallocation, but having the minimal setup take 3/4 of a GIGABYTE of disk space is quite excessive.
The text was updated successfully, but these errors were encountered: