(empty log message)
@@ -39,7 +39,7 @@ | ||
39 | 39 | // Total Size |
40 | 40 | private AtomicInteger totalSize = null; |
41 | 41 | |
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(); | |
43 | 43 | // private int oneDataLength = 1 + 170 + 2560; |
44 | 44 | |
45 | 45 | private List tmpList = null; |
@@ -37,7 +37,7 @@ | ||
37 | 37 | bigValueStoreDirs[0] + "/partialbigdata3/", |
38 | 38 | bigValueStoreDirs[0] + "/partialbigdata4/", |
39 | 39 | 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); | |
41 | 41 | } |
42 | 42 | |
43 | 43 | } |
@@ -40,7 +40,7 @@ | ||
40 | 40 | bigValueStoreDirs[0] + "/partialbigdata3/", |
41 | 41 | bigValueStoreDirs[0] + "/partialbigdata4/", |
42 | 42 | 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); | |
44 | 44 | } |
45 | 45 | } |
46 | 46 |
@@ -120,8 +120,13 @@ | ||
120 | 120 | this.overSizeDataStore = new FileBaseDataMap(overSizeDataStoreDirs, 100000, 0.01, ImdstDefine.saveDataMaxSize, ImdstDefine.dataFileWriteMaxSize*5, ImdstDefine.dataFileWriteMaxSize*15); |
121 | 121 | |
122 | 122 | |
123 | + | |
124 | + File valueFile = new File(lineFile); | |
125 | + if (!valueFile.exists() || valueFile.length() < 1) { | |
126 | + super.clear(); | |
127 | + } | |
123 | 128 | // データ操作記録ファイル用の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); | |
125 | 130 | this.dataFileBufferUseCount = new AtomicInteger(0); |
126 | 131 | |
127 | 132 | // 共有データファイルの再書き込み遅延指定 |
@@ -148,29 +153,37 @@ | ||
148 | 153 | // 終端を探すまでに壊れてしまっているデータは無効データ(ブランクデータ)に置き換える |
149 | 154 | String readDataLine = null; |
150 | 155 | 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("&"); | |
166 | 172 | shiftByteSize++; |
173 | + } | |
167 | 174 | |
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; | |
173 | 178 | } |
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 | + } | |
174 | 187 | } |
175 | 188 | } |
176 | 189 |
@@ -347,7 +347,7 @@ | ||
347 | 347 | if (this.allDataMemory) { |
348 | 348 | |
349 | 349 | // 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); | |
351 | 351 | } else { |
352 | 352 | |
353 | 353 | // 非memoryモードの場合をValueの位置をFileMapのValueに入れる |
@@ -140,7 +140,7 @@ | ||
140 | 140 | // 一度でもエラーになった接続は再利用しない |
141 | 141 | this.useCount = Integer.MAX_VALUE; |
142 | 142 | |
143 | - long uTime = System.nanoTime(); | |
143 | + //long uTime = System.nanoTime(); | |
144 | 144 | //System.out.println("this.retryConnectMode=" + this.retryConnectMode + ", this.retry=" + this.retry + ", ConnectDump=" + this.connectorDump() + ", retryStr=" +retryStr + ", utime=" + uTime); |
145 | 145 | if (this.retryConnectMode == true && this.retry == false) { |
146 | 146 | this.retry = true; |
@@ -177,6 +177,7 @@ | ||
177 | 177 | if (retryStr != null) { |
178 | 178 | |
179 | 179 | //System.out.println("println utime=" + uTime); |
180 | + this.socket.setSoTimeout(ImdstDefine.nodeConnectionTimeout*5); | |
180 | 181 | this.pw.println(retryStr); |
181 | 182 | this.pw.flush(); |
182 | 183 | ret = this.br.readLine(); |
@@ -185,6 +186,7 @@ | ||
185 | 186 | // 再度試す |
186 | 187 | this.close(); |
187 | 188 | this.connect(); |
189 | + this.socket.setSoTimeout(ImdstDefine.nodeConnectionTimeout*5); | |
188 | 190 | this.pw.println(retryStr); |
189 | 191 | this.pw.flush(); |
190 | 192 | ret = this.br.readLine(); |
@@ -191,7 +193,7 @@ | ||
191 | 193 | } |
192 | 194 | //System.out.println("readLine utime=" + uTime + " readStr=" + ret); |
193 | 195 | } |
194 | - | |
196 | + this.socket.setSoTimeout(ImdstDefine.nodeConnectionTimeout); | |
195 | 197 | retry = false; |
196 | 198 | } catch(Exception ee) { |
197 | 199 | //System.out.println("throw Point 2 uTime=" + uTime + " nowTime=" + System.nanoTime()); |