• R/O
  • SSH
  • HTTPS

okuyama: 提交


Commit MetaInfo

修訂913 (tree)
時間2012-02-13 20:01:24
作者okuyamaoo

Log Message

(empty log message)

Change Summary

差異

--- trunk/src/okuyama/imdst/util/FileBaseDataList.java (revision 912)
+++ trunk/src/okuyama/imdst/util/FileBaseDataList.java (revision 913)
@@ -39,7 +39,7 @@
3939 // Total Size
4040 private AtomicInteger totalSize = null;
4141
42- private int oneDataLength = 35 + new Double(ImdstDefine.saveKeyMaxSize * 1.33 + 1).intValue() + new Double(ImdstDefine.saveDataMaxSize * 1.33 + 1).intValue();
42+ private int oneDataLength = 35 + new Double(ImdstDefine.saveKeyMaxSize * 1.38 + 1).intValue() + new Double(ImdstDefine.saveDataMaxSize * 1.40 + 1).intValue();
4343 // private int oneDataLength = 1 + 170 + 2560;
4444
4545 private List tmpList = null;
--- trunk/src/okuyama/imdst/util/PartialConcurrentHashMap.java (revision 912)
+++ trunk/src/okuyama/imdst/util/PartialConcurrentHashMap.java (revision 913)
@@ -37,7 +37,7 @@
3737 bigValueStoreDirs[0] + "/partialbigdata3/",
3838 bigValueStoreDirs[0] + "/partialbigdata4/",
3939 bigValueStoreDirs[0] + "/partialbigdata5/"};
40- this.bigValueStoreMap = new FileBaseDataMap(bigValueStoreDir, 100000, 0.01, ImdstDefine.saveDataMaxSize, ImdstDefine.memoryStoreLimitSize*2, ImdstDefine.memoryStoreLimitSize*6);
40+ this.bigValueStoreMap = new FileBaseDataMap(bigValueStoreDir, 100000, 0.01, new Double(ImdstDefine.saveDataMaxSize*1.40).intValue(), ImdstDefine.memoryStoreLimitSize*2, ImdstDefine.memoryStoreLimitSize*6);
4141 }
4242
4343 }
--- trunk/src/okuyama/imdst/util/PartialSerializeMap.java (revision 912)
+++ trunk/src/okuyama/imdst/util/PartialSerializeMap.java (revision 913)
@@ -40,7 +40,7 @@
4040 bigValueStoreDirs[0] + "/partialbigdata3/",
4141 bigValueStoreDirs[0] + "/partialbigdata4/",
4242 bigValueStoreDirs[0] + "/partialbigdata5/"};
43- this.bigValueStoreMap = new FileBaseDataMap(bigValueStoreDir, 100000, 0.01, ImdstDefine.saveDataMaxSize, ImdstDefine.memoryStoreLimitSize*2, ImdstDefine.memoryStoreLimitSize*6);
43+ this.bigValueStoreMap = new FileBaseDataMap(bigValueStoreDir, 100000, 0.01, new Double(ImdstDefine.saveDataMaxSize*1.40).intValue(), ImdstDefine.memoryStoreLimitSize*2, ImdstDefine.memoryStoreLimitSize*6);
4444 }
4545 }
4646
--- trunk/src/okuyama/imdst/util/KeyManagerValueMap.java (revision 912)
+++ trunk/src/okuyama/imdst/util/KeyManagerValueMap.java (revision 913)
@@ -120,8 +120,13 @@
120120 this.overSizeDataStore = new FileBaseDataMap(overSizeDataStoreDirs, 100000, 0.01, ImdstDefine.saveDataMaxSize, ImdstDefine.dataFileWriteMaxSize*5, ImdstDefine.dataFileWriteMaxSize*15);
121121
122122
123+
124+ File valueFile = new File(lineFile);
125+ if (!valueFile.exists() || valueFile.length() < 1) {
126+ super.clear();
127+ }
123128 // データ操作記録ファイル用のBufferedWriter
124- this.bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(lineFile), true), ImdstDefine.keyWorkFileEncoding), 1024*256);
129+ this.bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(valueFile, true), ImdstDefine.keyWorkFileEncoding), 1024*256);
125130 this.dataFileBufferUseCount = new AtomicInteger(0);
126131
127132 // 共有データファイルの再書き込み遅延指定
@@ -148,29 +153,37 @@
148153 // 終端を探すまでに壊れてしまっているデータは無効データ(ブランクデータ)に置き換える
149154 String readDataLine = null;
150155 while((readDataLine = br.readLine()) != null){
151- if (!readDataLine.trim().equals("")) {
152- counter++;
153- if (readDataLine.getBytes().length < this.oneDataLength) {
154- int shiftByteSize = 0;
155- if (readDataLine.length() < "(B)!0".length()) {
156- int shift = "(B)!0".length() - readDataLine.length();
157- shiftByteSize = shift;
158- }
159- readDataLine = "(B)!0";
160- StringBuilder updateBuf = new StringBuilder(readDataLine);
161- for (int i = 0; i < (this.oneDataLength - readDataLine.length()); i++) {
162- updateBuf.append("&");
163- shiftByteSize++;
164- }
165- updateBuf.append("\n");
156+
157+ counter++;
158+ boolean zeroDataFlg = false;
159+ int writeLen = this.oneDataLength;
160+ if (readDataLine.trim().length() == 0) zeroDataFlg = true;
161+
162+ if (readDataLine.getBytes().length < this.oneDataLength) {
163+ int shiftByteSize = 0;
164+ if (readDataLine.length() < "(B)!0".length()) {
165+ int shift = "(B)!0".length() - readDataLine.length();
166+ shiftByteSize = shift;
167+ }
168+ readDataLine = "(B)!0";
169+ StringBuilder updateBuf = new StringBuilder(readDataLine);
170+ for (int i = 0; i < (this.oneDataLength - readDataLine.length()); i++) {
171+ updateBuf.append("&");
166172 shiftByteSize++;
173+ }
167174
168- this.raf.seek(this.convertLineToSeekPoint(counter));
169- this.raf.write(updateBuf.toString().getBytes(), 0, this.oneDataLength+1);
170- for (int i = 0; i < shiftByteSize; i++) {
171- br.read();
172- }
175+ if(!zeroDataFlg) {
176+ updateBuf.append("\n");
177+ writeLen = writeLen + 1;
173178 }
179+
180+ shiftByteSize++;
181+
182+ this.raf.seek(this.convertLineToSeekPoint(counter));
183+ this.raf.write(updateBuf.toString().getBytes(), 0, writeLen);
184+ for (int i = 0; i < shiftByteSize; i++) {
185+ br.read();
186+ }
174187 }
175188 }
176189
--- trunk/src/okuyama/imdst/util/CoreValueMap.java (revision 912)
+++ trunk/src/okuyama/imdst/util/CoreValueMap.java (revision 913)
@@ -347,7 +347,7 @@
347347 if (this.allDataMemory) {
348348
349349 // memoryモードの場合はリアルValueをFileMapのValueに入れる
350- this.urgentSaveMap = new FileBaseDataMap(this.virtualStoreDirs, 100000, 0.05, (new Double(ImdstDefine.saveDataMaxSize * 1.38).intValue() + 1), 512, 1024*124);
350+ this.urgentSaveMap = new FileBaseDataMap(this.virtualStoreDirs, 100000, 0.05, (new Double(ImdstDefine.saveDataMaxSize * 1.4).intValue() + 1), 512, 1024*124);
351351 } else {
352352
353353 // 非memoryモードの場合をValueの位置をFileMapのValueに入れる
--- trunk/src/okuyama/imdst/util/io/KeyNodeConnector.java (revision 912)
+++ trunk/src/okuyama/imdst/util/io/KeyNodeConnector.java (revision 913)
@@ -140,7 +140,7 @@
140140 // 一度でもエラーになった接続は再利用しない
141141 this.useCount = Integer.MAX_VALUE;
142142
143- long uTime = System.nanoTime();
143+ //long uTime = System.nanoTime();
144144 //System.out.println("this.retryConnectMode=" + this.retryConnectMode + ", this.retry=" + this.retry + ", ConnectDump=" + this.connectorDump() + ", retryStr=" +retryStr + ", utime=" + uTime);
145145 if (this.retryConnectMode == true && this.retry == false) {
146146 this.retry = true;
@@ -177,6 +177,7 @@
177177 if (retryStr != null) {
178178
179179 //System.out.println("println utime=" + uTime);
180+ this.socket.setSoTimeout(ImdstDefine.nodeConnectionTimeout*5);
180181 this.pw.println(retryStr);
181182 this.pw.flush();
182183 ret = this.br.readLine();
@@ -185,6 +186,7 @@
185186 // 再度試す
186187 this.close();
187188 this.connect();
189+ this.socket.setSoTimeout(ImdstDefine.nodeConnectionTimeout*5);
188190 this.pw.println(retryStr);
189191 this.pw.flush();
190192 ret = this.br.readLine();
@@ -191,7 +193,7 @@
191193 }
192194 //System.out.println("readLine utime=" + uTime + " readStr=" + ret);
193195 }
194-
196+ this.socket.setSoTimeout(ImdstDefine.nodeConnectionTimeout);
195197 retry = false;
196198 } catch(Exception ee) {
197199 //System.out.println("throw Point 2 uTime=" + uTime + " nowTime=" + System.nanoTime());
Show on old repository browser