I have one ElasticNode 7.3.2 in my cluster which has crashed and since then isn't able to restart, but still contains important data (last replicas are on this node).
Caused by: java.io.IOException: failed to find metadata for existing index indexname-2019.06.23 [location: ORVU14kLSf6kIv8ULliijA, generation: 178]
i dont care about this special index, can i just remove this one from the state file? I already tried to remove it via an HexEditor, but then he complains about are not valid hash-checksum ;)
I already tried to decode it via SMILE, but it seems that *.st files dont follow the exact specifications only partially.
Does someone has an idea? Or a good tool to edit it?
Thanks
I had a similar case in which I corrupted my index settings with invalid similarity settings. Unfortunately, the settings were written to file by ES without validity check and afterwards I could not open the index again. So I got the index meta data from data/nodes/0/indices/<index UID>/_state/state-xx.st and figured out how to load it, change it and store it back again. I used ES 5.4 so the code I give here will be slightly different in ES 7.x. It goes like this:
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Paths;
public class RepairIndexSettings {
public static void main(String args[]) throws IOException {
// Load the existing, possibly corrupt index file
IndexMetaData d = IndexMetaData.FORMAT.read(NamedXContentRegistry.EMPTY, Paths.get( "indexstaterepair","_state", "state-11.st"));
// Create new IndexMetaData by copying all the valid meta data from the original and removing or fixing
// the corrupt settings.
Settings.Builder sb = Settings.builder();
for (String key : d.getSettings().keySet()) {
if (!key.contains("similarity"))
sb.put(key, d.getSettings().get(key));
}
IndexMetaData newd = IndexMetaData.builder(d).settings(sb).build();
// Write the new index state to file
IndexMetaData.FORMAT.write(newd, Paths.get("indexstaterepair"));
}
}
I replaced the original state file with the new one and could open and use the index normally afterwards.
You would have to use another MetaData subclass but I think it should be quite similar otherwise.
No, there's no way to edit any files inside the data directory by hand. If you're getting an exception like failed to find metadata for existing index then there's something quite wrong with your storage, or something other than Elasticsearch has modified its contents. In either case, this has corrupted this node. The best path forward is to wipe the data path and start the node afresh so that Elasticsearch can rebuild any lost shards from elsewhere in the cluster or else restore them from a recent snapshot.
Related
I am using the jackc/pgx driver alongside the GORM library to interface with a PostgreSQL database.
I have an instance where I have to check the PostgreSQL error code and handle a certain error type differently. When using the pgx driver, the GORM methods return a *pgconn.PgError type as the error, which contains a field with the specific error code.
In order to access that field, I must cast the error to a *pgconn.PgError, but for some reason this is failing:
res := tx.Take(&f, "id = ?", id)
if res.Error != nil {
if pqErr, ok := res.Error.(*pgconn.PgError); ok {
// does not reach here
} else {
fmt.Printf("Error type: %T\n", res.Error)
// Output: "Error type: *pgconn.PgError"
}
}
Notes:
The pgx and pgconn packages are inside the same project, so it's not the case that they are returning different versions of a type with the same name. In other words, I only have one import in my go.mod.
The returned value is not nil.
A debugger reveals that the type is a *pgconn.PgError.
You've solved your own issue, but here's some perhaps helpful background, and how I found the source.
Packages of the same name can exist in the same program, so long as they have different import paths. For example, the standard library has both math/rand and crypto/rand, each called rand. This is the first hint of how *pgconn.PgError and *pgconn.PgError are not the same: they come from different import paths.
When modules in Go make major revisions, they are supposed to change their import path. This is to preserve backwards compatibility with respect to import paths. Note that this is usually done by updating the module declaration in the go.mod file, rather than actually moving the code into a sub-directory. For example, see this commit where pgx was bumped from v4 to v5. This is the second hint: code from the pgx project is available under multiple import paths (due to the multiple major versions).
With this background in mind, I used the git tags to view the repository at the latest v4.x.x release. I noticed that oddly, the pgconn package did not exist in v4. This seemed to rule out the idea of a github.com/jackc/pgx/v4/pgconn vs github.com/jackc/pgx/v5/pgconn conflict. I then Google searched for "pgconn" and found the github.com/jackc/pgconn repository, where I saw in the README:
This version is used with pgx v4. In pgx v5 it is part of the https://github.com/jackc/pgx repository.
From the other information you've given, your mistake may have been using the import path "github.com/jackc/pgx/pgconn". As shown in the example code for pgx, the current import path you should be using for the base module is "github.com/jackc/pgx/v5", and packages within it would be specified similarly, e.g., "github.com/jackc/pgx/v5/pgconn".
As #HymnsForDisco correctly pointed out in the comments, both github.com/jackc/pgconn and github.com/jackc/pgx/pgconn exist. It turns out that the returned error was from the former, whereas I was importing the latter in my code.
To confirm, I added the following line:
fmt.Println("Error path: ", reflect.TypeOf(res.Error).Elem().PkgPath())
// Output: "Error path: github.com/jackc/pgconn"
Changing my import to "github.com/jackc/pgconn" resolved the issue.
I am trying to import a archived document that was checked-in earlier, but I want to import it using RIDC program, following is the code I am working on:
IdcClientManager manager = new IdcClientManager();
IdcClient idcClient= manager.createClient("http://localhost/idc/idcplg");
IdcContext idcContext = new IdcContext("sysadmin", "idc");
// get the binder
DataBinder binder = idcClient.createBinder();
//populate the binder with the parameters
binder.putLocal("IdcService", "IMPORT_DOCUMENT");
binder.putLocal("Idc_Name", "idc");
binder.putLocal("aArchiveName", "idc//test1");
binder.putLocal("dDocName", "000022");
binder.putLocal("dCollectionName", "test_checkin");
ServiceResponse response = idcClient.sendRequest(idcContext, binder);
DataBinder binderResult = response.getResponseAsBinder();
But I am getting the following error:
Unable to execute service IMPORT_DOCUMENT and function executeArchiveMethod.
(System Error: The collection name must be specified.)
I specified dCollectionID, dCollectionName,dCollectionLocation, but faced same result.
Can anyone guide me about this error, or where I am getting wrong in implementing this code.
For better understanding I would like to tell that the specified document was earlier checked in using WebDAV.
Any kind of help will be grateful.
Parameters are case-sensitive. You need to use IDC_Name.
I’m using the new Xcode 8 feature of code generation for my Core Data model using Class Definition as the Codegen option.
When I build I get the following output for each of my entities:
<unknown>:0: error: no such file or directory: ‘/path/to/DerivedSources/CoreDataGenerated/Model/.Entity+CoreDataClass.swift'
<unknown>:0: error: no such file or directory: ‘/path/to/DerivedSources/CoreDataGenerated/Model/.Entity+CoreDataProperties.swift’
...
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
On inspecting the files I can see the following:
Entity+CoreDataClass.swift:
import Foundation
import CoreData
public class Entity: NSManagedObject {
}
Entity+CoreDataProperties.swift
import Foundation
import CoreData
import
extension Entity {
#nonobjc public class func fetchRequest() -> NSFetchRequest<Entity> {
return NSFetchRequest<Entity>(entityName: “Entity");
}
#NSManaged public var title: String?
}
In the second, the obvious thing that shouldn’t be there is the empty import statement, which I’m guessing is causing the crash.
Could I be doing something wrong? Is this a bug?
I’ve tried all the usual, clean, clean build folder, restart Xcode/Mac with no luck.
The Module field of the entity in the Data Model inspector had a value in it, I deleted this so now it’s empty and the placeholder reads “Global namespace”. This seems to have worked!
Core Data is heavily string-based. Using names such as "Entity" for your entities can lead to unexpected results. Also avoid using names in your data model such as "description", or "item" or "attribute" etc. If you do want to use those names, prefix them: names like "My_entity" or "ACEntity" are fine.
I was trying to import the data from one hbase(v0.98.4) to another hbase(v0.98.13).
I have exported the data using the below command -
hbase org.apache.hadoop.hbase.mapreduce.Driver export 'tblname' /path/
But I am not able to import it using the below command -
hbase org.apache.hadoop.hbase.mapreduce.Driver import 'tblname' /hdfs/path/
I get the below deprecation messages as well as an Exception thrown -
Is it becoz of version conflicts between source db and destination db?
I happen to solve it. All I had to do was create an empty table with same metadata and then import it. :)
Try using the commands here for Hbase versions above 0.94. May be you are using generalized Map reduce class and giving export and import as arguments, when the actual classes Export and Import are present. Hope it helps. Happy coding
I'm trying to walk through a Processing tutorial and hitting a wall. I can't even run the sample starter code --I get an error: Cannot find a class or type named "Set" and this line comes back highlighted:
Set<String> tags = le.getCustomElements().getTags();
Am I missing something already?
Some default imports has gone in 2.0. Try
import java.util.*
at the beginning of the code