From 1f7d71658fa0e90ad8d9a0e0bbd540724f8d22bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 4 Mar 2021 01:00:53 -0500
Subject: [PATCH] Looks like a vbuf size of a record is broken. :(

---
 exec/load/recordfile.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/exec/load/recordfile.js b/exec/load/recordfile.js
index aaf684db47..6c3ebdfe97 100644
--- a/exec/load/recordfile.js
+++ b/exec/load/recordfile.js
@@ -70,7 +70,9 @@ function RecordFile(filename, definition)
 	this.fields=definition;
 	this.RecordLength=getRecordLength(this.fields);
 	// A vbuf of a record length prevents more than one record from being in the buffer.
-	if(!this.file.open(file_exists(this.file.name)?"rb+":"wb+",true,this.RecordLength)) {
+	// Nope, it doesn't... use zero an force unbuffered.
+	// This will be super-slow until/unless some serialization is added.
+	if(!this.file.open(file_exists(this.file.name)?"rb+":"wb+",true,0)) {
 		return(null);
 	}
 	Object.defineProperty(this, 'length', {
@@ -97,6 +99,8 @@ RecordFileRecord.prototype.flushRead = function(keeplocked)
 	var flushed = false;
 	var tmp;
 
+	// With buffer size of zero, this isn't needed
+	return;
 	locked = (this.parent.locks.indexOf(this.Record) !== -1);
 	if (keeplocked === undefined) {
 		if (locked) {
@@ -115,7 +119,7 @@ RecordFileRecord.prototype.flushRead = function(keeplocked)
 			this.unLock();
 		}
 		this.parent.file.close();
-		if (!this.parent.file.open('rb+', true, this.parent.RecordLength)) {
+		if (!this.parent.file.open('rb+', true, 0)) {
 			throw new Error('Unable to re-open '+this.parent.file.name);
 		}
 		if (locked) {
-- 
GitLab